From d7344f5047d47d96046855e102d55c4d30dd8f3b Mon Sep 17 00:00:00 2001 From: saltrafael Date: Fri, 27 Aug 2021 07:29:58 -0300 Subject: [PATCH] Add direct reacting from notifications --- CHANGELOG.md | 1 + ui/component/comment/view.jsx | 9 +++ ui/component/commentCreate/view.jsx | 59 ++++++++++-------- ui/component/commentMenuList/view.jsx | 10 ++- ui/component/commentReactions/view.jsx | 18 ++++-- ui/component/commentsReplies/view.jsx | 3 + ui/component/notification/view.jsx | 84 ++++++++++++++++++++------ ui/modal/modalRemoveComment/view.jsx | 18 +++++- ui/page/notifications/index.js | 4 ++ ui/page/notifications/view.jsx | 42 +++++++++++-- ui/scss/component/_comments.scss | 2 + ui/scss/component/_notification.scss | 39 ++++++++++-- 12 files changed, 226 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6e5ec86b..5b4e3c00f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add confirmation on comment removal _community pr!_ ([#6563](https://github.com/lbryio/lbry-desktop/pull/6563)) - Show on content page if a file is part of a playlist already _community pr!_([#6393](https://github.com/lbryio/lbry-desktop/pull/6393)) - Add filtering to playlists ([#6905](https://github.com/lbryio/lbry-desktop/pull/6905)) +- Added direct replying to notifications _community pr!_ ([#6935](https://github.com/lbryio/lbry-desktop/pull/6935)) ### Changed - Use Canonical Url for copy link ([#6500](https://github.com/lbryio/lbry-desktop/pull/6500)) diff --git a/ui/component/comment/view.jsx b/ui/component/comment/view.jsx index bc8222db7..3233d3fb6 100644 --- a/ui/component/comment/view.jsx +++ b/ui/component/comment/view.jsx @@ -64,6 +64,9 @@ type Props = { isModerator: boolean, isGlobalMod: boolean, isFiat: boolean, + supportDisabled: boolean, + setQuickReply: (any) => void, + quickReply: any, }; const LENGTH_TO_COLLAPSE = 300; @@ -100,6 +103,9 @@ function Comment(props: Props) { isModerator, isGlobalMod, isFiat, + supportDisabled, + setQuickReply, + quickReply, } = props; const { @@ -185,6 +191,7 @@ function Comment(props: Props) { function handleSubmit() { updateComment(commentId, editedMessage); + if (setQuickReply) setQuickReply({ ...quickReply, comment_id: commentId, comment: editedMessage }); setEditing(false); } @@ -294,6 +301,7 @@ function Comment(props: Props) { commentIsMine={commentIsMine} handleEditComment={handleEditComment} supportAmount={supportAmount} + setQuickReply={setQuickReply} /> @@ -403,6 +411,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 26c9093e1..ec203e22c 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(''); @@ -522,32 +527,34 @@ export function CommentCreate(props: Props) { requiresAuth={IS_WEB} /> )} - {!claimIsMine && ( -