Skip to content

Commit

Permalink
Don't show pinning status if autopin is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cypt4 committed Apr 13, 2023
1 parent cdf57f2 commit 4c7e214
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export const PortfolioAsset = (props: Props) => {
const selectedCoinMarket = useUnsafePageSelector(PageSelectors.selectedCoinMarket)
const nftMetadataError = useSafePageSelector(PageSelectors.nftMetadataError)
const nftPinningStatus = useUnsafePageSelector(PageSelectors.nftsPinningStatus)
const isAutoPinEnabled = useSafePageSelector(PageSelectors.isAutoPinEnabled)

// queries
const { data: assetsNetwork } = useGetNetworkQuery(selectedAsset, {
Expand Down Expand Up @@ -435,11 +436,14 @@ export const PortfolioAsset = (props: Props) => {
}, [nftMetadata])

const currentNftPinningStatus = React.useMemo(() => {
if (!isAutoPinEnabled) {
return undefined
}
if (isNftAsset && selectedAsset && nftPinnable) {
return getNftPinningStatus(selectedAsset)
}
return undefined
}, [nftPinnable, isNftAsset, selectedAsset, nftPinningStatus])
}, [nftPinnable, isNftAsset, selectedAsset, nftPinningStatus, isAutoPinEnabled])

// methods
const onClickAddAccount = React.useCallback((tabId: AddAccountNavTypes) => () => {
Expand Down Expand Up @@ -633,7 +637,7 @@ export const PortfolioAsset = (props: Props) => {
sendMessageToNftUiFrame(nftDetailsRef.current.contentWindow, command)
}

if (currentNftPinningStatus && nftDetailsRef?.current) {
if (nftDetailsRef?.current) {
const command: UpdateNftPinningStatus = {
command: NftUiCommand.UpdateNftPinningStatus,
payload: {
Expand Down

0 comments on commit 4c7e214

Please sign in to comment.