Add toast feedback for RSS and Link copy action.
6369
This commit is contained in:
parent
1f16736e5a
commit
da8000303b
2 changed files with 18 additions and 3 deletions
|
@ -701,7 +701,11 @@
|
|||
"Bid position must be a number.": "Bid position must be a number.",
|
||||
"Copy": "Copy",
|
||||
"Copy Link": "Copy Link",
|
||||
"Link copied.": "Link copied.",
|
||||
"Failed to copy link.": "Failed to copy link.",
|
||||
"Copy RSS URL": "Copy RSS URL",
|
||||
"RSS URL copied.": "RSS URL copied.",
|
||||
"Failed to copy RSS URL.": "Failed to copy RSS URL.",
|
||||
"Text copied": "Text copied",
|
||||
"Rewards Disabled": "Rewards Disabled",
|
||||
"Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content shows in trending or is blocked. %learn_more%.": "Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content shows in trending or is blocked. %learn_more%.",
|
||||
|
|
|
@ -44,7 +44,7 @@ type Props = {
|
|||
collectionName?: string,
|
||||
collectionId: string,
|
||||
isMyCollection: boolean,
|
||||
doToast: ({ message: string }) => void,
|
||||
doToast: ({ message: string, isError?: boolean }) => void,
|
||||
claimIsMine: boolean,
|
||||
fileInfo: FileListItem,
|
||||
prepareEdit: ({}, string, {}) => void,
|
||||
|
@ -183,12 +183,23 @@ function ClaimMenuList(props: Props) {
|
|||
}
|
||||
}
|
||||
|
||||
function copyToClipboard(textToCopy, successMsg, failureMsg) {
|
||||
navigator.clipboard
|
||||
.writeText(textToCopy)
|
||||
.then(() => {
|
||||
doToast({ message: __(successMsg) });
|
||||
})
|
||||
.catch(() => {
|
||||
doToast({ message: __(failureMsg), isError: true });
|
||||
});
|
||||
}
|
||||
|
||||
function handleCopyRssLink() {
|
||||
navigator.clipboard.writeText(rssUrl);
|
||||
copyToClipboard(rssUrl, 'RSS URL copied.', 'Failed to copy RSS URL.');
|
||||
}
|
||||
|
||||
function handleCopyLink() {
|
||||
navigator.clipboard.writeText(shareUrl);
|
||||
copyToClipboard(shareUrl, 'Link copied.', 'Failed to copy link.');
|
||||
}
|
||||
|
||||
function handleReportContent() {
|
||||
|
|
Loading…
Add table
Reference in a new issue