Changeset View
Changeset View
Standalone View
Standalone View
cashtab/src/components/Nfts/index.tsx
| // Copyright (c) 2024 The Bitcoin developers | // Copyright (c) 2024 The Bitcoin developers | ||||
| // Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
| import React, { useState, useEffect, useContext } from 'react'; | import React, { useState, useEffect, useContext } from 'react'; | ||||
| import { WalletContext, isWalletContextLoaded } from 'wallet/context'; | import { WalletContext, isWalletContextLoaded } from 'wallet/context'; | ||||
| import { SwitchLabel, Alert, PageHeader } from 'components/Common/Atoms'; | import { SwitchLabel, Alert } from 'components/Common/Atoms'; | ||||
| import Spinner from 'components/Common/Spinner'; | import Spinner from 'components/Common/Spinner'; | ||||
| import { AgoraOffer } from 'ecash-agora'; | import { AgoraOffer } from 'ecash-agora'; | ||||
| import { toHex } from 'ecash-lib'; | import { toHex } from 'ecash-lib'; | ||||
| import { NftsCtn, SubHeader, NftListCtn } from './styled'; | import { NftsCtn, SubHeader, NftListCtn } from './styled'; | ||||
| import { SwitchHolder, NftOfferWrapper } from 'components/Etokens/Token/styled'; | import { SwitchHolder, NftOfferWrapper } from 'components/Etokens/Token/styled'; | ||||
| import { getUserLocale } from 'helpers'; | import { getUserLocale } from 'helpers'; | ||||
| import Switch from 'components/Common/Switch'; | import Switch from 'components/Common/Switch'; | ||||
| import Collection, { | import Collection, { | ||||
| OneshotSwiper, | OneshotSwiper, | ||||
| OneshotOffer, | OneshotOffer, | ||||
| } from 'components/Agora/Collection'; | } from 'components/Agora/Collection'; | ||||
| import { NftIcon } from 'components/Common/CustomIcons'; | import ActionButtonRow from 'components/Common/ActionButtonRow'; | ||||
| const Nfts: React.FC = () => { | const Nfts: React.FC = () => { | ||||
| const ContextValue = useContext(WalletContext); | const ContextValue = useContext(WalletContext); | ||||
| if (!isWalletContextLoaded(ContextValue)) { | if (!isWalletContextLoaded(ContextValue)) { | ||||
| // Confirm we have all context required to load the page | // Confirm we have all context required to load the page | ||||
| return null; | return null; | ||||
| } | } | ||||
| const { fiatPrice, chronik, agora, cashtabState, ecashWallet } = | const { fiatPrice, chronik, agora, cashtabState, ecashWallet } = | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | const Nfts: React.FC = () => { | ||||
| }, []); | }, []); | ||||
| useEffect(() => { | useEffect(() => { | ||||
| getMyNfts(); | getMyNfts(); | ||||
| }, [ecashWallet.address]); | }, [ecashWallet.address]); | ||||
| return ( | return ( | ||||
| <NftsCtn> | <NftsCtn> | ||||
| <PageHeader> | <ActionButtonRow variant="agora" activeIndex={1} /> | ||||
| Listed NFTs <NftIcon /> | |||||
| </PageHeader> | |||||
| {offeredCollections === null && chronikQueryError === null && ( | {offeredCollections === null && chronikQueryError === null && ( | ||||
| <Spinner /> | <Spinner /> | ||||
| )} | )} | ||||
| {chronikQueryError && ( | {chronikQueryError && ( | ||||
| <Alert> | <Alert> | ||||
| Error querying listed NFTs. Please try again later. | Error querying listed NFTs. Please try again later. | ||||
| </Alert> | </Alert> | ||||
| )} | )} | ||||
| ▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines | |||||