Skip to content

Commit 8c545f0

Browse files
committed
wip
1 parent fef5211 commit 8c545f0

File tree

3 files changed

+63
-46
lines changed

3 files changed

+63
-46
lines changed

apps/enterprise/src/pages/dao/NFTCard.tsx

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,56 @@ interface NFTCardProps {
1111
}
1212

1313
export const NFTCard = (props: NFTCardProps) => {
14-
const { nftCollectionAdress, tokenIds } = props;
15-
const nftData = useNFTInfoQuery(nftCollectionAdress, tokenIds);
16-
const nftObject = nftData.data as any;
17-
return (
18-
<>
19-
{nftData.data &&
20-
tokenIds.map((index) => {
21-
if (nftObject[index].data) {
22-
const nftCollectionInfo = nftObject[index]['data']['tokensPage']['collection']['collectionInfo'];
23-
const nft = nftObject[index]['data']['tokensPage']['token'];
24-
return (
25-
<Container className={styles.card}>
26-
<img src={nft.imageUrlFileserver} width={156} className={styles.nftPreview} alt="NFT Preview" />
27-
<Container direction="column" className={styles.nftInfo} gap={16}>
28-
<Text className={styles.name} variant="label">
29-
{nft.name}
30-
</Text>
31-
{nft.price ? (
32-
<Text className={styles.price} variant="label">
33-
{nft.denom}
34-
{formatAmount(demicrofy(nft.price, 6))}{' '}
35-
</Text>
36-
) : (
37-
<Text className={styles.price} variant="label">
38-
{nftCollectionInfo.floor_price && formatAmount(demicrofy(nftCollectionInfo.floor_price, 6))}{' '}
39-
</Text>
40-
)}
41-
</Container>
42-
</Container>
43-
);
44-
} else {
45-
return (
46-
<Container className={styles.card}>
47-
<img src={nftObject[index].image_data} width={156} className={styles.nftPreview} alt="NFT Preview" />
48-
<Container direction="column" className={styles.nftInfo} gap={16}>
49-
<Text className={styles.name} variant="label">
50-
{nftObject[index].name}
51-
</Text>
52-
</Container>
53-
</Container>
54-
);
55-
}
56-
})}
57-
</>
58-
);
14+
const { nftCollectionAdress, tokenIds } = props;
15+
const nftData = useNFTInfoQuery(nftCollectionAdress, tokenIds);
16+
const nftObject = nftData.data as any;
17+
return (
18+
<>
19+
{nftData.data && (
20+
tokenIds.map((index) => {
21+
if (nftObject[index].data) {
22+
const nftCollectionInfo = nftObject[index]["data"]["tokensPage"]["collection"]["collectionInfo"]
23+
const nft = nftObject[index]['data']['tokensPage']['token'];
24+
25+
26+
return (
27+
<Container className={styles.card}>
28+
<img src={nft.imageUrlFileserver} width={156} className={styles.nftPreview} alt="NFT Preview" />
29+
<Container direction="column" className={styles.nftInfo} gap={16}>
30+
<Text className={styles.name} variant="label">
31+
{nft.name}
32+
</Text>
33+
{nft.price ? (
34+
<Text className={styles.price} variant="label">
35+
{nft.denom}
36+
{formatAmount(demicrofy(nft.price, 6))}{' '}
37+
</Text>
38+
) : (
39+
<Text className={styles.price} variant="label">
40+
{nftCollectionInfo.floor_price && formatAmount(demicrofy(nftCollectionInfo.floor_price, 6))}{' '}
41+
</Text>
42+
)}
43+
</Container>
44+
</Container>
45+
);
46+
} else {
47+
return (
48+
<Container className={styles.card}>
49+
<img src={nftObject[index].image} width={156} className={styles.nftPreview} alt="NFT Preview" />
50+
<Container direction="column" className={styles.nftInfo} gap={16}>
51+
<Text className={styles.name} variant="label">
52+
{nftObject[index].name}
53+
</Text>
54+
<Text className={styles.price} variant="label">
55+
</Text>
56+
</Container>
57+
</Container>
58+
)
59+
}
60+
})
61+
)}
62+
63+
64+
</>
65+
);
5966
};

apps/enterprise/src/pages/dao/TreasuryOverview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const TreasuryOverview = () => {
1818

1919
const { data: whitelist = [] } = useDAONFTsWhitelist(address);
2020
const { data: stakedNfts = [] } = useStakedNfts(address);
21+
2122
let nftCollection: NFTPairs[] | undefined = [];
2223
const { data } = useNFTsOwnersQuery(whitelist as CW20Addr[], dao.address);
2324
if (dao.dao_type !== 'nft') {

apps/enterprise/src/pages/dao/viewMoreNft/ViewMoreNftOverlay.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ export const ViewMoreNftOverlay = ({ onClose }: ClosableComponentProps) => {
2121

2222
const { data } = useNFTsOwnersQuery(whitelist as CW20Addr[], dao.address);
2323
const nftCollection: NFTPairs[] | undefined = data;
24+
25+
const nftCount = () => {
26+
let count = 0;
27+
nftCollection?.forEach((nftPair) => {
28+
count += nftPair.tokenIds?.tokens?.length || 0;
29+
});
30+
return count;
31+
}
32+
2433
return (
2534
<Modal
2635
width={970}
@@ -31,7 +40,7 @@ export const ViewMoreNftOverlay = ({ onClose }: ClosableComponentProps) => {
3140
return (
3241
<VStack className={styles.modalContent} gap={32}>
3342
<Container className={styles.subheader} gap={32}>
34-
<Text variant='label'> Displaying {nftCollection?.length} NFTs in treasury</Text>
43+
<Text variant='label'> Displaying {nftCount()} NFTs in treasury</Text>
3544
</Container>
3645
<Container className={styles.scrollableContainer}>
3746
{nftCollection?.length && nftCollection[0]?.tokenIds.length !== 0 ? (

0 commit comments

Comments
 (0)