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

refactored node page

This commit is contained in:
Fedor Katurov 2021-11-06 20:32:00 +07:00
parent 0b77e87778
commit b44266437d
5 changed files with 88 additions and 40 deletions

39
src/pages/node/[id].tsx Normal file
View file

@ -0,0 +1,39 @@
import React, { FC } from 'react';
import { NodeLayout } from '~/layouts/NodeLayout';
import { RouteComponentProps } from 'react-router';
import { useScrollToTop } from '~/utils/hooks/useScrollToTop';
import { useFullNode } from '~/utils/hooks/node/useFullNode';
type Props = RouteComponentProps<{ id: string }> & {};
const NodePage: FC<Props> = ({
match: {
params: { id },
},
}) => {
const {
node,
isLoading,
isLoadingComments,
comments,
commentsCount,
related,
lastSeenCurrent,
} = useFullNode(id);
useScrollToTop([id, isLoadingComments]);
return (
<NodeLayout
node={node}
related={related}
lastSeenCurrent={lastSeenCurrent}
comments={comments}
commentsCount={commentsCount}
isLoading={isLoading}
isLoadingComments={isLoadingComments}
/>
);
};
export default NodePage;