-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1066 from oasisprotocol/mz/instanceTokenTransfer
NFT instance token transfers tab
- Loading branch information
Showing
8 changed files
with
130 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add NFT instance token transfers tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/app/pages/NFTInstanceDashboardPage/NFTTokenTransfersCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { FC } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import Card from '@mui/material/Card' | ||
import CardHeader from '@mui/material/CardHeader' | ||
import CardContent from '@mui/material/CardContent' | ||
import { NUMBER_OF_ITEMS_ON_SEPARATE_PAGE } from '../../config' | ||
import { ErrorBoundary } from '../../components/ErrorBoundary' | ||
import { TokenTransfers } from '../../components/Tokens/TokenTransfers' | ||
import { LinkableDiv } from '../../components/PageLayout/LinkableDiv' | ||
import { NftDashboardContext } from './' | ||
import { CardEmptyState } from '../AccountDetailsPage/CardEmptyState' | ||
import { useNFTInstanceTransfers } from '../TokenDashboardPage/hook' | ||
|
||
export const nftTokenTransfersContainerId = 'nftTokenTransfers' | ||
|
||
export const NFTTokenTransfersCard: FC<NftDashboardContext> = props => { | ||
const { t } = useTranslation() | ||
|
||
return ( | ||
<Card> | ||
<LinkableDiv id={nftTokenTransfersContainerId}> | ||
<CardHeader disableTypography component="h3" title={t('tokens.transfers')} /> | ||
</LinkableDiv> | ||
<CardContent> | ||
<ErrorBoundary light={true}> | ||
<NFTTokenTransfersView {...props} /> | ||
</ErrorBoundary> | ||
</CardContent> | ||
</Card> | ||
) | ||
} | ||
|
||
const NFTTokenTransfersView: FC<NftDashboardContext> = ({ scope, address, instanceId }) => { | ||
const { t } = useTranslation() | ||
const { isLoading, isFetched, results } = useNFTInstanceTransfers(scope, { | ||
contract_address: address, | ||
nft_id: instanceId, | ||
}) | ||
const transfers = results.data | ||
|
||
return ( | ||
<> | ||
{isFetched && !transfers?.length && <CardEmptyState label={t('account.emptyTokenTransferList')} />} | ||
<TokenTransfers | ||
transfers={transfers} | ||
isLoading={isLoading} | ||
limit={NUMBER_OF_ITEMS_ON_SEPARATE_PAGE} | ||
pagination={results.tablePaginationProps} | ||
/> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters