add toast when someone does a tip for a comment
This commit is contained in:
parent
2025dc75b1
commit
d4618a5e20
1 changed files with 24 additions and 13 deletions
|
@ -131,6 +131,7 @@ export function CommentCreate(props: Props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if comment post didn't work, but tip was already made, try againt o create comment
|
||||||
if (commentFailure && tipAmount === successTip.tipAmount) {
|
if (commentFailure && tipAmount === successTip.tipAmount) {
|
||||||
handleCreateComment(successTip.txid);
|
handleCreateComment(successTip.txid);
|
||||||
return;
|
return;
|
||||||
|
@ -147,27 +148,6 @@ export function CommentCreate(props: Props) {
|
||||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||||
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
||||||
|
|
||||||
setIsSubmitting(true);
|
|
||||||
|
|
||||||
if (activeTab === TAB_LBC) {
|
|
||||||
// call sendTip and then run the callback from the response
|
|
||||||
// second parameter is callback
|
|
||||||
sendTip(
|
|
||||||
params,
|
|
||||||
(response) => {
|
|
||||||
const { txid } = response;
|
|
||||||
// todo: why the setTimeout?
|
|
||||||
setTimeout(() => {
|
|
||||||
handleCreateComment(txid);
|
|
||||||
}, 1500);
|
|
||||||
setSuccessTip({ txid, tipAmount });
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
// reset the frontend so people can send a new comment
|
|
||||||
setIsSubmitting(false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// setup variables for tip API
|
// setup variables for tip API
|
||||||
let channelClaimId, tipChannelName;
|
let channelClaimId, tipChannelName;
|
||||||
// if there is a signing channel it's on a file
|
// if there is a signing channel it's on a file
|
||||||
|
@ -181,6 +161,37 @@ export function CommentCreate(props: Props) {
|
||||||
tipChannelName = claim.name;
|
tipChannelName = claim.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(activeChannelClaim);
|
||||||
|
|
||||||
|
setIsSubmitting(true);
|
||||||
|
|
||||||
|
if (activeTab === TAB_LBC) {
|
||||||
|
// call sendTip and then run the callback from the response
|
||||||
|
// second parameter is callback
|
||||||
|
sendTip(
|
||||||
|
params,
|
||||||
|
(response) => {
|
||||||
|
const { txid } = response;
|
||||||
|
// todo: why the setTimeout?
|
||||||
|
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 });
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
// reset the frontend so people can send a new comment
|
||||||
|
setIsSubmitting(false);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
const sourceClaimId = claim.claim_id;
|
const sourceClaimId = claim.claim_id;
|
||||||
const roundedAmount = Math.round(tipAmount * 100) / 100;
|
const roundedAmount = Math.round(tipAmount * 100) / 100;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue