Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaCehic95 committed Jun 7, 2023
1 parent fef5211 commit 8c545f0
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 46 deletions.
97 changes: 52 additions & 45 deletions apps/enterprise/src/pages/dao/NFTCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,56 @@ interface NFTCardProps {
}

export const NFTCard = (props: NFTCardProps) => {
const { nftCollectionAdress, tokenIds } = props;
const nftData = useNFTInfoQuery(nftCollectionAdress, tokenIds);
const nftObject = nftData.data as any;
return (
<>
{nftData.data &&
tokenIds.map((index) => {
if (nftObject[index].data) {
const nftCollectionInfo = nftObject[index]['data']['tokensPage']['collection']['collectionInfo'];
const nft = nftObject[index]['data']['tokensPage']['token'];
return (
<Container className={styles.card}>
<img src={nft.imageUrlFileserver} width={156} className={styles.nftPreview} alt="NFT Preview" />
<Container direction="column" className={styles.nftInfo} gap={16}>
<Text className={styles.name} variant="label">
{nft.name}
</Text>
{nft.price ? (
<Text className={styles.price} variant="label">
{nft.denom}
{formatAmount(demicrofy(nft.price, 6))}{' '}
</Text>
) : (
<Text className={styles.price} variant="label">
{nftCollectionInfo.floor_price && formatAmount(demicrofy(nftCollectionInfo.floor_price, 6))}{' '}
</Text>
)}
</Container>
</Container>
);
} else {
return (
<Container className={styles.card}>
<img src={nftObject[index].image_data} width={156} className={styles.nftPreview} alt="NFT Preview" />
<Container direction="column" className={styles.nftInfo} gap={16}>
<Text className={styles.name} variant="label">
{nftObject[index].name}
</Text>
</Container>
</Container>
);
}
})}
</>
);
const { nftCollectionAdress, tokenIds } = props;
const nftData = useNFTInfoQuery(nftCollectionAdress, tokenIds);
const nftObject = nftData.data as any;
return (
<>
{nftData.data && (
tokenIds.map((index) => {
if (nftObject[index].data) {
const nftCollectionInfo = nftObject[index]["data"]["tokensPage"]["collection"]["collectionInfo"]
const nft = nftObject[index]['data']['tokensPage']['token'];


return (
<Container className={styles.card}>
<img src={nft.imageUrlFileserver} width={156} className={styles.nftPreview} alt="NFT Preview" />
<Container direction="column" className={styles.nftInfo} gap={16}>
<Text className={styles.name} variant="label">
{nft.name}
</Text>
{nft.price ? (
<Text className={styles.price} variant="label">
{nft.denom}
{formatAmount(demicrofy(nft.price, 6))}{' '}
</Text>
) : (
<Text className={styles.price} variant="label">
{nftCollectionInfo.floor_price && formatAmount(demicrofy(nftCollectionInfo.floor_price, 6))}{' '}
</Text>
)}
</Container>
</Container>
);
} else {
return (
<Container className={styles.card}>
<img src={nftObject[index].image} width={156} className={styles.nftPreview} alt="NFT Preview" />
<Container direction="column" className={styles.nftInfo} gap={16}>
<Text className={styles.name} variant="label">
{nftObject[index].name}
</Text>
<Text className={styles.price} variant="label">
</Text>
</Container>
</Container>
)
}
})
)}


</>
);
};
1 change: 1 addition & 0 deletions apps/enterprise/src/pages/dao/TreasuryOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const TreasuryOverview = () => {

const { data: whitelist = [] } = useDAONFTsWhitelist(address);
const { data: stakedNfts = [] } = useStakedNfts(address);

let nftCollection: NFTPairs[] | undefined = [];
const { data } = useNFTsOwnersQuery(whitelist as CW20Addr[], dao.address);
if (dao.dao_type !== 'nft') {
Expand Down
11 changes: 10 additions & 1 deletion apps/enterprise/src/pages/dao/viewMoreNft/ViewMoreNftOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ export const ViewMoreNftOverlay = ({ onClose }: ClosableComponentProps) => {

const { data } = useNFTsOwnersQuery(whitelist as CW20Addr[], dao.address);
const nftCollection: NFTPairs[] | undefined = data;

const nftCount = () => {
let count = 0;
nftCollection?.forEach((nftPair) => {
count += nftPair.tokenIds?.tokens?.length || 0;
});
return count;
}

return (
<Modal
width={970}
Expand All @@ -31,7 +40,7 @@ export const ViewMoreNftOverlay = ({ onClose }: ClosableComponentProps) => {
return (
<VStack className={styles.modalContent} gap={32}>
<Container className={styles.subheader} gap={32}>
<Text variant='label'> Displaying {nftCollection?.length} NFTs in treasury</Text>
<Text variant='label'> Displaying {nftCount()} NFTs in treasury</Text>
</Container>
<Container className={styles.scrollableContainer}>
{nftCollection?.length && nftCollection[0]?.tokenIds.length !== 0 ? (
Expand Down

0 comments on commit 8c545f0

Please sign in to comment.