mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
refactored node page
This commit is contained in:
parent
0b77e87778
commit
b44266437d
5 changed files with 88 additions and 40 deletions
39
src/pages/node/[id].tsx
Normal file
39
src/pages/node/[id].tsx
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue