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
09e6d38f
Unverified
Commit
09e6d38f
authored
Mar 21, 2023
by
Jordan Frankfurt
Committed by
GitHub
Mar 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: bnb network notif badge in search (#6210)
* feat: bnb network notif badge in search * add chainname check
parent
236a4dc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
SearchBarDropdown.tsx
src/components/NavBar/SearchBarDropdown.tsx
+37
-0
No files found.
src/components/NavBar/SearchBarDropdown.tsx
View file @
09e6d38f
...
...
@@ -2,11 +2,14 @@ import { Trans } from '@lingui/macro'
import
{
useTrace
}
from
'
@uniswap/analytics
'
import
{
InterfaceSectionName
,
NavBarSearchTypes
}
from
'
@uniswap/analytics-events
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
Badge
from
'
components/Badge
'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
{
useNftGraphqlEnabled
}
from
'
featureFlags/flags/nftlGraphql
'
import
{
HistoryDuration
,
SafetyLevel
}
from
'
graphql/data/__generated__/types-and-hooks
'
import
{
useTrendingCollections
}
from
'
graphql/data/nft/TrendingCollections
'
import
{
SearchToken
}
from
'
graphql/data/SearchTokens
'
import
useTrendingTokens
from
'
graphql/data/TrendingTokens
'
import
{
CHAIN_ID_TO_BACKEND_NAME
}
from
'
graphql/data/util
'
import
{
useIsNftPage
}
from
'
hooks/useIsNftPage
'
import
{
Box
}
from
'
nft/components/Box
'
import
{
Column
,
Row
}
from
'
nft/components/Flex
'
...
...
@@ -17,7 +20,10 @@ import { formatEthPrice } from 'nft/utils/currency'
import
{
ReactNode
,
useEffect
,
useMemo
,
useState
}
from
'
react
'
import
{
useQuery
}
from
'
react-query
'
import
{
useLocation
}
from
'
react-router-dom
'
import
styled
from
'
styled-components/macro
'
import
{
ThemedText
}
from
'
theme
'
import
BnbLogoURI
from
'
../../assets/svg/bnb-logo.svg
'
import
{
ClockIcon
,
TrendingArrow
}
from
'
../../nft/components/icons
'
import
{
useRecentlySearchedAssets
}
from
'
./RecentlySearchedAssets
'
import
*
as
styles
from
'
./SearchBar.css
'
...
...
@@ -101,6 +107,24 @@ function isKnownToken(token: SearchToken) {
return
token
.
project
?.
safetyLevel
==
SafetyLevel
.
Verified
||
token
.
project
?.
safetyLevel
==
SafetyLevel
.
MediumWarning
}
const
BNBLogo
=
styled
.
img
`
height: 20px;
width: 20px;
margin-right: 8px;
`
const
BNBComingSoonBadge
=
styled
(
Badge
)
`
align-items: center;
background-color:
${({
theme
})
=>
theme
.
backgroundModule
}
;
color:
${({
theme
})
=>
theme
.
textSecondary
}
;
display: flex;
flex-direction: row;
justify-content: flex-start;
opacity: 1;
padding: 8px;
margin: 16px 16px 4px;
width: calc(100% - 32px);
`
interface
SearchBarDropdownProps
{
toggleOpen
:
()
=>
void
tokens
:
SearchToken
[]
...
...
@@ -124,6 +148,7 @@ export const SearchBarDropdown = ({
const
shortenedHistory
=
useMemo
(()
=>
searchHistory
?.
slice
(
0
,
2
)
??
[...
Array
<
SearchToken
>
(
2
)],
[
searchHistory
])
const
{
pathname
}
=
useLocation
()
const
{
chainId
}
=
useWeb3React
()
const
isNFTPage
=
useIsNftPage
()
const
isNftGraphqlEnabled
=
useNftGraphqlEnabled
()
const
isTokenPage
=
pathname
.
includes
(
'
/tokens
'
)
...
...
@@ -336,10 +361,22 @@ export const SearchBarDropdown = ({
searchHistory
,
])
const
showBNBComingSoonBadge
=
Boolean
(
chainId
!==
undefined
&&
chainId
===
SupportedChainId
.
BNB
&&
!
isLoading
&&
!
CHAIN_ID_TO_BACKEND_NAME
[
chainId
]
)
return
(
<
Box
className=
{
styles
.
searchBarDropdownNft
}
>
<
Box
opacity=
{
isLoading
?
'
0.3
'
:
'
1
'
}
transition=
"125"
>
{
resultsState
}
{
showBNBComingSoonBadge
&&
(
<
BNBComingSoonBadge
>
<
BNBLogo
src=
{
BnbLogoURI
}
/>
<
ThemedText
.
BodySmall
color=
"textSecondary"
fontSize=
"14px"
fontWeight=
"400"
lineHeight=
"20px"
>
<
Trans
>
Coming soon: search and explore tokens on BNB Chain
</
Trans
>
</
ThemedText
.
BodySmall
>
</
BNBComingSoonBadge
>
)
}
</
Box
>
</
Box
>
)
...
...
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