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

#34 made local comment form uploads

This commit is contained in:
Fedor Katurov 2021-02-27 17:51:12 +07:00
parent f45e34f330
commit 051b199d5d
14 changed files with 422 additions and 189 deletions

View file

@ -45,7 +45,7 @@ type IProps = ReturnType<typeof mapStateToProps> &
const id = 696;
const BorisLayoutUnconnected: FC<IProps> = ({
node: { is_loading, is_loading_comments, comments = [], comment_data, comment_count },
node: { is_loading, is_loading_comments, comments = [], comment_data, comment_count, id },
user,
user: { is_user, last_seen_boris },
nodeLoadNode,
@ -92,7 +92,7 @@ const BorisLayoutUnconnected: FC<IProps> = ({
<div className={styles.container}>
<Card className={styles.content}>
<Group className={styles.grid}>
{is_user && <NodeCommentForm is_before />}
{is_user && <NodeCommentForm isBefore nodeId={id} />}
{is_loading_comments ? (
<NodeNoComments is_loading count={7} />

View file

@ -12,7 +12,7 @@ import { NodeNoComments } from '~/components/node/NodeNoComments';
import { NodeRelated } from '~/components/node/NodeRelated';
import { NodeComments } from '~/components/node/NodeComments';
import { NodeTags } from '~/components/node/NodeTags';
import { INodeComponentProps, NODE_COMPONENTS, NODE_HEADS, NODE_INLINES, } from '~/redux/node/constants';
import { INodeComponentProps, NODE_COMPONENTS, NODE_HEADS, NODE_INLINES } from '~/redux/node/constants';
import { selectUser } from '~/redux/auth/selectors';
import { pick } from 'ramda';
import { NodeRelatedPlaceholder } from '~/components/node/NodeRelated/placeholder';
@ -30,6 +30,7 @@ import { selectModal } from '~/redux/modal/selectors';
import { SidebarRouter } from '~/containers/main/SidebarRouter';
import { ITag } from '~/redux/types';
import { URLS } from '~/constants/urls';
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
const mapStateToProps = (state: IState) => ({
node: selectNode(state),
@ -60,15 +61,6 @@ const NodeLayoutUnconnected: FC<IProps> = memo(
match: {
params: { id },
},
node: {
is_loading,
is_loading_comments,
comments = [],
current: node,
related,
comment_data,
comment_count,
},
modal: { is_shown: is_modal_shown },
user,
user: { is_user },
@ -86,7 +78,15 @@ const NodeLayoutUnconnected: FC<IProps> = memo(
}) => {
const [layout, setLayout] = useState({});
const history = useHistory();
const {
is_loading,
is_loading_comments,
comments = [],
current: node,
related,
comment_data,
comment_count,
} = useShallowSelect(selectNode);
const updateLayout = useCallback(() => setLayout({}), []);
useEffect(() => {
@ -193,7 +193,7 @@ const NodeLayoutUnconnected: FC<IProps> = memo(
/>
)}
{is_user && !is_loading && <NodeCommentForm />}
{is_user && !is_loading && <NodeCommentForm nodeId={node.id} />}
</Group>
<div className={styles.panel}>