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
a27f8e29
Unverified
Commit
a27f8e29
authored
Aug 18, 2022
by
Kaylee George
Committed by
GitHub
Aug 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add no information available state for token details (#4407)
* skeleton * fix * fix layout * gap
parent
818b1c84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
3 deletions
+93
-3
LoadingTokenDetail.tsx
src/components/Tokens/TokenDetails/LoadingTokenDetail.tsx
+1
-1
TokenDetail.tsx
src/components/Tokens/TokenDetails/TokenDetail.tsx
+92
-2
No files found.
src/components/Tokens/TokenDetails/LoadingTokenDetail.tsx
View file @
a27f8e29
...
...
@@ -76,7 +76,7 @@ const Space = styled.div<{ heightSize: number }>`
height:
${({
heightSize
})
=>
`
${
heightSize
}
px`
}
;
`
function
Wave
()
{
export
function
Wave
()
{
const
theme
=
useTheme
()
return
(
<
svg
width=
"416"
height=
"160"
xmlns=
"http://www.w3.org/2000/svg"
>
...
...
src/components/Tokens/TokenDetails/TokenDetail.tsx
View file @
a27f8e29
...
...
@@ -10,13 +10,14 @@ import { useCurrency, useIsUserAddedToken, useToken } from 'hooks/Tokens'
import
{
useAtomValue
}
from
'
jotai/utils
'
import
{
useCallback
}
from
'
react
'
import
{
useState
}
from
'
react
'
import
{
ArrowLeft
,
Heart
}
from
'
react-feather
'
import
{
ArrowLeft
,
Heart
,
TrendingUp
}
from
'
react-feather
'
import
{
Link
,
useNavigate
}
from
'
react-router-dom
'
import
styled
from
'
styled-components/macro
'
import
{
ClickableStyle
,
CopyContractAddress
}
from
'
theme
'
import
{
favoritesAtom
,
useToggleFavorite
}
from
'
../state
'
import
{
ClickFavorited
}
from
'
../TokenTable/TokenRow
'
import
{
Wave
}
from
'
./LoadingTokenDetail
'
import
Resource
from
'
./Resource
'
import
ShareButton
from
'
./ShareButton
'
...
...
@@ -94,6 +95,7 @@ const StatPrice = styled.span`
export
const
StatsSection
=
styled
.
div
`
display: flex;
flex-wrap: wrap;
align-items: center;
`
export
const
StatPair
=
styled
.
div
`
display: flex;
...
...
@@ -143,6 +145,32 @@ const FavoriteIcon = styled(Heart)<{ isFavorited: boolean }>`
color
:
$
{({
isFavorited
,
theme
})
=>
(
isFavorited
?
theme
.
accentAction
:
theme
.
textSecondary
)};
fill
:
$
{({
isFavorited
,
theme
})
=>
(
isFavorited
?
theme
.
accentAction
:
'
transparent
'
)};
`
const ChartEmpty = styled.div`
display
:
flex
;
height
:
400
px
;
align
-
items
:
center
;
`
const NoInfoAvailable = styled.span`
color
:
$
{({
theme
})
=>
theme
.
textTertiary
}
;
font-weight: 400;
font-size: 16px;
`
const
MissingChartData
=
styled
.
div
`
color:
${({
theme
})
=>
theme
.
textTertiary
}
;
display: flex;
font-weight: 400;
font-size: 12px;
gap: 4px;
align-items: center;
border-bottom: 1px solid
${({
theme
})
=>
theme
.
backgroundOutline
}
;
padding: 8px 0px;
margin-top: -40px;
`
const
MissingData
=
styled
.
div
`
display: flex;
flex-direction: column;
gap: 20px;
`
export
default
function
LoadedTokenDetail
({
address
}:
{
address
:
string
})
{
const
token
=
useToken
(
address
)
...
...
@@ -164,7 +192,69 @@ export default function LoadedTokenDetail({ address }: { address: string }) {
// catch token error and loading state
if
(
!
token
||
!
token
.
name
||
!
token
.
symbol
)
{
return <div>No Token</div>
return
(
<
TopArea
>
<
BreadcrumbNavLink
to=
"/explore"
>
<
ArrowLeft
size=
{
14
}
/>
Explore
</
BreadcrumbNavLink
>
<
ChartHeader
>
<
TokenInfoContainer
>
<
TokenNameCell
>
<
CurrencyLogo
currency=
{
currency
}
size=
{
'
32px
'
}
/>
<
Trans
>
{
!
token
?
'
Name not found
'
:
token
.
name
}
</
Trans
>
<
TokenSymbol
>
{
token
&&
token
.
symbol
}
</
TokenSymbol
>
{
!
warning
&&
<
VerifiedIcon
size=
"20px"
/>
}
{
networkBadgebackgroundColor
&&
(
<
NetworkBadge
networkColor=
{
chainInfo
?.
color
}
backgroundColor=
{
networkBadgebackgroundColor
}
>
{
networkLabel
}
</
NetworkBadge
>
)
}
</
TokenNameCell
>
</
TokenInfoContainer
>
<
ChartEmpty
>
<
Wave
/>
<
Wave
/>
</
ChartEmpty
>
<
MissingChartData
>
<
TrendingUp
size=
{
12
}
/>
Missing chart data
</
MissingChartData
>
</
ChartHeader
>
<
MissingData
>
<
AboutSection
>
<
AboutHeader
>
<
Trans
>
About
</
Trans
>
</
AboutHeader
>
<
NoInfoAvailable
>
<
Trans
>
No token information available
</
Trans
>
</
NoInfoAvailable
>
<
ResourcesContainer
>
<
Resource
name=
{
'
Etherscan
'
}
link=
{
'
https://etherscan.io/
'
}
/>
<
Resource
name=
{
'
Protocol Info
'
}
link=
{
`https://info.uniswap.org/#/tokens/${address}`
}
/>
</
ResourcesContainer
>
</
AboutSection
>
<
StatsSection
>
<
NoInfoAvailable
>
<
Trans
>
No stats available
</
Trans
>
</
NoInfoAvailable
>
</
StatsSection
>
<
ContractAddressSection
>
<
Contract
>
Contract Address
<
ContractAddress
>
<
CopyContractAddress
address=
{
address
}
/>
</
ContractAddress
>
</
Contract
>
</
ContractAddressSection
>
</
MissingData
>
<
TokenSafetyModal
isOpen=
{
warningModalOpen
}
tokenAddress=
{
address
}
onCancel=
{
()
=>
navigate
(
-
1
)
}
onContinue=
{
handleDismissWarning
}
/>
</
TopArea
>
)
}
const
tokenName
=
token
.
name
const
tokenSymbol
=
token
.
symbol
...
...
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