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

refactored node bottom block as pure component

This commit is contained in:
Fedor Katurov 2021-11-06 21:26:42 +07:00
parent ab15a10d01
commit d4bf94059e
7 changed files with 96 additions and 50 deletions

View file

@ -6,6 +6,7 @@ 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';
import { useNodeTags } from '~/utils/hooks/node/useNodeTags';
type Props = RouteComponentProps<{ id: string }> & {};
@ -25,7 +26,10 @@ const NodePage: FC<Props> = ({
} = useFullNode(id);
const onShowImageModal = useImageModal();
const { onLoadMoreComments, onDelete: onDeleteComment } = useNodeComments(id);
const { onLoadMoreComments, onDelete: onDeleteComment } = useNodeComments(parseInt(id, 10));
const { onDelete: onTagDelete, onChange: onTagsChange, onClick: onTagClick } = useNodeTags(
parseInt(id, 10)
);
const user = useUser();
useScrollToTop([id, isLoadingComments]);
@ -43,6 +47,9 @@ const NodePage: FC<Props> = ({
onShowImageModal={onShowImageModal}
onLoadMoreComments={onLoadMoreComments}
onDeleteComment={onDeleteComment}
onTagDelete={onTagDelete}
onTagClick={onTagClick}
onTagsChange={onTagsChange}
/>
);
};