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
02b617d2
Unverified
Commit
02b617d2
authored
Sep 16, 2022
by
vignesh mohankumar
Committed by
GitHub
Sep 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: move token banner logic into Modals (#4638)
* move banner logic into Modals * fixed * z-index * fix * fix
parent
96d04e1a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
10 deletions
+9
-10
TokensBanner.tsx
src/components/Tokens/TokensBanner.tsx
+3
-2
index.tsx
src/components/TopLevelModals/index.tsx
+6
-0
index.tsx
src/pages/Pool/index.tsx
+0
-4
index.tsx
src/pages/Swap/index.tsx
+0
-4
No files found.
src/components/Tokens/TokensBanner.tsx
View file @
02b617d2
...
@@ -3,12 +3,13 @@ import { Link } from 'react-router-dom'
...
@@ -3,12 +3,13 @@ import { Link } from 'react-router-dom'
import
{
useShowTokensPromoBanner
}
from
'
state/user/hooks
'
import
{
useShowTokensPromoBanner
}
from
'
state/user/hooks
'
import
styled
,
{
useTheme
}
from
'
styled-components/macro
'
import
styled
,
{
useTheme
}
from
'
styled-components/macro
'
import
{
opacify
}
from
'
theme/utils
'
import
{
opacify
}
from
'
theme/utils
'
import
{
Z_INDEX
}
from
'
theme/zIndex
'
import
tokensPromoDark
from
'
../../assets/images/tokensPromoDark.png
'
import
tokensPromoDark
from
'
../../assets/images/tokensPromoDark.png
'
import
tokensPromoLight
from
'
../../assets/images/tokensPromoLight.png
'
import
tokensPromoLight
from
'
../../assets/images/tokensPromoLight.png
'
const
PopupContainer
=
styled
.
div
<
{
show
:
boolean
}
>
`
const
PopupContainer
=
styled
.
div
<
{
show
:
boolean
}
>
`
position:
absolute
;
position:
fixed
;
display:
${({
show
})
=>
(
show
?
'
flex
'
:
'
none
'
)}
;
display:
${({
show
})
=>
(
show
?
'
flex
'
:
'
none
'
)}
;
flex-direction: column;
flex-direction: column;
padding: 12px 16px 12px 20px;
padding: 12px 16px 12px 20px;
...
@@ -17,7 +18,7 @@ const PopupContainer = styled.div<{ show: boolean }>`
...
@@ -17,7 +18,7 @@ const PopupContainer = styled.div<{ show: boolean }>`
right: 16px;
right: 16px;
width: 320px;
width: 320px;
height: 88px;
height: 88px;
z-index:
5
;
z-index:
${
Z_INDEX
.
sticky
}
;
background-color:
${({
theme
})
=>
(
theme
.
darkMode
?
theme
.
backgroundScrim
:
opacify
(
60
,
'
#FDF0F8
'
))}
;
background-color:
${({
theme
})
=>
(
theme
.
darkMode
?
theme
.
backgroundScrim
:
opacify
(
60
,
'
#FDF0F8
'
))}
;
color:
${({
theme
})
=>
theme
.
textPrimary
}
;
color:
${({
theme
})
=>
theme
.
textPrimary
}
;
border: 1px solid
${({
theme
})
=>
theme
.
backgroundOutline
}
;
border: 1px solid
${({
theme
})
=>
theme
.
backgroundOutline
}
;
...
...
src/components/TopLevelModals/index.tsx
View file @
02b617d2
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
AddressClaimModal
from
'
components/claim/AddressClaimModal
'
import
AddressClaimModal
from
'
components/claim/AddressClaimModal
'
import
ConnectedAccountBlocked
from
'
components/ConnectedAccountBlocked
'
import
ConnectedAccountBlocked
from
'
components/ConnectedAccountBlocked
'
import
TokensBanner
from
'
components/Tokens/TokensBanner
'
import
{
TokensVariant
,
useTokensFlag
}
from
'
featureFlags/flags/tokens
'
import
useAccountRiskCheck
from
'
hooks/useAccountRiskCheck
'
import
useAccountRiskCheck
from
'
hooks/useAccountRiskCheck
'
import
{
lazy
}
from
'
react
'
import
{
lazy
}
from
'
react
'
import
{
useLocation
}
from
'
react-router-dom
'
import
{
useModalIsOpen
,
useToggleModal
}
from
'
state/application/hooks
'
import
{
useModalIsOpen
,
useToggleModal
}
from
'
state/application/hooks
'
import
{
ApplicationModal
}
from
'
state/application/reducer
'
import
{
ApplicationModal
}
from
'
state/application/reducer
'
...
@@ -14,6 +17,7 @@ export default function TopLevelModals() {
...
@@ -14,6 +17,7 @@ export default function TopLevelModals() {
const
blockedAccountModalOpen
=
useModalIsOpen
(
ApplicationModal
.
BLOCKED_ACCOUNT
)
const
blockedAccountModalOpen
=
useModalIsOpen
(
ApplicationModal
.
BLOCKED_ACCOUNT
)
const
{
account
}
=
useWeb3React
()
const
{
account
}
=
useWeb3React
()
const
location
=
useLocation
()
useAccountRiskCheck
(
account
)
useAccountRiskCheck
(
account
)
const
open
=
Boolean
(
blockedAccountModalOpen
&&
account
)
const
open
=
Boolean
(
blockedAccountModalOpen
&&
account
)
...
@@ -21,6 +25,8 @@ export default function TopLevelModals() {
...
@@ -21,6 +25,8 @@ export default function TopLevelModals() {
<>
<>
<
AddressClaimModal
isOpen=
{
addressClaimOpen
}
onDismiss=
{
addressClaimToggle
}
/>
<
AddressClaimModal
isOpen=
{
addressClaimOpen
}
onDismiss=
{
addressClaimToggle
}
/>
<
ConnectedAccountBlocked
account=
{
account
}
isOpen=
{
open
}
/>
<
ConnectedAccountBlocked
account=
{
account
}
isOpen=
{
open
}
/>
{
useTokensFlag
()
===
TokensVariant
.
Enabled
&&
(
location
.
pathname
.
includes
(
'
/pool
'
)
||
location
.
pathname
.
includes
(
'
/swap
'
))
&&
<
TokensBanner
/>
}
<
Cart
/>
<
Cart
/>
</>
</>
)
)
...
...
src/pages/Pool/index.tsx
View file @
02b617d2
...
@@ -10,10 +10,8 @@ import { FlyoutAlignment, NewMenu } from 'components/Menu'
...
@@ -10,10 +10,8 @@ import { FlyoutAlignment, NewMenu } from 'components/Menu'
import
PositionList
from
'
components/PositionList
'
import
PositionList
from
'
components/PositionList
'
import
{
RowBetween
,
RowFixed
}
from
'
components/Row
'
import
{
RowBetween
,
RowFixed
}
from
'
components/Row
'
import
{
SwitchLocaleLink
}
from
'
components/SwitchLocaleLink
'
import
{
SwitchLocaleLink
}
from
'
components/SwitchLocaleLink
'
import
TokensBanner
from
'
components/Tokens/TokensBanner
'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
NavBarVariant
,
useNavBarFlag
}
from
'
featureFlags/flags/navBar
'
import
{
NavBarVariant
,
useNavBarFlag
}
from
'
featureFlags/flags/navBar
'
import
{
TokensVariant
,
useTokensFlag
}
from
'
featureFlags/flags/tokens
'
import
{
useV3Positions
}
from
'
hooks/useV3Positions
'
import
{
useV3Positions
}
from
'
hooks/useV3Positions
'
import
{
AlertTriangle
,
BookOpen
,
ChevronDown
,
ChevronsRight
,
Inbox
,
Layers
,
PlusCircle
}
from
'
react-feather
'
import
{
AlertTriangle
,
BookOpen
,
ChevronDown
,
ChevronsRight
,
Inbox
,
Layers
,
PlusCircle
}
from
'
react-feather
'
import
{
Link
}
from
'
react-router-dom
'
import
{
Link
}
from
'
react-router-dom
'
...
@@ -166,10 +164,8 @@ function WrongNetworkCard() {
...
@@ -166,10 +164,8 @@ function WrongNetworkCard() {
const
navBarFlag
=
useNavBarFlag
()
const
navBarFlag
=
useNavBarFlag
()
const
navBarFlagEnabled
=
navBarFlag
===
NavBarVariant
.
Enabled
const
navBarFlagEnabled
=
navBarFlag
===
NavBarVariant
.
Enabled
const
theme
=
useTheme
()
const
theme
=
useTheme
()
const
tokensFlag
=
useTokensFlag
()
return
(
return
(
<>
<>
{
tokensFlag
===
TokensVariant
.
Enabled
&&
<
TokensBanner
/>
}
<
PageWrapper
navBarFlag=
{
navBarFlagEnabled
}
>
<
PageWrapper
navBarFlag=
{
navBarFlagEnabled
}
>
<
AutoColumn
gap=
"lg"
justify=
"center"
>
<
AutoColumn
gap=
"lg"
justify=
"center"
>
<
AutoColumn
gap=
"lg"
style=
{
{
width
:
'
100%
'
}
}
>
<
AutoColumn
gap=
"lg"
style=
{
{
width
:
'
100%
'
}
}
>
...
...
src/pages/Swap/index.tsx
View file @
02b617d2
...
@@ -17,13 +17,11 @@ import { NetworkAlert } from 'components/NetworkAlert/NetworkAlert'
...
@@ -17,13 +17,11 @@ import { NetworkAlert } from 'components/NetworkAlert/NetworkAlert'
import
PriceImpactWarning
from
'
components/swap/PriceImpactWarning
'
import
PriceImpactWarning
from
'
components/swap/PriceImpactWarning
'
import
SwapDetailsDropdown
from
'
components/swap/SwapDetailsDropdown
'
import
SwapDetailsDropdown
from
'
components/swap/SwapDetailsDropdown
'
import
UnsupportedCurrencyFooter
from
'
components/swap/UnsupportedCurrencyFooter
'
import
UnsupportedCurrencyFooter
from
'
components/swap/UnsupportedCurrencyFooter
'
import
TokensBanner
from
'
components/Tokens/TokensBanner
'
import
TokenSafetyModal
from
'
components/TokenSafety/TokenSafetyModal
'
import
TokenSafetyModal
from
'
components/TokenSafety/TokenSafetyModal
'
import
{
MouseoverTooltip
}
from
'
components/Tooltip
'
import
{
MouseoverTooltip
}
from
'
components/Tooltip
'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
NavBarVariant
,
useNavBarFlag
}
from
'
featureFlags/flags/navBar
'
import
{
NavBarVariant
,
useNavBarFlag
}
from
'
featureFlags/flags/navBar
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
TokensVariant
,
useTokensFlag
}
from
'
featureFlags/flags/tokens
'
import
{
useSwapCallback
}
from
'
hooks/useSwapCallback
'
import
{
useSwapCallback
}
from
'
hooks/useSwapCallback
'
import
useTransactionDeadline
from
'
hooks/useTransactionDeadline
'
import
useTransactionDeadline
from
'
hooks/useTransactionDeadline
'
import
JSBI
from
'
jsbi
'
import
JSBI
from
'
jsbi
'
...
@@ -156,7 +154,6 @@ export default function Swap() {
...
@@ -156,7 +154,6 @@ export default function Swap() {
const
navBarFlagEnabled
=
navBarFlag
===
NavBarVariant
.
Enabled
const
navBarFlagEnabled
=
navBarFlag
===
NavBarVariant
.
Enabled
const
redesignFlag
=
useRedesignFlag
()
const
redesignFlag
=
useRedesignFlag
()
const
redesignFlagEnabled
=
redesignFlag
===
RedesignVariant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
RedesignVariant
.
Enabled
const
tokensFlag
=
useTokensFlag
()
const
{
account
,
chainId
}
=
useWeb3React
()
const
{
account
,
chainId
}
=
useWeb3React
()
const
loadedUrlParams
=
useDefaultsFromURLSearch
()
const
loadedUrlParams
=
useDefaultsFromURLSearch
()
const
[
newSwapQuoteNeedsLogging
,
setNewSwapQuoteNeedsLogging
]
=
useState
(
true
)
const
[
newSwapQuoteNeedsLogging
,
setNewSwapQuoteNeedsLogging
]
=
useState
(
true
)
...
@@ -505,7 +502,6 @@ export default function Swap() {
...
@@ -505,7 +502,6 @@ export default function Swap() {
return
(
return
(
<
Trace
page=
{
PageName
.
SWAP_PAGE
}
shouldLogImpression
>
<
Trace
page=
{
PageName
.
SWAP_PAGE
}
shouldLogImpression
>
<>
<>
{
tokensFlag
===
TokensVariant
.
Enabled
&&
<
TokensBanner
/>
}
{
redesignFlagEnabled
?
(
{
redesignFlagEnabled
?
(
<
TokenSafetyModal
<
TokenSafetyModal
isOpen=
{
importTokensNotInDefault
.
length
>
0
&&
!
dismissTokenWarning
}
isOpen=
{
importTokensNotInDefault
.
length
>
0
&&
!
dismissTokenWarning
}
...
...
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