1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

refactored node comments to component

This commit is contained in:
Fedor Katurov 2021-11-06 21:14:50 +07:00
parent b44266437d
commit ab15a10d01
13 changed files with 208 additions and 111 deletions

View file

@ -3,6 +3,9 @@ import { NodeLayout } from '~/layouts/NodeLayout';
import { RouteComponentProps } from 'react-router';
import { useScrollToTop } from '~/utils/hooks/useScrollToTop';
import { useFullNode } from '~/utils/hooks/node/useFullNode';
import { useImageModal } from '~/utils/hooks/useImageModal';
import { useNodeComments } from '~/utils/hooks/node/useNodeComments';
import { useUser } from '~/utils/hooks/user/userUser';
type Props = RouteComponentProps<{ id: string }> & {};
@ -21,17 +24,25 @@ const NodePage: FC<Props> = ({
lastSeenCurrent,
} = useFullNode(id);
const onShowImageModal = useImageModal();
const { onLoadMoreComments, onDelete: onDeleteComment } = useNodeComments(id);
const user = useUser();
useScrollToTop([id, isLoadingComments]);
return (
<NodeLayout
node={node}
user={user}
related={related}
lastSeenCurrent={lastSeenCurrent}
comments={comments}
commentsCount={commentsCount}
isUser={user.is_user}
isLoading={isLoading}
isLoadingComments={isLoadingComments}
onShowImageModal={onShowImageModal}
onLoadMoreComments={onLoadMoreComments}
onDeleteComment={onDeleteComment}
/>
);
};