mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
refactored boris components
This commit is contained in:
parent
df217b41f7
commit
e071665561
6 changed files with 6 additions and 6 deletions
|
@ -1,52 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { NodeCommentForm } from '~/components/node/NodeCommentForm';
|
||||
import { NodeNoComments } from '~/components/node/NodeNoComments';
|
||||
import { NodeComments } from '~/views/node/NodeComments';
|
||||
import { Footer } from '~/components/main/Footer';
|
||||
import { CommentContextProvider, useCommentContext } from '~/utils/context/CommentContextProvider';
|
||||
import { useUserContext } from '~/utils/context/UserContextProvider';
|
||||
import { useNodeContext } from '~/utils/context/NodeContextProvider';
|
||||
|
||||
interface IProps {}
|
||||
|
||||
const BorisComments: FC<IProps> = () => {
|
||||
const user = useUserContext();
|
||||
const {
|
||||
isLoading,
|
||||
comments,
|
||||
onLoadMoreComments,
|
||||
onDeleteComment,
|
||||
onShowImageModal,
|
||||
count,
|
||||
} = useCommentContext();
|
||||
const { node } = useNodeContext();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Group className={styles.grid}>
|
||||
{user.is_user && <NodeCommentForm isBefore nodeId={node.id} />}
|
||||
|
||||
{isLoading ? (
|
||||
<NodeNoComments is_loading count={7} />
|
||||
) : (
|
||||
<CommentContextProvider
|
||||
comments={comments}
|
||||
count={count}
|
||||
onDeleteComment={onDeleteComment}
|
||||
onLoadMoreComments={onLoadMoreComments}
|
||||
onShowImageModal={onShowImageModal}
|
||||
isLoading={isLoading}
|
||||
>
|
||||
<NodeComments order="ASC" />
|
||||
</CommentContextProvider>
|
||||
)}
|
||||
</Group>
|
||||
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export { BorisComments };
|
Loading…
Add table
Add a link
Reference in a new issue