import { Image } from '@mui/icons-material' import clsx from 'clsx' import { ComponentType } from 'react' import { useTranslation } from 'react-i18next' import { LoadingDataWithError } from '@dao-dao/types' import { ErrorPage } from '../../error' import { GridCardContainer } from '../../GridCardContainer' import { Dropdown, DropdownProps } from '../../inputs/Dropdown' import { NftCardLoader } from '../../nft/NftCard' import { NoContent } from '../../NoContent' import { Pagination } from '../../Pagination' export interface NftsTabProps { page: number setPage: (page: number) => void pageSize: number nfts: LoadingDataWithError<(N & { key: string })[]> numNfts: LoadingDataWithError NftCard: ComponentType description?: string // If present, will show a dropdown to filter the NFTs. filterDropdownProps?: DropdownProps } export const NftsTab = ({ page, setPage, pageSize, nfts, numNfts, NftCard, description, filterDropdownProps, }: NftsTabProps) => { const { t } = useTranslation() return nfts.errored ? ( ) : numNfts.errored ? ( ) : nfts.loading || numNfts.loading || numNfts.data > 0 ? ( <>

{nfts.loading || numNfts.loading ? t('title.nfts') : t('title.numNfts', { count: numNfts.data })}

{description && (

{description}

)}
{filterDropdownProps && (

{t('title.filter')}

)}
{nfts.loading || numNfts.loading ? ( {[...Array(pageSize)].map((_, index) => ( ))} ) : ( <> {nfts.data.map((props) => ( ))} )} ) : ( ) }