From 61051855343f8881063eddcd097cbe04cc482685 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sun, 25 Jul 2021 23:17:44 +0200 Subject: [PATCH] add toast when someone does a tip for a comment --- ui/component/commentCreate/view.jsx | 34 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/ui/component/commentCreate/view.jsx b/ui/component/commentCreate/view.jsx index 12028b6de..137727907 100644 --- a/ui/component/commentCreate/view.jsx +++ b/ui/component/commentCreate/view.jsx @@ -131,6 +131,7 @@ export function CommentCreate(props: Props) { return; } + // if comment post didn't work, but tip was already made, try againt o create comment if (commentFailure && tipAmount === successTip.tipAmount) { handleCreateComment(successTip.txid); return; @@ -147,6 +148,19 @@ export function CommentCreate(props: Props) { const activeChannelName = activeChannelClaim && activeChannelClaim.name; const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id; + // setup variables for tip API + let channelClaimId, tipChannelName; + // if there is a signing channel it's on a file + if (claim.signing_channel) { + channelClaimId = claim.signing_channel.claim_id; + tipChannelName = claim.signing_channel.name; + + // otherwise it's on the channel page + } else { + channelClaimId = claim.claim_id; + tipChannelName = claim.name; + } + console.log(activeChannelClaim); setIsSubmitting(true); @@ -162,6 +176,14 @@ export function CommentCreate(props: Props) { setTimeout(() => { handleCreateComment(txid); }, 1500); + + doToast({ + message: __("You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!", { + tipAmount: tipAmount, // force show decimal places + tipChannelName + }), + }); + setSuccessTip({ txid, tipAmount }); }, () => { @@ -170,18 +192,6 @@ export function CommentCreate(props: Props) { } ); } else { - // setup variables for tip API - let channelClaimId, tipChannelName; - // if there is a signing channel it's on a file - if (claim.signing_channel) { - channelClaimId = claim.signing_channel.claim_id; - tipChannelName = claim.signing_channel.name; - - // otherwise it's on the channel page - } else { - channelClaimId = claim.claim_id; - tipChannelName = claim.name; - } const sourceClaimId = claim.claim_id;