Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
d3885474
Unverified
Commit
d3885474
authored
Nov 16, 2022
by
lynn
Committed by
GitHub
Nov 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: view my nft cards redesign (#5246)
* init * link
parent
10a19638
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
32 deletions
+23
-32
Card.tsx
src/nft/components/collection/Card.tsx
+17
-19
ProfilePage.tsx
src/nft/components/profile/view/ProfilePage.tsx
+1
-2
ViewMyNftsAsset.tsx
src/nft/components/profile/view/ViewMyNftsAsset.tsx
+5
-11
No files found.
src/nft/components/collection/Card.tsx
View file @
d3885474
...
@@ -85,8 +85,11 @@ const useAssetMediaType = (asset: GenieAsset | WalletAsset) =>
...
@@ -85,8 +85,11 @@ const useAssetMediaType = (asset: GenieAsset | WalletAsset) =>
return
assetMediaType
return
assetMediaType
},
[
asset
])
},
[
asset
])
const
baseHref
=
(
asset
:
GenieAsset
|
WalletAsset
)
=>
const
baseHref
=
(
asset
:
GenieAsset
|
WalletAsset
)
=>
{
'
address
'
in
asset
?
`/#/nfts/asset/
${
asset
.
address
}
/
${
asset
.
tokenId
}
?origin=collection`
:
'
/nfts/profile
'
if
(
'
address
'
in
asset
)
return
`/#/nfts/asset/
${
asset
.
address
}
/
${
asset
.
tokenId
}
?origin=collection`
if
(
'
asset_contract
'
in
asset
)
return
`/#/nfts/asset/
${
asset
.
asset_contract
.
address
}
/
${
asset
.
tokenId
}
?origin=profile`
return
'
/#/nfts/profile
'
}
const
DetailsLinkContainer
=
styled
.
a
`
const
DetailsLinkContainer
=
styled
.
a
`
display: flex;
display: flex;
...
@@ -486,29 +489,29 @@ const TruncatedTextRow = styled(Row)`
...
@@ -486,29 +489,29 @@ const TruncatedTextRow = styled(Row)`
interface
ProfileNftDetailsProps
{
interface
ProfileNftDetailsProps
{
asset
:
WalletAsset
asset
:
WalletAsset
isSellMode
:
boolean
hideDetails
:
boolean
}
}
const
ProfileNftDetails
=
({
asset
,
isSellMode
}:
ProfileNftDetailsProps
)
=>
{
const
ProfileNftDetails
=
({
asset
,
hideDetails
}:
ProfileNftDetailsProps
)
=>
{
const
assetName
=
()
=>
{
const
assetName
=
()
=>
{
if
(
!
asset
.
name
&&
!
asset
.
tokenId
)
return
if
(
!
asset
.
name
&&
!
asset
.
tokenId
)
return
return
!!
asset
.
name
?
asset
.
name
:
`#
${
asset
.
tokenId
}
`
return
!!
asset
.
name
?
asset
.
name
:
`#
${
asset
.
tokenId
}
`
}
}
const
shouldShowUserListedPrice
=
const
shouldShowUserListedPrice
=
!!
asset
.
floor_sell_order_price
&&
!!
asset
.
floor_sell_order_price
&&
!
asset
.
notForSale
&&
asset
.
asset_contract
.
tokenType
!==
TokenType
.
ERC1155
!
asset
.
notForSale
&&
(
asset
.
asset_contract
.
tokenType
!==
TokenType
.
ERC1155
||
isSellMode
)
const
shouldShowFloorPrice
=
asset
.
notForSale
&&
isSellMode
&&
!!
asset
.
floorPrice
return
(
return
(
<
Box
overflow=
"hidden"
width=
"full"
flexWrap=
"nowrap"
>
<
Box
overflow=
"hidden"
width=
"full"
flexWrap=
"nowrap"
>
<
Row
justifyItems=
"flex-start"
>
<
PrimaryRow
>
<
PrimaryDetails
>
<
TruncatedTextRow
className=
{
bodySmall
}
style=
{
{
color
:
themeVars
.
colors
.
textSecondary
}
}
>
<
TruncatedTextRow
className=
{
bodySmall
}
style=
{
{
color
:
themeVars
.
colors
.
textSecondary
}
}
>
{
!!
asset
.
asset_contract
.
name
&&
<
span
>
{
asset
.
asset_contract
.
name
}
</
span
>
}
{
!!
asset
.
asset_contract
.
name
&&
<
span
>
{
asset
.
asset_contract
.
name
}
</
span
>
}
</
TruncatedTextRow
>
</
TruncatedTextRow
>
{
asset
.
collectionIsVerified
&&
<
VerifiedIcon
height=
"16px"
width=
"16px"
fill=
{
colors
.
magentaVibrant
}
/>
}
{
asset
.
collectionIsVerified
&&
<
VerifiedIcon
height=
"16px"
width=
"16px"
fill=
{
colors
.
magentaVibrant
}
/>
}
</
Row
>
</
PrimaryDetails
>
{
!
hideDetails
&&
<
DetailsLink
/>
}
</
PrimaryRow
>
<
Row
justifyItems=
"flex-start"
>
<
Row
justifyItems=
"flex-start"
>
<
TruncatedTextRow
<
TruncatedTextRow
className=
{
subheadSmall
}
className=
{
subheadSmall
}
...
@@ -525,11 +528,6 @@ const ProfileNftDetails = ({ asset, isSellMode }: ProfileNftDetailsProps) => {
...
@@ -525,11 +528,6 @@ const ProfileNftDetails = ({ asset, isSellMode }: ProfileNftDetailsProps) => {
{
`${floorFormatter(asset.floor_sell_order_price)} ETH`
}
{
`${floorFormatter(asset.floor_sell_order_price)} ETH`
}
</
TruncatedTextRow
>
</
TruncatedTextRow
>
)
}
)
}
{
shouldShowFloorPrice
&&
(
<
TruncatedTextRow
className=
{
subhead
}
style=
{
{
color
:
themeVars
.
colors
.
textSecondary
}
}
>
{
`${floorFormatter(asset.floorPrice)} ETH Floor`
}
</
TruncatedTextRow
>
)
}
</
Box
>
</
Box
>
)
)
}
}
...
...
src/nft/components/profile/view/ProfilePage.tsx
View file @
d3885474
...
@@ -51,7 +51,6 @@ export const ProfilePage = () => {
...
@@ -51,7 +51,6 @@ export const ProfilePage = () => {
shallow
shallow
)
)
const
sellAssets
=
useSellAsset
((
state
)
=>
state
.
sellAssets
)
const
sellAssets
=
useSellAsset
((
state
)
=>
state
.
sellAssets
)
const
setSellPageState
=
useProfilePageState
((
state
)
=>
state
.
setProfilePageState
)
const
setSellPageState
=
useProfilePageState
((
state
)
=>
state
.
setProfilePageState
)
const
[
isFiltersExpanded
,
setFiltersExpanded
]
=
useFiltersExpanded
()
const
[
isFiltersExpanded
,
setFiltersExpanded
]
=
useFiltersExpanded
()
const
isMobile
=
useIsMobile
()
const
isMobile
=
useIsMobile
()
...
@@ -131,10 +130,10 @@ export const ProfilePage = () => {
...
@@ -131,10 +130,10 @@ export const ProfilePage = () => {
?
ownerAssets
.
map
((
asset
,
index
)
=>
(
?
ownerAssets
.
map
((
asset
,
index
)
=>
(
<
div
key=
{
index
}
>
<
div
key=
{
index
}
>
<
ViewMyNftsAsset
<
ViewMyNftsAsset
isSellMode
asset=
{
asset
}
asset=
{
asset
}
mediaShouldBePlaying=
{
asset
.
tokenId
===
currentTokenPlayingMedia
}
mediaShouldBePlaying=
{
asset
.
tokenId
===
currentTokenPlayingMedia
}
setCurrentTokenPlayingMedia=
{
setCurrentTokenPlayingMedia
}
setCurrentTokenPlayingMedia=
{
setCurrentTokenPlayingMedia
}
hideDetails=
{
sellAssets
.
length
>
0
}
/>
/>
</
div
>
</
div
>
))
))
...
...
src/nft/components/profile/view/ViewMyNftsAsset.tsx
View file @
d3885474
...
@@ -8,15 +8,12 @@ import { themeVars } from 'nft/css/sprinkles.css'
...
@@ -8,15 +8,12 @@ import { themeVars } from 'nft/css/sprinkles.css'
import
{
useBag
,
useIsMobile
,
useSellAsset
}
from
'
nft/hooks
'
import
{
useBag
,
useIsMobile
,
useSellAsset
}
from
'
nft/hooks
'
import
{
TokenType
,
WalletAsset
}
from
'
nft/types
'
import
{
TokenType
,
WalletAsset
}
from
'
nft/types
'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
useNavigate
}
from
'
react-router-dom
'
const
NFT_DETAILS_HREF
=
(
asset
:
WalletAsset
)
=>
`/nfts/asset/
${
asset
.
asset_contract
.
address
}
/
${
asset
.
tokenId
}
?origin=profile`
interface
ViewMyNftsAssetProps
{
interface
ViewMyNftsAssetProps
{
asset
:
WalletAsset
asset
:
WalletAsset
isSellMode
:
boolean
mediaShouldBePlaying
:
boolean
mediaShouldBePlaying
:
boolean
setCurrentTokenPlayingMedia
:
(
tokenId
:
string
|
undefined
)
=>
void
setCurrentTokenPlayingMedia
:
(
tokenId
:
string
|
undefined
)
=>
void
hideDetails
:
boolean
}
}
const
getNftDisplayComponent
=
(
const
getNftDisplayComponent
=
(
...
@@ -36,9 +33,9 @@ const getNftDisplayComponent = (
...
@@ -36,9 +33,9 @@ const getNftDisplayComponent = (
export
const
ViewMyNftsAsset
=
({
export
const
ViewMyNftsAsset
=
({
asset
,
asset
,
isSellMode
,
mediaShouldBePlaying
,
mediaShouldBePlaying
,
setCurrentTokenPlayingMedia
,
setCurrentTokenPlayingMedia
,
hideDetails
,
}:
ViewMyNftsAssetProps
)
=>
{
}:
ViewMyNftsAssetProps
)
=>
{
const
sellAssets
=
useSellAsset
((
state
)
=>
state
.
sellAssets
)
const
sellAssets
=
useSellAsset
((
state
)
=>
state
.
sellAssets
)
const
selectSellAsset
=
useSellAsset
((
state
)
=>
state
.
selectSellAsset
)
const
selectSellAsset
=
useSellAsset
((
state
)
=>
state
.
selectSellAsset
)
...
@@ -46,7 +43,6 @@ export const ViewMyNftsAsset = ({
...
@@ -46,7 +43,6 @@ export const ViewMyNftsAsset = ({
const
cartExpanded
=
useBag
((
state
)
=>
state
.
bagExpanded
)
const
cartExpanded
=
useBag
((
state
)
=>
state
.
bagExpanded
)
const
toggleCart
=
useBag
((
state
)
=>
state
.
toggleBag
)
const
toggleCart
=
useBag
((
state
)
=>
state
.
toggleBag
)
const
isMobile
=
useIsMobile
()
const
isMobile
=
useIsMobile
()
const
navigate
=
useNavigate
()
const
isSelected
=
useMemo
(()
=>
{
const
isSelected
=
useMemo
(()
=>
{
return
sellAssets
.
some
(
return
sellAssets
.
some
(
...
@@ -54,9 +50,7 @@ export const ViewMyNftsAsset = ({
...
@@ -54,9 +50,7 @@ export const ViewMyNftsAsset = ({
)
)
},
[
asset
,
sellAssets
])
},
[
asset
,
sellAssets
])
const
onCardClick
=
()
=>
{
const
onCardClick
=
()
=>
handleSelect
(
isSelected
)
isSellMode
?
handleSelect
(
isSelected
)
:
navigate
(
NFT_DETAILS_HREF
(
asset
))
}
const
handleSelect
=
(
removeAsset
:
boolean
)
=>
{
const
handleSelect
=
(
removeAsset
:
boolean
)
=>
{
removeAsset
?
removeSellAsset
(
asset
)
:
selectSellAsset
(
asset
)
removeAsset
?
removeSellAsset
(
asset
)
:
selectSellAsset
(
asset
)
...
@@ -72,7 +66,7 @@ export const ViewMyNftsAsset = ({
...
@@ -72,7 +66,7 @@ export const ViewMyNftsAsset = ({
const
assetMediaType
=
Card
.
useAssetMediaType
(
asset
)
const
assetMediaType
=
Card
.
useAssetMediaType
(
asset
)
const
isDisabled
=
isSellMode
&&
(
asset
.
asset_contract
.
tokenType
===
TokenType
.
ERC1155
||
asset
.
susFlag
)
const
isDisabled
=
asset
.
asset_contract
.
tokenType
===
TokenType
.
ERC1155
||
asset
.
susFlag
const
disabledTooltipText
=
const
disabledTooltipText
=
asset
.
asset_contract
.
tokenType
===
TokenType
.
ERC1155
?
'
ERC-1155 support coming soon
'
:
'
Blocked from trading
'
asset
.
asset_contract
.
tokenType
===
TokenType
.
ERC1155
?
'
ERC-1155 support coming soon
'
:
'
Blocked from trading
'
...
@@ -101,7 +95,7 @@ export const ViewMyNftsAsset = ({
...
@@ -101,7 +95,7 @@ export const ViewMyNftsAsset = ({
{
getNftDisplayComponent
(
assetMediaType
,
mediaShouldBePlaying
,
setCurrentTokenPlayingMedia
)
}
{
getNftDisplayComponent
(
assetMediaType
,
mediaShouldBePlaying
,
setCurrentTokenPlayingMedia
)
}
</
Card
.
ImageContainer
>
</
Card
.
ImageContainer
>
<
Card
.
DetailsContainer
>
<
Card
.
DetailsContainer
>
<
Card
.
ProfileNftDetails
asset=
{
asset
}
isSellMode=
{
isSellMode
}
/>
<
Card
.
ProfileNftDetails
asset=
{
asset
}
hideDetails=
{
hideDetails
}
/>
</
Card
.
DetailsContainer
>
</
Card
.
DetailsContainer
>
</
Card
.
Container
>
</
Card
.
Container
>
</
MouseoverTooltip
>
</
MouseoverTooltip
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment