From 1da26529954d1a31e24653d8d2f60386f41b833b Mon Sep 17 00:00:00 2001 From: saltrafael Date: Mon, 23 Aug 2021 11:15:45 -0300 Subject: [PATCH] Add direct reacting from notifications --- ui/component/comment/view.jsx | 9 +++ ui/component/commentCreate/view.jsx | 57 +++++++++------- ui/component/commentMenuList/view.jsx | 10 ++- ui/component/notification/index.js | 8 ++- ui/component/notification/view.jsx | 96 ++++++++++++++++++++++++--- ui/modal/modalRemoveComment/view.jsx | 18 ++++- ui/page/notifications/index.js | 4 ++ ui/page/notifications/view.jsx | 34 +++++++++- ui/scss/component/_comments.scss | 2 + ui/scss/component/_notification.scss | 39 +++++++++-- 10 files changed, 233 insertions(+), 44 deletions(-) diff --git a/ui/component/comment/view.jsx b/ui/component/comment/view.jsx index 6d3c6dc62c0..56df3626c8b 100644 --- a/ui/component/comment/view.jsx +++ b/ui/component/comment/view.jsx @@ -63,6 +63,9 @@ type Props = { isModerator: boolean, isGlobalMod: boolean, isFiat: boolean, + supportDisabled: boolean, + setQuickReply: (any) => void, + quickReply: any, }; const LENGTH_TO_COLLAPSE = 300; @@ -98,6 +101,9 @@ function Comment(props: Props) { isModerator, isGlobalMod, isFiat, + supportDisabled, + setQuickReply, + quickReply, } = props; const { @@ -183,6 +189,7 @@ function Comment(props: Props) { function handleSubmit() { updateComment(commentId, editedMessage); + if (setQuickReply) setQuickReply({ ...quickReply, comment_id: commentId, comment: editedMessage }); setEditing(false); } @@ -292,6 +299,7 @@ function Comment(props: Props) { commentIsMine={commentIsMine} handleEditComment={handleEditComment} supportAmount={supportAmount} + setQuickReply={setQuickReply} /> @@ -401,6 +409,7 @@ function Comment(props: Props) { onCancelReplying={() => { setReplying(false); }} + supportDisabled={supportDisabled} /> )} diff --git a/ui/component/commentCreate/view.jsx b/ui/component/commentCreate/view.jsx index 63e77a026bd..157555aeee8 100644 --- a/ui/component/commentCreate/view.jsx +++ b/ui/component/commentCreate/view.jsx @@ -47,8 +47,10 @@ type Props = { claimIsMine: boolean, sendTip: ({}, (any) => void, (any) => void) => void, doToast: ({ message: string }) => void, + supportDisabled: boolean, doFetchCreatorSettings: (channelId: string) => Promise, settingsByChannelId: { [channelId: string]: PerChannelSettings }, + setQuickReply: (any) => void, }; export function CommentCreate(props: Props) { @@ -71,6 +73,8 @@ export function CommentCreate(props: Props) { doToast, doFetchCreatorSettings, settingsByChannelId, + supportDisabled, + setQuickReply, } = props; const buttonRef: ElementRef = React.useRef(); const { @@ -80,7 +84,7 @@ export function CommentCreate(props: Props) { const [isSubmitting, setIsSubmitting] = React.useState(false); const [commentFailure, setCommentFailure] = React.useState(false); const [successTip, setSuccessTip] = React.useState({ txid: undefined, tipAmount: undefined }); - const { claim_id: claimId } = claim; + const claimId = claim && claim.claim_id; const [isSupportComment, setIsSupportComment] = React.useState(); const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState(); const [tipAmount, setTipAmount] = React.useState(1); @@ -322,6 +326,7 @@ export function CommentCreate(props: Props) { createComment(commentValue, claimId, parentId, txid, payment_intent_id, environment) .then((res) => { setIsSubmitting(false); + if (setQuickReply) setQuickReply(res); if (res && res.signature) { setCommentValue(''); @@ -517,30 +522,32 @@ export function CommentCreate(props: Props) { requiresAuth={IS_WEB} /> )} - {!claimIsMine && ( -