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
babfebcc
Unverified
Commit
babfebcc
authored
Nov 18, 2022
by
lynn
Committed by
GitHub
Nov 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: view my nfts loading optimization (#5318)
* working * remove commented code
parent
ea02d9e9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
110 deletions
+133
-110
ProfilePage.tsx
src/nft/components/profile/view/ProfilePage.tsx
+116
-93
ProfilePageLoadingSkeleton.tsx
...ft/components/profile/view/ProfilePageLoadingSkeleton.tsx
+16
-12
profile.tsx
src/nft/pages/profile/profile.tsx
+1
-5
No files found.
src/nft/components/profile/view/ProfilePage.tsx
View file @
babfebcc
This diff is collapsed.
Click to expand it.
src/nft/components/profile/view/ProfilePageLoadingSkeleton.tsx
View file @
babfebcc
import
{
Box
}
from
'
nft/components/Box
'
import
{
assetList
}
from
'
nft/components/collection/CollectionNfts.css
'
import
{
assetList
}
from
'
nft/components/collection/CollectionNfts.css
'
import
{
loadingAsset
}
from
'
nft/css/loading.css
'
import
{
ScreenBreakpointsPaddings
}
from
'
nft/pages/collection/index.css
'
import
{
ScreenBreakpointsPaddings
}
from
'
nft/pages/collection/index.css
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
...
@@ -35,7 +37,6 @@ const AccountDetailsSkeletonWrapper = styled(SkeletonRowWrapper)`
...
@@ -35,7 +37,6 @@ const AccountDetailsSkeletonWrapper = styled(SkeletonRowWrapper)`
const
ProfileDetailsSkeleton
=
styled
.
div
`
const
ProfileDetailsSkeleton
=
styled
.
div
`
width: 180px;
width: 180px;
height: 36px;
height: 36px;
background:
${({
theme
})
=>
theme
.
backgroundModule
}
;
border-radius: 12px;
border-radius: 12px;
`
`
...
@@ -46,39 +47,42 @@ const FilterBarSkeletonWrapper = styled(SkeletonRowWrapper)`
...
@@ -46,39 +47,42 @@ const FilterBarSkeletonWrapper = styled(SkeletonRowWrapper)`
const
FilterButtonSkeleton
=
styled
.
div
`
const
FilterButtonSkeleton
=
styled
.
div
`
width: 92px;
width: 92px;
height: 44px;
height: 44px;
background:
${({
theme
})
=>
theme
.
backgroundModule
}
;
border-radius: 12px;
border-radius: 12px;
`
`
const
SellButtonSkeleton
=
styled
.
div
`
const
SellButtonSkeleton
=
styled
.
div
`
width: 80px;
width: 80px;
height: 44px;
height: 44px;
background:
${({
theme
})
=>
theme
.
backgroundModule
}
;
border-radius: 12px;
border-radius: 12px;
`
`
export
const
ProfileAssetCardSkeleton
=
styled
.
div
`
export
const
ProfileAssetCardSkeleton
=
styled
.
div
`
width: 100%;
width: 100%;
height: 330px;
height: 330px;
background:
${({
theme
})
=>
theme
.
backgroundModule
}
;
border-radius: 20px;
border-radius: 20px;
`
`
export
const
ProfileAssetCardDisplaySectionSkeleton
=
()
=>
{
return
(
<
Box
width=
"full"
className=
{
assetList
}
>
{
Array
.
from
(
Array
(
DEFAULT_WALLET_ASSET_QUERY_AMOUNT
),
(
_
,
index
)
=>
(
<
ProfileAssetCardSkeleton
key=
{
index
}
className=
{
loadingAsset
}
/>
))
}
</
Box
>
)
}
export
const
ProfileBodyLoadingSkeleton
=
()
=>
{
export
const
ProfileBodyLoadingSkeleton
=
()
=>
{
return
(
return
(
<
SkeletonBodyWrapper
>
<
SkeletonBodyWrapper
>
<
AccountDetailsSkeletonWrapper
>
<
AccountDetailsSkeletonWrapper
>
<
ProfileDetailsSkeleton
/>
<
ProfileDetailsSkeleton
className=
{
loadingAsset
}
/>
</
AccountDetailsSkeletonWrapper
>
</
AccountDetailsSkeletonWrapper
>
<
FilterBarSkeletonWrapper
>
<
FilterBarSkeletonWrapper
>
<
FilterButtonSkeleton
/>
<
FilterButtonSkeleton
className=
{
loadingAsset
}
/>
<
SellButtonSkeleton
/>
<
SellButtonSkeleton
className=
{
loadingAsset
}
/>
</
FilterBarSkeletonWrapper
>
</
FilterBarSkeletonWrapper
>
<
div
className=
{
assetList
}
>
<
ProfileAssetCardDisplaySectionSkeleton
/>
{
Array
.
from
(
Array
(
DEFAULT_WALLET_ASSET_QUERY_AMOUNT
),
(
_
,
index
)
=>
(
<
ProfileAssetCardSkeleton
key=
{
index
}
/>
))
}
</
div
>
</
SkeletonBodyWrapper
>
</
SkeletonBodyWrapper
>
)
)
}
}
...
...
src/nft/pages/profile/profile.tsx
View file @
babfebcc
import
{
Trace
}
from
'
@uniswap/analytics
'
import
{
Trace
}
from
'
@uniswap/analytics
'
import
{
PageName
}
from
'
@uniswap/analytics-events
'
import
{
PageName
}
from
'
@uniswap/analytics-events
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useLoadNftBalanceQuery
}
from
'
graphql/data/nft/NftBalance
'
import
{
Box
}
from
'
nft/components/Box
'
import
{
Box
}
from
'
nft/components/Box
'
import
{
Center
,
Column
}
from
'
nft/components/Flex
'
import
{
Center
,
Column
}
from
'
nft/components/Flex
'
import
{
ListPage
}
from
'
nft/components/profile/list/ListPage
'
import
{
ListPage
}
from
'
nft/components/profile/list/ListPage
'
...
@@ -50,7 +49,7 @@ const ProfileContent = () => {
...
@@ -50,7 +49,7 @@ const ProfileContent = () => {
{
/* <Head> TODO: figure out metadata tagging
{
/* <Head> TODO: figure out metadata tagging
<title>Genie | Sell</title>
<title>Genie | Sell</title>
</Head> */
}
</Head> */
}
{
account
!=
null
?
(
{
!!
account
?
(
<
Box
style=
{
{
width
:
`calc(100% - ${cartExpanded ? SHOPPING_BAG_WIDTH : 0}px)`
}
}
>
<
Box
style=
{
{
width
:
`calc(100% - ${cartExpanded ? SHOPPING_BAG_WIDTH : 0}px)`
}
}
>
{
sellPageState
===
ProfilePageStateType
.
VIEWING
?
<
ProfilePage
/>
:
<
ListPage
/>
}
{
sellPageState
===
ProfilePageStateType
.
VIEWING
?
<
ProfilePage
/>
:
<
ListPage
/>
}
</
Box
>
</
Box
>
...
@@ -74,9 +73,6 @@ const ProfileContent = () => {
...
@@ -74,9 +73,6 @@ const ProfileContent = () => {
}
}
const
Profile
=
()
=>
{
const
Profile
=
()
=>
{
const
{
account
}
=
useWeb3React
()
useLoadNftBalanceQuery
(
account
,
[])
return
(
return
(
<
Suspense
fallback=
{
<
ProfilePageLoadingSkeleton
/>
}
>
<
Suspense
fallback=
{
<
ProfilePageLoadingSkeleton
/>
}
>
<
ProfileContent
/>
<
ProfileContent
/>
...
...
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