mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Update post.tsx
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Comment, Role, useComment, useEditedComment } from '@plebbit/plebbit-react-hooks';
|
import { Comment, Role, useComment, useEditedComment, useSubplebbit } from '@plebbit/plebbit-react-hooks';
|
||||||
import useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits';
|
import useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits';
|
||||||
import { useLocation, useParams } from 'react-router-dom';
|
import { useLocation, useParams } from 'react-router-dom';
|
||||||
import { isAllView, isDescriptionView, isRulesView } from '../../lib/utils/view-utils';
|
import { isAllView, isDescriptionView, isRulesView } from '../../lib/utils/view-utils';
|
||||||
@@ -57,10 +57,9 @@ const PostPage = () => {
|
|||||||
const isInDescriptionView = isDescriptionView(location.pathname, params);
|
const isInDescriptionView = isDescriptionView(location.pathname, params);
|
||||||
const isInRulesView = isRulesView(location.pathname, params);
|
const isInRulesView = isRulesView(location.pathname, params);
|
||||||
|
|
||||||
const subplebbit = useSubplebbitsStore((state) => state.subplebbits[subplebbitAddress as string]);
|
|
||||||
const { createdAt, description, rules, shortAddress, suggested, title } = subplebbit;
|
|
||||||
|
|
||||||
const comment = useComment({ commentCid });
|
const comment = useComment({ commentCid });
|
||||||
|
const subplebbit = useSubplebbit({ subplebbitAddress });
|
||||||
|
const { createdAt, description, rules, shortAddress, suggested, title } = subplebbit || {};
|
||||||
|
|
||||||
// if the comment is a reply, return the post comment instead, then the reply will be highlighted in the thread
|
// if the comment is a reply, return the post comment instead, then the reply will be highlighted in the thread
|
||||||
const postComment = useComment({ commentCid: comment?.postCid });
|
const postComment = useComment({ commentCid: comment?.postCid });
|
||||||
|
|||||||
Reference in New Issue
Block a user