diff --git a/src/components/Article/Comment.tsx b/src/components/Article/Comment.tsx index 6cfaf59b..bd4406d8 100644 --- a/src/components/Article/Comment.tsx +++ b/src/components/Article/Comment.tsx @@ -36,8 +36,9 @@ type Props = { export const Comment = (props: Props) => { const { t } = useLocalize() const [isReplyVisible, setIsReplyVisible] = createSignal(false) - const [loading, setLoading] = createSignal(false) - const [editMode, setEditMode] = createSignal(false) + const [loading, setLoading] = createSignal(false) + const [editMode, setEditMode] = createSignal(false) + const [clearEditor, setClearEditor] = createSignal(false) const { session } = useSession() const { @@ -81,11 +82,13 @@ export const Comment = (props: Props) => { body: value, shout: props.comment.shout.id }) + setClearEditor(true) setIsReplyVisible(false) setLoading(false) } catch (error) { console.error('[handleCreate reaction]:', error) } + setClearEditor(false) } const toggleEditMode = () => { @@ -175,11 +178,13 @@ export const Comment = (props: Props) => { handleUpdate(value)} submitByShiftEnter={true} + setClear={clearEditor()} /> diff --git a/src/components/Article/CommentsTree.tsx b/src/components/Article/CommentsTree.tsx index 874391d6..7a7b616e 100644 --- a/src/components/Article/CommentsTree.tsx +++ b/src/components/Article/CommentsTree.tsx @@ -33,7 +33,7 @@ const sortCommentsByRating = (a: Reaction, b: Reaction): -1 | 0 | 1 => { } type Props = { - commentAuthors: Author[] + articleAuthors: Author[] shoutSlug: string shoutId: number } @@ -149,7 +149,9 @@ export const CommentsTree = (props: Props) => { {(reaction) => ( a.slug === session()?.user.slug))} + isArticleAuthor={Boolean( + props.articleAuthors.some((a) => a.slug === reaction.createdBy.slug) + )} comment={reaction} lastSeen={dateFromLocalStorage} /> diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index dd9f22a4..7d68604b 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -431,7 +431,7 @@ export const FullArticle = (props: Props) => {