-
Notifications
You must be signed in to change notification settings - Fork 684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/cards redesign #1593
Feat/cards redesign #1593
Changes from 1 commit
52268d6
7ed4504
51bca45
80e97dd
123b12b
c2dfa6d
1a99031
61b1dac
7db98a0
42ae187
bbc8ea6
9b082fd
35046b7
d777dff
b55805c
a102c77
b31d2b4
f44a5b2
0bfcf79
05ed1a9
0aed591
cc8955c
079d907
d2312d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { Item } from '@dcl/schemas' | ||
import { NFT } from '../../../modules/nft/types' | ||
import { Asset } from '../../../modules/asset/types' | ||
|
||
export type Props = { | ||
asset: NFT | Item | ||
asset: Asset | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
import React, { useCallback } from 'react' | ||
import React, { useCallback, useMemo } from 'react' | ||
import { Card, Button, Loader } from 'decentraland-ui' | ||
import { t } from 'decentraland-dapps/dist/modules/translation/utils' | ||
import { getAnalytics } from 'decentraland-dapps/dist/modules/analytics/utils' | ||
import { getMaxQuerySize, MAX_PAGE, PAGE_SIZE } from '../../modules/vendor/api' | ||
// import { AssetCard } from '../AssetCard' | ||
import { AssetCard } from '../AssetCard' | ||
import { Props } from './AssetList.types' | ||
import './AssetList.css' | ||
import { getCategoryFromSection } from '../../modules/routing/search' | ||
import { NFTCategory } from '@dcl/schemas' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please move this import above 🙏 |
||
|
||
const AssetList = (props: Props) => { | ||
const { | ||
vendor, | ||
// section, | ||
// assetType, | ||
section, | ||
assetType, | ||
// items, | ||
// nfts, | ||
page, | ||
count, | ||
// search, | ||
search, | ||
isLoading, | ||
// hasFiltersEnabled, | ||
onBrowse, | ||
urlNext, | ||
// isManager, | ||
isManager, | ||
// onClearFilters, | ||
catalogItems | ||
} = props | ||
|
@@ -47,27 +49,32 @@ const AssetList = (props: Props) => { | |
|
||
const isLoadingNewPage = isLoading && catalogItems.length >= PAGE_SIZE | ||
|
||
// const emptyStateTranslationString = useMemo(() => { | ||
// if (catalogItems.length > 0) { | ||
// return '' | ||
// } else if (section) { | ||
// if (isManager) { | ||
// return 'nft_list.simple_empty' | ||
// } | ||
const emptyStateTranslationString = useMemo(() => { | ||
if (catalogItems.length > 0) { | ||
return '' | ||
} else if (section) { | ||
if (isManager) { | ||
return 'nft_list.simple_empty' | ||
} | ||
|
||
// const isEmoteOrWearableSection = [ | ||
// NFTCategory.EMOTE, | ||
// NFTCategory.WEARABLE | ||
// ].includes(getCategoryFromSection(section)!) | ||
const isEmoteOrWearableSection = [ | ||
NFTCategory.EMOTE, | ||
NFTCategory.WEARABLE | ||
].includes(getCategoryFromSection(section)!) | ||
|
||
// if (isEmoteOrWearableSection) { | ||
// return search ? 'nft_list.empty_search' : 'nft_list.empty' | ||
// } | ||
// } | ||
// return 'nft_list.simple_empty' | ||
// }, [catalogItems.length, search, section, isManager]) | ||
if (isEmoteOrWearableSection) { | ||
return search ? 'nft_list.empty_search' : 'nft_list.empty' | ||
} | ||
} | ||
return 'nft_list.simple_empty' | ||
}, [catalogItems.length, search, section, isManager]) | ||
|
||
// console.log('flo a veeer', catalogItems.length, catalogItems) | ||
console.log( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👀 |
||
'flo a veeer', | ||
catalogItems.length, | ||
catalogItems, | ||
emptyStateTranslationString | ||
) | ||
|
||
return ( | ||
<> | ||
|
@@ -80,23 +87,25 @@ const AssetList = (props: Props) => { | |
<Card.Group> | ||
{catalogItems.length > 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we don't need this check, we can just call the |
||
? catalogItems.map((catalogItem, index) => ( | ||
// <AssetCard | ||
// isManager={isManager} | ||
// key={assetType + '-' + catalogItems.id + '-' + index} | ||
// asset={catalogItems} | ||
// /> | ||
<div | ||
key={index} | ||
style={{ backgroundColor: 'yellow', color: 'black' }} | ||
> | ||
Card chanchullo :) | ||
<br></br> | ||
{catalogItem.name} | ||
<br></br> | ||
{catalogItem.price} | ||
<br></br> | ||
{catalogItem.rarity} | ||
</div> | ||
<> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this fragment is not needed |
||
<AssetCard | ||
isManager={isManager} | ||
key={assetType + '-' + catalogItem.id + '-' + index} | ||
asset={catalogItem} | ||
/> | ||
{/* <div | ||
key={index} | ||
style={{ backgroundColor: 'yellow', color: 'black' }} | ||
> | ||
Card chanchullo :) | ||
<br></br> | ||
{catalogItem.name} | ||
<br></br> | ||
{catalogItem.price} | ||
<br></br> | ||
{catalogItem.rarity} | ||
</div> */} | ||
</> | ||
)) | ||
: null} | ||
</Card.Group> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { Item } from '@dcl/schemas' | ||
import { Wallet } from 'decentraland-dapps/dist/modules/wallet/types' | ||
import { CatalogItem } from '../../../../modules/catalog/types' | ||
|
||
export type Props = { | ||
item: Item | ||
item: Item | CatalogItem | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this change? |
||
wallet: Wallet | null | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ const AssetCell = ({ asset, link: linkProp }: Props) => { | |
? linkProp | ||
: 'tokenId' in asset | ||
? locations.nft(asset.contractAddress, asset.tokenId) | ||
: locations.item(asset.contractAddress, asset.itemId!) | ||
: locations.item(asset.contractAddress, asset.id!) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this correct? |
||
|
||
return ( | ||
<Link to={link}> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import { Item } from '@dcl/schemas' | ||
import { CatalogItem } from '../catalog/types' | ||
import { NFT } from '../nft/types' | ||
|
||
export enum AssetType { | ||
ITEM = 'item', | ||
NFT = 'nft' | ||
NFT = 'nft', | ||
CATALOG_ITEM = 'catalog_item' | ||
} | ||
|
||
export type Asset<T extends AssetType = AssetType> = T extends AssetType.NFT | ||
? NFT | ||
: T extends AssetType.ITEM | ||
? Item | ||
: T extends AssetType.CATALOG_ITEM | ||
? CatalogItem | ||
: NFT | Item |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ function* handleOpenTransak(action: OpenTransakAction) { | |
appCluster: config.get('TRANSAK_PUSHER_APP_CLUSTER') | ||
} | ||
} | ||
const tokenId = isNFT(asset) ? asset.tokenId : asset.itemId | ||
const tokenId = isNFT(asset) ? asset.tokenId : asset.id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to revert this change now that we have |
||
const customizationOptions = { | ||
contractAddress: asset.contractAddress, | ||
tradeType: isNFT(asset) ? TradeType.SECONDARY : TradeType.PRIMARY, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this please? 🙏