mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +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 };
|
|
@ -1,18 +0,0 @@
|
|||
@import "~/styles/variables.scss";
|
||||
|
||||
.content {
|
||||
flex: 4;
|
||||
z-index: 2;
|
||||
border-radius: $radius;
|
||||
padding: $gap;
|
||||
background: $node_bg;
|
||||
box-shadow: inset transparentize(mix($wisegreen, white, 60%), 0.6) 0 1px;
|
||||
|
||||
@include desktop {
|
||||
flex: 2.5;
|
||||
}
|
||||
|
||||
@media(max-width: 1024px) {
|
||||
flex: 2;
|
||||
}
|
||||
}
|
|
@ -9,8 +9,6 @@ interface IProps {
|
|||
}
|
||||
|
||||
const BorisStatsGit: FC<IProps> = ({ stats }) => {
|
||||
if (!stats.issues.length) return null;
|
||||
|
||||
const open = useMemo(
|
||||
() => stats.issues.filter(el => !el.pull_request && el.state === 'open').slice(0, 5),
|
||||
[stats.issues]
|
||||
|
@ -21,6 +19,8 @@ const BorisStatsGit: FC<IProps> = ({ stats }) => {
|
|||
[stats.issues]
|
||||
);
|
||||
|
||||
if (!stats.issues.length) return null;
|
||||
|
||||
if (stats.is_loading) {
|
||||
return (
|
||||
<>
|
||||
|
|
|
@ -14,10 +14,10 @@ const stateLabels: Record<IGithubIssue['state'], string> = {
|
|||
};
|
||||
|
||||
const BorisStatsGitCard: FC<IProps> = ({ data: { created_at, title, html_url, state } }) => {
|
||||
if (!title || !created_at) return null;
|
||||
|
||||
const date = useMemo(() => getPrettyDate(created_at), [created_at]);
|
||||
|
||||
if (!title || !created_at) return null;
|
||||
|
||||
return (
|
||||
<div className={styles.wrap}>
|
||||
<div className={styles.time}>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { FC, memo } from 'react';
|
||||
import React, { FC } from 'react';
|
||||
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
|
||||
import { selectAuthIsTester, selectUser } from '~/redux/auth/selectors';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue