Skip to content

Commit

Permalink
refresh nft
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNerdi committed Apr 29, 2024
1 parent 17f51ef commit bc81810
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 bc81810

Please sign in to comment.