From 502dcfae6df8f70a0ae776ba69831a26d70f0cf3 Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 6 May 2024 21:45:17 +0300 Subject: [PATCH] is-posting-comment-feature --- src/components/Article/CommentsTree.tsx | 4 ++++ src/components/Editor/SimplifiedEditor.tsx | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/Article/CommentsTree.tsx b/src/components/Article/CommentsTree.tsx index 8ed6fae2..e8acc1fa 100644 --- a/src/components/Article/CommentsTree.tsx +++ b/src/components/Article/CommentsTree.tsx @@ -68,7 +68,9 @@ export const CommentsTree = (props: Props) => { setCookie() } }) + const [posting, setPosting] = createSignal(false) const handleSubmitComment = async (value: string) => { + setPosting(true) try { await createReaction({ kind: ReactionKind.Comment, @@ -81,6 +83,7 @@ export const CommentsTree = (props: Props) => { console.error('[handleCreate reaction]:', error) } setClearEditor(false) + setPosting(false) } return ( @@ -158,6 +161,7 @@ export const CommentsTree = (props: Props) => { placeholder={t('Write a comment...')} onSubmit={(value) => handleSubmitComment(value)} setClear={clearEditor()} + isPosting={posting()} /> diff --git a/src/components/Editor/SimplifiedEditor.tsx b/src/components/Editor/SimplifiedEditor.tsx index 44401b1c..187fe25f 100644 --- a/src/components/Editor/SimplifiedEditor.tsx +++ b/src/components/Editor/SimplifiedEditor.tsx @@ -36,6 +36,7 @@ import { UploadModalContent } from './UploadModalContent' import { Figcaption } from './extensions/Figcaption' import { Figure } from './extensions/Figure' +import { Loading } from '../_shared/Loading' import styles from './SimplifiedEditor.module.scss' type Props = { @@ -58,6 +59,7 @@ type Props = { controlsAlwaysVisible?: boolean autoFocus?: boolean isCancelButtonVisible?: boolean + isPosting?: boolean } const DEFAULT_MAX_LENGTH = 400 @@ -365,12 +367,14 @@ const SimplifiedEditor = (props: Props) => {