mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(multisubs): add subplebbit address in post info
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import { Role, useSubplebbit } from '@plebbit/plebbit-react-hooks';
|
||||
import { isPendingPostView, isPostPageView } from '../../lib/utils/view-utils';
|
||||
import useWindowWidth from '../../hooks/use-window-width';
|
||||
import styles from './post.module.css';
|
||||
import PostDesktop from './post-desktop';
|
||||
@@ -8,8 +6,6 @@ import PostMobile from './post-mobile';
|
||||
|
||||
export interface PostProps {
|
||||
index?: number;
|
||||
isInPostPage?: boolean;
|
||||
isPendingPostPage?: boolean;
|
||||
post?: any;
|
||||
reply?: any;
|
||||
roles?: Role[];
|
||||
@@ -21,32 +17,13 @@ const Post = ({ post, showAllReplies = false, openReplyModal }: PostProps) => {
|
||||
const subplebbit = useSubplebbit({ subplebbitAddress: post?.subplebbitAddress });
|
||||
const isMobile = useWindowWidth() < 640;
|
||||
|
||||
const params = useParams();
|
||||
const location = useLocation();
|
||||
const isInPostPage = isPostPageView(location.pathname, params);
|
||||
const isPendingPostPage = isPendingPostView(location.pathname, params);
|
||||
|
||||
return (
|
||||
<div className={styles.thread}>
|
||||
<div className={styles.postContainer}>
|
||||
{isMobile ? (
|
||||
<PostMobile
|
||||
isInPostPage={isInPostPage}
|
||||
isPendingPostPage={isPendingPostPage}
|
||||
post={post}
|
||||
roles={subplebbit?.roles}
|
||||
showAllReplies={showAllReplies}
|
||||
openReplyModal={openReplyModal}
|
||||
/>
|
||||
<PostMobile post={post} roles={subplebbit?.roles} showAllReplies={showAllReplies} openReplyModal={openReplyModal} />
|
||||
) : (
|
||||
<PostDesktop
|
||||
isInPostPage={isInPostPage}
|
||||
isPendingPostPage={isPendingPostPage}
|
||||
post={post}
|
||||
roles={subplebbit?.roles}
|
||||
showAllReplies={showAllReplies}
|
||||
openReplyModal={openReplyModal}
|
||||
/>
|
||||
<PostDesktop post={post} roles={subplebbit?.roles} showAllReplies={showAllReplies} openReplyModal={openReplyModal} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user