Skip to content

Commit

Permalink
refresh nft (#2387)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNerdi authored Apr 29, 2024
1 parent 17f51ef commit a738df6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/desktop/components/menus/CollectibleDetailsMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import { localize } from '@core/i18n'
import { isEvmNetwork } from '@core/network'
import { IIrc27Nft, Nft, getPrimaryNftUrl, isNftLocked, isValidNftUri } from '@core/nfts'
import { updateNftInAllAccountNfts } from '@core/nfts/actions'
import { addNftsToDownloadQueue, updateNftInAllAccountNfts } from '@core/nfts/actions'
import { updatePersistedNft } from '@core/nfts/stores'
import { activeProfile, updateActiveProfile } from '@core/profile/stores'
import { Platform } from '@core/app'
export let menu: Menu | undefined = undefined
export let nft: Nft
Expand All @@ -29,6 +30,17 @@
menu?.close()
}
async function onRefreshClick(): Promise<void> {
if (nft.downloadMetadata?.filePath) {
await Platform.deleteFile(nft.downloadMetadata?.filePath)
}
updatePersistedNft(nft.id, { downloadMetadata: {} })
updateNftInAllAccountNfts(nft.id, { downloadMetadata: {}, isLoaded: false })
addNftsToDownloadQueue([nft])
menu?.close()
}
function onHideClick(): void {
updatePersistedNft(nft.id, { hidden: !nft.hidden })
updateNftInAllAccountNfts(nft.id, { hidden: !nft.hidden })
Expand Down Expand Up @@ -56,6 +68,11 @@
disabled: !isValidNftUri(nft.mediaUrl),
onClick: onOpenMediaClick,
},
{
icon: IconName.Refresh,
title: localize('views.collectibles.details.menu.refresh'),
onClick: () => void onRefreshClick(),
},
{
icon: nft.hidden ? IconName.Eye : IconName.EyeOff,
title: localize(`views.collectibles.details.menu.${nft.hidden ? 'unhide' : 'hide'}`),
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@
"loadMedia": "Load media in wallet",
"unsetPfp": "Unset NFT profile pic",
"view": "View media in browser",
"refresh": "Refresh NFT",
"hide": "Hide NFT",
"unhide": "Unhide NFT",
"burn": "Burn NFT"
Expand Down

0 comments on commit a738df6

Please sign in to comment.