import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; import NftsItems from '../nfts-items'; import { JustifyContent, FlexDirection, AlignItems, Size, Display, TextAlign, TextVariant, TextColor, } from '../../../helpers/constants/design-system'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { getIsMainnet, getUseNftDetection } from '../../../selectors'; import { EXPERIMENTAL_ROUTE } from '../../../helpers/constants/routes'; import { checkAndUpdateAllNftsOwnershipStatus, detectNfts, showImportNftsModal, } from '../../../store/actions'; import { useNftsCollections } from '../../../hooks/useNftsCollections'; import { Box, ButtonLink, IconName } from '../../component-library'; import { Text } from '../../component-library/text/deprecated'; import NftsDetectionNotice from '../nfts-detection-notice'; import ZENDESK_URLS from '../../../helpers/constants/zendesk-url'; export default function NftsTab() { const useNftDetection = useSelector(getUseNftDetection); const isMainnet = useSelector(getIsMainnet); const history = useHistory(); const t = useI18nContext(); const dispatch = useDispatch(); const { nftsLoading, collections, previouslyOwnedCollection } = useNftsCollections(); const onEnableAutoDetect = () => { history.push(EXPERIMENTAL_ROUTE); }; const onRefresh = () => { if (isMainnet) { dispatch(detectNfts()); } checkAndUpdateAllNftsOwnershipStatus(); }; if (nftsLoading) { return
{t('loadingNFTs')}
; } return ( {Object.keys(collections).length > 0 || previouslyOwnedCollection.nfts.length > 0 ? ( ) : ( <> {isMainnet && !useNftDetection ? ( ) : null} {t('noNFTs')} {t('learnMoreUpperCase')} )} { dispatch(showImportNftsModal()); }} > {t('importNFT')} {!isMainnet && Object.keys(collections).length < 1 ? null : ( <> {isMainnet && !useNftDetection ? ( {t('enableAutoDetect')} ) : ( {t('refreshList')} )} )} ); }