mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
#23 lost fixes
This commit is contained in:
parent
dddb86c778
commit
c939dcbce8
12 changed files with 254 additions and 177 deletions
40
src/components/boris/BorisComments/index.tsx
Normal file
40
src/components/boris/BorisComments/index.tsx
Normal file
|
@ -0,0 +1,40 @@
|
|||
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 '~/components/node/NodeComments';
|
||||
import { Footer } from '~/components/main/Footer';
|
||||
import { Card } from '~/components/containers/Card';
|
||||
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
|
||||
import { selectAuthUser } from '~/redux/auth/selectors';
|
||||
import { IComment, INode } from '~/redux/types';
|
||||
|
||||
interface IProps {
|
||||
isLoadingComments: boolean;
|
||||
commentCount: number;
|
||||
node: INode;
|
||||
comments: IComment[];
|
||||
}
|
||||
|
||||
const BorisComments: FC<IProps> = ({ isLoadingComments, node, commentCount, comments }) => {
|
||||
const user = useShallowSelect(selectAuthUser);
|
||||
|
||||
return (
|
||||
<Card className={styles.content}>
|
||||
<Group className={styles.grid}>
|
||||
{user.is_user && <NodeCommentForm isBefore nodeId={node.id} />}
|
||||
|
||||
{isLoadingComments ? (
|
||||
<NodeNoComments is_loading count={7} />
|
||||
) : (
|
||||
<NodeComments comments={comments} count={commentCount} user={user} order="ASC" />
|
||||
)}
|
||||
</Group>
|
||||
|
||||
<Footer />
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export { BorisComments };
|
Loading…
Add table
Add a link
Reference in a new issue