diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-10 17:23:47 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-06-10 17:23:47 -0400 |
commit | 770dcf385fa99fbb93c4ae89a51b09fd96d23bf9 (patch) | |
tree | b6463d6827582fa6081dfe89cf98826e1e9a00ea /src/components/comments | |
parent | d4c65c0ba3de95adf3069500491b124df453660f (diff) |
Add util function, Add logic for updating comment preview
Diffstat (limited to 'src/components/comments')
-rw-r--r-- | src/components/comments/AddComment.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/comments/AddComment.tsx b/src/components/comments/AddComment.tsx index 12fd7e4d..18b9c24e 100644 --- a/src/components/comments/AddComment.tsx +++ b/src/components/comments/AddComment.tsx @@ -24,12 +24,14 @@ import {MentionInputControlled} from './MentionInputControlled'; export interface AddCommentProps { momentId: string; placeholderText: string; + callback?: (message: string) => void; theme?: 'dark' | 'white'; } const AddComment: React.FC<AddCommentProps> = ({ momentId, placeholderText, + callback = (msg) => null, theme = 'white', }) => { const {setShouldUpdateAllComments = () => null, commentTapped} = @@ -55,13 +57,15 @@ const AddComment: React.FC<AddCommentProps> = ({ if (trimmed === '') { return; } + const message = inReplyToMention + trimmed; const postedComment = await postComment( - inReplyToMention + trimmed, + message, objectId, isReplyingToComment || isReplyingToReply, ); if (postedComment) { + callback(message); setComment(''); setInReplyToMention(''); |