1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 22:26:41 +07:00

99: fixed comments for SWR node

This commit is contained in:
Fedor Katurov 2022-01-02 17:07:00 +07:00
parent a1dfcc6048
commit 6964324ffb
13 changed files with 149 additions and 268 deletions

View file

@ -9,6 +9,7 @@ import { useGrouppedComments } from '~/utils/hooks/node/useGrouppedComments';
import { useCommentContext } from '~/utils/context/CommentContextProvider';
import { Comment } from '~/components/comment/Comment';
import { useUserContext } from '~/utils/context/UserContextProvider';
import { useNodeContext } from '~/utils/context/NodeContextProvider';
interface IProps {
order: 'ASC' | 'DESC';
@ -16,6 +17,8 @@ interface IProps {
const NodeComments: FC<IProps> = memo(({ order }) => {
const user = useUserContext();
const { node } = useNodeContext();
const {
comments,
count,
@ -41,12 +44,17 @@ const NodeComments: FC<IProps> = memo(({ order }) => {
[left, onLoadMoreComments]
);
if (!node?.id) {
return null;
}
return (
<div className={styles.wrap}>
{order === 'DESC' && more}
{groupped.map(group => (
<Comment
nodeId={node.id!}
key={group.ids.join()}
group={group}
canEdit={canEditComment(group, user)}