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
09380698
Unverified
Commit
09380698
authored
Aug 15, 2022
by
Vignesh Mohankumar
Committed by
GitHub
Aug 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: split phase0 flag into redesign, explore, tokenSafety (#4347)
* changes so far * more changes * lint * remove Phase0:
parent
1d96961f
Changes
31
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
339 additions
and
303 deletions
+339
-303
index.tsx
src/components/Button/index.tsx
+16
-16
index.tsx
src/components/CurrencyInputPanel/index.tsx
+62
-61
FeatureFlagModal.tsx
src/components/FeatureFlagModal/FeatureFlagModal.tsx
+20
-7
index.tsx
src/components/Header/index.tsx
+3
-3
index.tsx
src/components/NumericalInput/index.tsx
+9
-9
index.tsx
src/components/QuestionHelper/index.tsx
+14
-14
CommonBases.tsx
src/components/SearchModal/CommonBases.tsx
+16
-15
index.tsx
src/components/SearchModal/CurrencyList/index.tsx
+9
-7
CurrencySearch.tsx
src/components/SearchModal/CurrencySearch.tsx
+9
-9
CurrencySearchModal.tsx
src/components/SearchModal/CurrencySearchModal.tsx
+3
-3
styleds.tsx
src/components/SearchModal/styleds.tsx
+15
-15
index.tsx
src/components/Settings/index.tsx
+15
-15
index.tsx
src/components/Toggle/index.tsx
+7
-7
index.tsx
src/components/TransactionSettings/index.tsx
+14
-14
AdvancedSwapDetails.tsx
src/components/swap/AdvancedSwapDetails.tsx
+4
-4
SwapDetailsDropdown.tsx
src/components/swap/SwapDetailsDropdown.tsx
+13
-13
SwapModalHeader.tsx
src/components/swap/SwapModalHeader.tsx
+10
-10
SwapRoute.tsx
src/components/swap/SwapRoute.tsx
+7
-7
styleds.tsx
src/components/swap/styleds.tsx
+6
-6
explore.ts
src/featureFlags/flags/explore.ts
+7
-0
phase0.ts
src/featureFlags/flags/phase0.ts
+0
-7
phase1.ts
src/featureFlags/flags/phase1.ts
+2
-2
redesign.ts
src/featureFlags/flags/redesign.ts
+7
-0
tokenSafety.ts
src/featureFlags/flags/tokenSafety.ts
+7
-0
index.tsx
src/featureFlags/index.tsx
+3
-1
App.tsx
src/pages/App.tsx
+3
-3
AppBody.tsx
src/pages/AppBody.tsx
+12
-12
index.tsx
src/pages/Swap/index.tsx
+21
-21
RadialGradientByChainUpdater.ts
src/theme/RadialGradientByChainUpdater.ts
+17
-17
components.tsx
src/theme/components.tsx
+2
-2
index.tsx
src/theme/index.tsx
+6
-3
No files found.
src/components/Button/index.tsx
View file @
09380698
...
@@ -77,35 +77,35 @@ export const ButtonPrimary = styled(BaseButton)`
...
@@ -77,35 +77,35 @@ export const ButtonPrimary = styled(BaseButton)`
}
}
`
`
export const ButtonLight = styled(BaseButton)<{
phase0
Flag?: boolean }>`
export const ButtonLight = styled(BaseButton)<{
redesign
Flag?: boolean }>`
background
-
color
:
$
{({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
accentActionSoft
:
theme
.
deprecated_primary5
)};
background
-
color
:
$
{({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
accentActionSoft
:
theme
.
deprecated_primary5
)};
color
:
$
{({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
accentAction
:
theme
.
deprecated_primaryText1
)};
color
:
$
{({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
accentAction
:
theme
.
deprecated_primaryText1
)};
font
-
size
:
$
{({
phase0Flag
})
=>
(
phase0
Flag
?
'
20px
'
:
'
16px
'
)};
font
-
size
:
$
{({
redesignFlag
})
=>
(
redesign
Flag
?
'
20px
'
:
'
16px
'
)};
font
-
weight
:
$
{({
phase0Flag
})
=>
(
phase0
Flag
?
'
600
'
:
'
500
'
)};
font
-
weight
:
$
{({
redesignFlag
})
=>
(
redesign
Flag
?
'
600
'
:
'
500
'
)};
&
:
focus
{
&
:
focus
{
box
-
shadow
:
0
0
0
1
pt
box
-
shadow
:
0
0
0
1
pt
$
{({
theme
,
disabled
,
phase0
Flag
})
=>
$
{({
theme
,
disabled
,
redesign
Flag
})
=>
!
disabled
&&
(
phase0
Flag
?
theme
.
accentActionSoft
:
darken
(
0.03
,
theme
.
deprecated_primary5
))};
!
disabled
&&
(
redesign
Flag
?
theme
.
accentActionSoft
:
darken
(
0.03
,
theme
.
deprecated_primary5
))};
background
-
color
:
$
{({
theme
,
disabled
,
phase0
Flag
})
=>
background
-
color
:
$
{({
theme
,
disabled
,
redesign
Flag
})
=>
!
disabled
&&
(
phase0
Flag
?
theme
.
accentActionSoft
:
darken
(
0.03
,
theme
.
deprecated_primary5
))};
!
disabled
&&
(
redesign
Flag
?
theme
.
accentActionSoft
:
darken
(
0.03
,
theme
.
deprecated_primary5
))};
}
}
&
:
hover
{
&
:
hover
{
background
-
color
:
$
{({
theme
,
disabled
,
phase0
Flag
})
=>
background
-
color
:
$
{({
theme
,
disabled
,
redesign
Flag
})
=>
!
disabled
&&
(
phase0
Flag
?
theme
.
accentActionSoft
:
darken
(
0.03
,
theme
.
deprecated_primary5
))};
!
disabled
&&
(
redesign
Flag
?
theme
.
accentActionSoft
:
darken
(
0.03
,
theme
.
deprecated_primary5
))};
}
}
&
:
active
{
&
:
active
{
box
-
shadow
:
0
0
0
1
pt
box
-
shadow
:
0
0
0
1
pt
$
{({
theme
,
disabled
,
phase0
Flag
})
=>
$
{({
theme
,
disabled
,
redesign
Flag
})
=>
!
disabled
&&
(
phase0
Flag
?
theme
.
accentActionSoft
:
darken
(
0.05
,
theme
.
deprecated_primary5
))};
!
disabled
&&
(
redesign
Flag
?
theme
.
accentActionSoft
:
darken
(
0.05
,
theme
.
deprecated_primary5
))};
background
-
color
:
$
{({
theme
,
disabled
,
phase0
Flag
})
=>
background
-
color
:
$
{({
theme
,
disabled
,
redesign
Flag
})
=>
!
disabled
&&
(
phase0
Flag
?
theme
.
accentActionSoft
:
darken
(
0.05
,
theme
.
deprecated_primary5
))};
!
disabled
&&
(
redesign
Flag
?
theme
.
accentActionSoft
:
darken
(
0.05
,
theme
.
deprecated_primary5
))};
}
}
:
disabled
{
:
disabled
{
opacity
:
0.4
;
opacity
:
0.4
;
:
hover
{
:
hover
{
cursor
:
auto
;
cursor
:
auto
;
background
-
color
:
$
{({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
none
:
theme
.
deprecated_primary5
)};
background
-
color
:
$
{({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
none
:
theme
.
deprecated_primary5
)};
box
-
shadow
:
none
;
box
-
shadow
:
none
;
border
:
1
px
solid
transparent
;
border
:
1
px
solid
transparent
;
outline
:
none
;
outline
:
none
;
...
...
src/components/CurrencyInputPanel/index.tsx
View file @
09380698
...
@@ -7,7 +7,7 @@ import { TraceEvent } from 'components/AmplitudeAnalytics/TraceEvent'
...
@@ -7,7 +7,7 @@ import { TraceEvent } from 'components/AmplitudeAnalytics/TraceEvent'
import
{
AutoColumn
}
from
'
components/Column
'
import
{
AutoColumn
}
from
'
components/Column
'
import
{
LoadingOpacityContainer
,
loadingOpacityMixin
}
from
'
components/Loader/styled
'
import
{
LoadingOpacityContainer
,
loadingOpacityMixin
}
from
'
components/Loader/styled
'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
darken
}
from
'
polished
'
import
{
darken
}
from
'
polished
'
import
{
ReactNode
,
useCallback
,
useState
}
from
'
react
'
import
{
ReactNode
,
useCallback
,
useState
}
from
'
react
'
import
{
Lock
}
from
'
react-feather
'
import
{
Lock
}
from
'
react-feather
'
...
@@ -26,37 +26,37 @@ import { RowBetween, RowFixed } from '../Row'
...
@@ -26,37 +26,37 @@ import { RowBetween, RowFixed } from '../Row'
import
CurrencySearchModal
from
'
../SearchModal/CurrencySearchModal
'
import
CurrencySearchModal
from
'
../SearchModal/CurrencySearchModal
'
import
{
FiatValue
}
from
'
./FiatValue
'
import
{
FiatValue
}
from
'
./FiatValue
'
const
InputPanel
=
styled
.
div
<
{
hideInput
?:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
InputPanel
=
styled
.
div
<
{
hideInput
?:
boolean
;
redesign
Flag
:
boolean
}
>
`
${({
theme
})
=>
theme
.
flexColumnNoWrap
}
${({
theme
})
=>
theme
.
flexColumnNoWrap
}
position: relative;
position: relative;
border-radius:
${({
hideInput
})
=>
(
hideInput
?
'
16px
'
:
'
20px
'
)}
;
border-radius:
${({
hideInput
})
=>
(
hideInput
?
'
16px
'
:
'
20px
'
)}
;
background-color:
${({
theme
,
phase0
Flag
,
hideInput
})
=>
background-color:
${({
theme
,
redesign
Flag
,
hideInput
})
=>
phase0
Flag
?
theme
.
none
:
hideInput
?
'
transparent
'
:
theme
.
deprecated_bg2
}
;
redesign
Flag
?
theme
.
none
:
hideInput
?
'
transparent
'
:
theme
.
deprecated_bg2
}
;
z-index: 1;
z-index: 1;
width:
${({
hideInput
})
=>
(
hideInput
?
'
100%
'
:
'
initial
'
)}
;
width:
${({
hideInput
})
=>
(
hideInput
?
'
100%
'
:
'
initial
'
)}
;
transition: height 1s ease;
transition: height 1s ease;
will-change: height;
will-change: height;
`
`
const
FixedContainer
=
styled
.
div
<
{
phase0
Flag
:
boolean
}
>
`
const
FixedContainer
=
styled
.
div
<
{
redesign
Flag
:
boolean
}
>
`
width: 100%;
width: 100%;
height: 100%;
height: 100%;
position: absolute;
position: absolute;
border-radius: 20px;
border-radius: 20px;
background-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
none
:
theme
.
deprecated_bg2
)}
;
background-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
none
:
theme
.
deprecated_bg2
)}
;
display: flex;
display: flex;
align-items: center;
align-items: center;
justify-content: center;
justify-content: center;
z-index: 2;
z-index: 2;
`
`
const
Container
=
styled
.
div
<
{
hideInput
:
boolean
;
disabled
:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
Container
=
styled
.
div
<
{
hideInput
:
boolean
;
disabled
:
boolean
;
redesign
Flag
:
boolean
}
>
`
border-radius:
${({
hideInput
})
=>
(
hideInput
?
'
16px
'
:
'
20px
'
)}
;
border-radius:
${({
hideInput
})
=>
(
hideInput
?
'
16px
'
:
'
20px
'
)}
;
border: 1px solid
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
none
:
theme
.
deprecated_bg0
)}
;
border: 1px solid
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
none
:
theme
.
deprecated_bg0
)}
;
background-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
none
:
theme
.
deprecated_bg1
)}
;
background-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
none
:
theme
.
deprecated_bg1
)}
;
width:
${({
hideInput
})
=>
(
hideInput
?
'
100%
'
:
'
initial
'
)}
;
width:
${({
hideInput
})
=>
(
hideInput
?
'
100%
'
:
'
initial
'
)}
;
${({
theme
,
hideInput
,
disabled
,
phase0
Flag
})
=>
${({
theme
,
hideInput
,
disabled
,
redesign
Flag
})
=>
!
phase0
Flag
&&
!
redesign
Flag
&&
!
disabled
&&
!
disabled
&&
`
`
:focus,
:focus,
...
@@ -71,11 +71,11 @@ const CurrencySelect = styled(ButtonGray)<{
...
@@ -71,11 +71,11 @@ const CurrencySelect = styled(ButtonGray)<{
selected
:
boolean
selected
:
boolean
hideInput
?:
boolean
hideInput
?:
boolean
disabled
?:
boolean
disabled
?:
boolean
phase0
Flag
:
boolean
redesign
Flag
:
boolean
}
>
`
}
>
`
align-items: center;
align-items: center;
background-color:
${({
selected
,
theme
,
phase0
Flag
})
=>
background-color:
${({
selected
,
theme
,
redesign
Flag
})
=>
phase0
Flag
redesign
Flag
?
selected
?
selected
?
theme
.
backgroundSurface
?
theme
.
backgroundSurface
:
theme
.
accentAction
:
theme
.
accentAction
...
@@ -86,7 +86,7 @@ const CurrencySelect = styled(ButtonGray)<{
...
@@ -86,7 +86,7 @@ const CurrencySelect = styled(ButtonGray)<{
box-shadow:
${({
selected
})
=>
(
selected
?
'
none
'
:
'
0px 6px 10px rgba(0, 0, 0, 0.075)
'
)}
;
box-shadow:
${({
selected
})
=>
(
selected
?
'
none
'
:
'
0px 6px 10px rgba(0, 0, 0, 0.075)
'
)}
;
color:
${({
selected
,
theme
})
=>
(
selected
?
theme
.
deprecated_text1
:
theme
.
deprecated_white
)}
;
color:
${({
selected
,
theme
})
=>
(
selected
?
theme
.
deprecated_text1
:
theme
.
deprecated_white
)}
;
cursor: pointer;
cursor: pointer;
height:
${({
hideInput
,
phase0Flag
})
=>
(
phase0
Flag
?
'
unset
'
:
hideInput
?
'
2.8rem
'
:
'
2.4rem
'
)}
;
height:
${({
hideInput
,
redesignFlag
})
=>
(
redesign
Flag
?
'
unset
'
:
hideInput
?
'
2.8rem
'
:
'
2.4rem
'
)}
;
border-radius: 16px;
border-radius: 16px;
outline: none;
outline: none;
user-select: none;
user-select: none;
...
@@ -94,41 +94,42 @@ const CurrencySelect = styled(ButtonGray)<{
...
@@ -94,41 +94,42 @@ const CurrencySelect = styled(ButtonGray)<{
font-size: 24px;
font-size: 24px;
font-weight: 400;
font-weight: 400;
width:
${({
hideInput
})
=>
(
hideInput
?
'
100%
'
:
'
initial
'
)}
;
width:
${({
hideInput
})
=>
(
hideInput
?
'
100%
'
:
'
initial
'
)}
;
padding:
${({
selected
,
phase0Flag
})
=>
(
phase0Flag
?
(
selected
?
'
4px 8px 4px 4px
'
:
'
6px 6px 6px 8px
'
)
:
'
0 8px
'
)}
;
padding:
${({
selected
,
redesignFlag
})
=>
gap:
${({
phase0Flag
})
=>
(
phase0Flag
?
'
8px
'
:
'
0px
'
)}
;
redesignFlag
?
(
selected
?
'
4px 8px 4px 4px
'
:
'
6px 6px 6px 8px
'
)
:
'
0 8px
'
}
;
gap:
${({
redesignFlag
})
=>
(
redesignFlag
?
'
8px
'
:
'
0px
'
)}
;
justify-content: space-between;
justify-content: space-between;
margin-left:
${({
hideInput
})
=>
(
hideInput
?
'
0
'
:
'
12px
'
)}
;
margin-left:
${({
hideInput
})
=>
(
hideInput
?
'
0
'
:
'
12px
'
)}
;
:focus,
:focus,
:hover {
:hover {
background-color:
${({
selected
,
theme
,
phase0
Flag
})
=>
background-color:
${({
selected
,
theme
,
redesign
Flag
})
=>
selected
selected
?
phase0
Flag
?
redesign
Flag
?
theme
.
backgroundSurface
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg3
:
theme
.
deprecated_bg3
:
darken
(
0.05
,
theme
.
deprecated_primary1
)}
;
:
darken
(
0.05
,
theme
.
deprecated_primary1
)}
;
}
}
visibility:
${({
visible
})
=>
(
visible
?
'
visible
'
:
'
hidden
'
)}
;
visibility:
${({
visible
})
=>
(
visible
?
'
visible
'
:
'
hidden
'
)}
;
`
`
const
InputCurrencySelect
=
styled
(
CurrencySelect
)
<
{
phase0
Flag
:
boolean
}
>
`
const
InputCurrencySelect
=
styled
(
CurrencySelect
)
<
{
redesign
Flag
:
boolean
}
>
`
background-color:
${({
theme
,
selected
,
phase0
Flag
})
=>
background-color:
${({
theme
,
selected
,
redesign
Flag
})
=>
phase0
Flag
&&
(
selected
?
theme
.
backgroundModule
:
theme
.
accentAction
)}
;
redesign
Flag
&&
(
selected
?
theme
.
backgroundModule
:
theme
.
accentAction
)}
;
:focus,
:focus,
:hover {
:hover {
background-color:
${({
selected
,
theme
,
phase0
Flag
})
=>
background-color:
${({
selected
,
theme
,
redesign
Flag
})
=>
selected
selected
?
phase0
Flag
?
redesign
Flag
?
theme
.
backgroundInteractive
?
theme
.
backgroundInteractive
:
theme
.
deprecated_bg3
:
theme
.
deprecated_bg3
:
darken
(
0.05
,
theme
.
deprecated_primary1
)}
;
:
darken
(
0.05
,
theme
.
deprecated_primary1
)}
;
}
}
`
`
const
InputRow
=
styled
.
div
<
{
selected
:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
InputRow
=
styled
.
div
<
{
selected
:
boolean
;
redesign
Flag
:
boolean
}
>
`
${({
theme
})
=>
theme
.
flexRowNoWrap
}
${({
theme
})
=>
theme
.
flexRowNoWrap
}
align-items: center;
align-items: center;
justify-content: space-between;
justify-content: space-between;
padding:
${({
selected
,
phase0
Flag
})
=>
padding:
${({
selected
,
redesign
Flag
})
=>
phase0
Flag
?
'
0px
'
:
selected
?
'
1rem 1rem 0.75rem 1rem
'
:
'
1rem 1rem 1rem 1rem
'
}
;
redesign
Flag
?
'
0px
'
:
selected
?
'
1rem 1rem 0.75rem 1rem
'
:
'
1rem 1rem 1rem 1rem
'
}
;
`
`
const
LabelRow
=
styled
.
div
`
const
LabelRow
=
styled
.
div
`
...
@@ -145,10 +146,10 @@ const LabelRow = styled.div`
...
@@ -145,10 +146,10 @@ const LabelRow = styled.div`
}
}
`
`
const
FiatRow
=
styled
(
LabelRow
)
<
{
phase0
Flag
:
boolean
}
>
`
const
FiatRow
=
styled
(
LabelRow
)
<
{
redesign
Flag
:
boolean
}
>
`
justify-content: flex-end;
justify-content: flex-end;
padding:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
8px 0px
'
}
;
padding:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
8px 0px
'
}
;
height:
${({
phase0Flag
})
=>
!
phase0
Flag
&&
'
24px
'
}
;
height:
${({
redesignFlag
})
=>
!
redesign
Flag
&&
'
24px
'
}
;
`
`
const
NoBalanceState
=
styled
.
div
`
const
NoBalanceState
=
styled
.
div
`
...
@@ -170,34 +171,34 @@ const Aligner = styled.span`
...
@@ -170,34 +171,34 @@ const Aligner = styled.span`
width: 100%;
width: 100%;
`
`
const
StyledDropDown
=
styled
(
DropDown
)
<
{
selected
:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
StyledDropDown
=
styled
(
DropDown
)
<
{
selected
:
boolean
;
redesign
Flag
:
boolean
}
>
`
margin: 0 0.25rem 0 0.35rem;
margin: 0 0.25rem 0 0.35rem;
height: 35%;
height: 35%;
margin-left:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
8px
'
}
;
margin-left:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
8px
'
}
;
path {
path {
stroke:
${({
selected
,
theme
})
=>
(
selected
?
theme
.
deprecated_text1
:
theme
.
deprecated_white
)}
;
stroke:
${({
selected
,
theme
})
=>
(
selected
?
theme
.
deprecated_text1
:
theme
.
deprecated_white
)}
;
stroke-width:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
2px
'
:
'
1.5px
'
)}
;
stroke-width:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
2px
'
:
'
1.5px
'
)}
;
}
}
`
`
const
StyledTokenName
=
styled
.
span
<
{
active
?:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
StyledTokenName
=
styled
.
span
<
{
active
?:
boolean
;
redesign
Flag
:
boolean
}
>
`
${({
active
})
=>
(
active
?
'
margin: 0 0.25rem 0 0.25rem;
'
:
'
margin: 0 0.25rem 0 0.25rem;
'
)}
${({
active
})
=>
(
active
?
'
margin: 0 0.25rem 0 0.25rem;
'
:
'
margin: 0 0.25rem 0 0.25rem;
'
)}
font-size:
${({
active
})
=>
(
active
?
'
18px
'
:
'
18px
'
)}
;
font-size:
${({
active
})
=>
(
active
?
'
18px
'
:
'
18px
'
)}
;
font-weight:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
600
'
:
'
500
'
)}
;
font-weight:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
600
'
:
'
500
'
)}
;
`
`
const
StyledBalanceMax
=
styled
.
button
<
{
disabled
?:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
StyledBalanceMax
=
styled
.
button
<
{
disabled
?:
boolean
;
redesign
Flag
:
boolean
}
>
`
background-color: transparent;
background-color: transparent;
background-color:
${({
theme
,
phase0Flag
})
=>
!
phase0
Flag
&&
theme
.
deprecated_primary5
}
;
background-color:
${({
theme
,
redesignFlag
})
=>
!
redesign
Flag
&&
theme
.
deprecated_primary5
}
;
border: none;
border: none;
text-transform:
${({
phase0Flag
})
=>
!
phase0
Flag
&&
'
uppercase
'
}
;
text-transform:
${({
redesignFlag
})
=>
!
redesign
Flag
&&
'
uppercase
'
}
;
border-radius:
${({
phase0Flag
})
=>
!
phase0
Flag
&&
'
12px
'
}
;
border-radius:
${({
redesignFlag
})
=>
!
redesign
Flag
&&
'
12px
'
}
;
color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
accentAction
:
theme
.
deprecated_primary1
)}
;
color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
accentAction
:
theme
.
deprecated_primary1
)}
;
cursor: pointer;
cursor: pointer;
font-size:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
14px
'
:
'
11px
'
)}
;
font-size:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
14px
'
:
'
11px
'
)}
;
font-weight:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
600
'
:
'
500
'
)}
;
font-weight:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
600
'
:
'
500
'
)}
;
margin-left:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
0px
'
:
'
0.25rem
'
)}
;
margin-left:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
0px
'
:
'
0.25rem
'
)}
;
opacity:
${({
disabled
})
=>
(
!
disabled
?
1
:
0.4
)}
;
opacity:
${({
disabled
})
=>
(
!
disabled
?
1
:
0.4
)}
;
padding: 4px 6px;
padding: 4px 6px;
pointer-events:
${({
disabled
})
=>
(
!
disabled
?
'
initial
'
:
'
none
'
)}
;
pointer-events:
${({
disabled
})
=>
(
!
disabled
?
'
initial
'
:
'
none
'
)}
;
...
@@ -211,11 +212,11 @@ const StyledBalanceMax = styled.button<{ disabled?: boolean; phase0Flag: boolean
...
@@ -211,11 +212,11 @@ const StyledBalanceMax = styled.button<{ disabled?: boolean; phase0Flag: boolean
}
}
`
`
const
StyledNumericalInput
=
styled
(
NumericalInput
)
<
{
$loading
:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
StyledNumericalInput
=
styled
(
NumericalInput
)
<
{
$loading
:
boolean
;
redesign
Flag
:
boolean
}
>
`
${
loadingOpacityMixin
}
;
${
loadingOpacityMixin
}
;
text-align: left;
text-align: left;
font-variant:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
small-caps
'
}
;
font-variant:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
small-caps
'
}
;
font-feature-settings:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
pnum on, lnum on
'
}
;
font-feature-settings:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
pnum on, lnum on
'
}
;
`
`
interface
CurrencyInputPanelProps
{
interface
CurrencyInputPanelProps
{
...
@@ -265,8 +266,8 @@ export default function CurrencyInputPanel({
...
@@ -265,8 +266,8 @@ export default function CurrencyInputPanel({
}:
CurrencyInputPanelProps
)
{
}:
CurrencyInputPanelProps
)
{
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
)
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
)
const
{
account
,
chainId
}
=
useWeb3React
()
const
{
account
,
chainId
}
=
useWeb3React
()
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
selectedCurrencyBalance
=
useCurrencyBalance
(
account
??
undefined
,
currency
??
undefined
)
const
selectedCurrencyBalance
=
useCurrencyBalance
(
account
??
undefined
,
currency
??
undefined
)
const
theme
=
useTheme
()
const
theme
=
useTheme
()
...
@@ -277,9 +278,9 @@ export default function CurrencyInputPanel({
...
@@ -277,9 +278,9 @@ export default function CurrencyInputPanel({
const
chainAllowed
=
isSupportedChain
(
chainId
)
const
chainAllowed
=
isSupportedChain
(
chainId
)
return
(
return
(
<
InputPanel
id=
{
id
}
hideInput=
{
hideInput
}
{
...
rest
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
InputPanel
id=
{
id
}
hideInput=
{
hideInput
}
{
...
rest
}
redesignFlag=
{
redesign
FlagEnabled
}
>
{
locked
&&
(
{
locked
&&
(
<
FixedContainer
phase0Flag=
{
phase0
FlagEnabled
}
>
<
FixedContainer
redesignFlag=
{
redesign
FlagEnabled
}
>
<
AutoColumn
gap=
"sm"
justify=
"center"
>
<
AutoColumn
gap=
"sm"
justify=
"center"
>
<
Lock
/>
<
Lock
/>
<
ThemedText
.
DeprecatedLabel
fontSize=
"12px"
textAlign=
"center"
padding=
"0 12px"
>
<
ThemedText
.
DeprecatedLabel
fontSize=
"12px"
textAlign=
"center"
padding=
"0 12px"
>
...
@@ -288,11 +289,11 @@ export default function CurrencyInputPanel({
...
@@ -288,11 +289,11 @@ export default function CurrencyInputPanel({
</
AutoColumn
>
</
AutoColumn
>
</
FixedContainer
>
</
FixedContainer
>
)
}
)
}
<
Container
hideInput=
{
hideInput
}
disabled=
{
!
chainAllowed
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
Container
hideInput=
{
hideInput
}
disabled=
{
!
chainAllowed
}
redesignFlag=
{
redesign
FlagEnabled
}
>
<
InputRow
<
InputRow
style=
{
hideInput
?
{
padding
:
'
0
'
,
borderRadius
:
'
8px
'
}
:
{}
}
style=
{
hideInput
?
{
padding
:
'
0
'
,
borderRadius
:
'
8px
'
}
:
{}
}
selected=
{
!
onCurrencySelect
}
selected=
{
!
onCurrencySelect
}
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
>
>
{
!
hideInput
&&
(
{
!
hideInput
&&
(
<
StyledNumericalInput
<
StyledNumericalInput
...
@@ -301,7 +302,7 @@ export default function CurrencyInputPanel({
...
@@ -301,7 +302,7 @@ export default function CurrencyInputPanel({
onUserInput=
{
onUserInput
}
onUserInput=
{
onUserInput
}
disabled=
{
!
chainAllowed
}
disabled=
{
!
chainAllowed
}
$loading=
{
loading
}
$loading=
{
loading
}
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
/>
/>
)
}
)
}
...
@@ -310,7 +311,7 @@ export default function CurrencyInputPanel({
...
@@ -310,7 +311,7 @@ export default function CurrencyInputPanel({
visible=
{
currency
!==
undefined
}
visible=
{
currency
!==
undefined
}
selected=
{
!!
currency
}
selected=
{
!!
currency
}
hideInput=
{
hideInput
}
hideInput=
{
hideInput
}
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
className=
"open-currency-select-button"
className=
"open-currency-select-button"
onClick=
{
()
=>
{
onClick=
{
()
=>
{
if
(
onCurrencySelect
)
{
if
(
onCurrencySelect
)
{
...
@@ -328,14 +329,14 @@ export default function CurrencyInputPanel({
...
@@ -328,14 +329,14 @@ export default function CurrencyInputPanel({
<
CurrencyLogo
style=
{
{
marginRight
:
'
2px
'
}
}
currency=
{
currency
}
size=
{
'
24px
'
}
/>
<
CurrencyLogo
style=
{
{
marginRight
:
'
2px
'
}
}
currency=
{
currency
}
size=
{
'
24px
'
}
/>
)
:
null
}
)
:
null
}
{
pair
?
(
{
pair
?
(
<
StyledTokenName
className=
"pair-name-container"
phase0Flag=
{
phase0
FlagEnabled
}
>
<
StyledTokenName
className=
"pair-name-container"
redesignFlag=
{
redesign
FlagEnabled
}
>
{
pair
?.
token0
.
symbol
}
:
{
pair
?.
token1
.
symbol
}
{
pair
?.
token0
.
symbol
}
:
{
pair
?.
token1
.
symbol
}
</
StyledTokenName
>
</
StyledTokenName
>
)
:
(
)
:
(
<
StyledTokenName
<
StyledTokenName
className=
"token-symbol-container"
className=
"token-symbol-container"
active=
{
Boolean
(
currency
&&
currency
.
symbol
)
}
active=
{
Boolean
(
currency
&&
currency
.
symbol
)
}
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
>
>
{
(
currency
&&
currency
.
symbol
&&
currency
.
symbol
.
length
>
20
{
(
currency
&&
currency
.
symbol
&&
currency
.
symbol
.
length
>
20
?
currency
.
symbol
.
slice
(
0
,
4
)
+
?
currency
.
symbol
.
slice
(
0
,
4
)
+
...
@@ -345,13 +346,13 @@ export default function CurrencyInputPanel({
...
@@ -345,13 +346,13 @@ export default function CurrencyInputPanel({
</
StyledTokenName
>
</
StyledTokenName
>
)
}
)
}
</
RowFixed
>
</
RowFixed
>
{
onCurrencySelect
&&
<
StyledDropDown
selected=
{
!!
currency
}
phase0Flag=
{
phase0
FlagEnabled
}
/>
}
{
onCurrencySelect
&&
<
StyledDropDown
selected=
{
!!
currency
}
redesignFlag=
{
redesign
FlagEnabled
}
/>
}
</
Aligner
>
</
Aligner
>
</
InputCurrencySelect
>
</
InputCurrencySelect
>
</
InputRow
>
</
InputRow
>
{
phase0
FlagEnabled
&&
!
currency
&&
(
{
redesign
FlagEnabled
&&
!
currency
&&
(
<
NoBalanceState
>
<
NoBalanceState
>
<
FiatRow
phase0Flag=
{
phase0
FlagEnabled
}
>
<
FiatRow
redesignFlag=
{
redesign
FlagEnabled
}
>
<
RowBetween
>
<
RowBetween
>
<
NoBalanceDash
>
-
</
NoBalanceDash
>
<
NoBalanceDash
>
-
</
NoBalanceDash
>
<
NoBalanceDash
>
-
</
NoBalanceDash
>
<
NoBalanceDash
>
-
</
NoBalanceDash
>
...
@@ -360,7 +361,7 @@ export default function CurrencyInputPanel({
...
@@ -360,7 +361,7 @@ export default function CurrencyInputPanel({
</
NoBalanceState
>
</
NoBalanceState
>
)
}
)
}
{
!
hideInput
&&
!
hideBalance
&&
currency
&&
(
{
!
hideInput
&&
!
hideBalance
&&
currency
&&
(
<
FiatRow
phase0Flag=
{
phase0
FlagEnabled
}
>
<
FiatRow
redesignFlag=
{
redesign
FlagEnabled
}
>
<
RowBetween
>
<
RowBetween
>
<
LoadingOpacityContainer
$loading=
{
loading
}
>
<
LoadingOpacityContainer
$loading=
{
loading
}
>
<
FiatValue
fiatValue=
{
fiatValue
}
priceImpact=
{
priceImpact
}
/>
<
FiatValue
fiatValue=
{
fiatValue
}
priceImpact=
{
priceImpact
}
/>
...
@@ -388,7 +389,7 @@ export default function CurrencyInputPanel({
...
@@ -388,7 +389,7 @@ export default function CurrencyInputPanel({
name=
{
EventName
.
SWAP_MAX_TOKEN_AMOUNT_SELECTED
}
name=
{
EventName
.
SWAP_MAX_TOKEN_AMOUNT_SELECTED
}
element=
{
ElementName
.
MAX_TOKEN_AMOUNT_BUTTON
}
element=
{
ElementName
.
MAX_TOKEN_AMOUNT_BUTTON
}
>
>
<
StyledBalanceMax
onClick=
{
onMax
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
StyledBalanceMax
onClick=
{
onMax
}
redesignFlag=
{
redesign
FlagEnabled
}
>
<
Trans
>
Max
</
Trans
>
<
Trans
>
Max
</
Trans
>
</
StyledBalanceMax
>
</
StyledBalanceMax
>
</
TraceEvent
>
</
TraceEvent
>
...
...
src/components/FeatureFlagModal/FeatureFlagModal.tsx
View file @
09380698
import
{
FeatureFlag
,
useUpdateFlag
}
from
'
featureFlags
'
import
{
FeatureFlag
,
useUpdateFlag
}
from
'
featureFlags
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
ExploreVariant
,
useExploreFlag
}
from
'
featureFlags/flags/explore
'
import
{
Phase1Variant
,
usePhase1Flag
}
from
'
featureFlags/flags/phase1
'
import
{
Phase1Variant
,
usePhase1Flag
}
from
'
featureFlags/flags/phase1
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
ReactNode
}
from
'
react
'
import
{
ReactNode
}
from
'
react
'
import
{
X
}
from
'
react-feather
'
import
{
X
}
from
'
react-feather
'
import
{
useModalIsOpen
,
useToggleFeatureFlags
}
from
'
state/application/hooks
'
import
{
useModalIsOpen
,
useToggleFeatureFlags
}
from
'
state/application/hooks
'
...
@@ -100,18 +101,30 @@ export default function FeatureFlagModal() {
...
@@ -100,18 +101,30 @@ export default function FeatureFlagModal() {
</
CloseButton
>
</
CloseButton
>
</
Header
>
</
Header
>
<
FeatureFlagOption
variants=
{
Object
.
values
(
Phase0Variant
)
}
value=
{
usePhase0Flag
()
}
featureFlag=
{
FeatureFlag
.
phase0
}
label=
"All Phase 0 changes (redesign, explore, header)."
/>
<
FeatureFlagOption
<
FeatureFlagOption
variants=
{
Object
.
values
(
Phase1Variant
)
}
variants=
{
Object
.
values
(
Phase1Variant
)
}
value=
{
usePhase1Flag
()
}
value=
{
usePhase1Flag
()
}
featureFlag=
{
FeatureFlag
.
phase1
}
featureFlag=
{
FeatureFlag
.
phase1
}
label=
"All Phase 1 changes (nft features)."
label=
"All Phase 1 changes (nft features)."
/>
/>
<
FeatureFlagOption
variants=
{
Object
.
values
(
RedesignVariant
)
}
value=
{
useRedesignFlag
()
}
featureFlag=
{
FeatureFlag
.
redesign
}
label=
"Redesign"
/>
<
FeatureFlagOption
variants=
{
Object
.
values
(
ExploreVariant
)
}
value=
{
useExploreFlag
()
}
featureFlag=
{
FeatureFlag
.
explore
}
label=
"Explore"
/>
<
FeatureFlagOption
variants=
{
Object
.
values
(
ExploreVariant
)
}
value=
{
useExploreFlag
()
}
featureFlag=
{
FeatureFlag
.
explore
}
label=
"Token Safety"
/>
</
Modal
>
</
Modal
>
)
)
}
}
src/components/Header/index.tsx
View file @
09380698
...
@@ -3,7 +3,7 @@ import useScrollPosition from '@react-hook/window-scroll'
...
@@ -3,7 +3,7 @@ import useScrollPosition from '@react-hook/window-scroll'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
getChainInfoOrDefault
}
from
'
constants/chainInfo
'
import
{
getChainInfoOrDefault
}
from
'
constants/chainInfo
'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
ExploreVariant
,
useExploreFlag
}
from
'
featureFlags/flags/explore
'
import
useTheme
from
'
hooks/useTheme
'
import
useTheme
from
'
hooks/useTheme
'
import
{
darken
}
from
'
polished
'
import
{
darken
}
from
'
polished
'
import
{
NavLink
,
useLocation
}
from
'
react-router-dom
'
import
{
NavLink
,
useLocation
}
from
'
react-router-dom
'
...
@@ -245,7 +245,7 @@ const StyledExternalLink = styled(ExternalLink)`
...
@@ -245,7 +245,7 @@ const StyledExternalLink = styled(ExternalLink)`
`
`
export
default
function
Header
()
{
export
default
function
Header
()
{
const
phase0Flag
=
usePhase0
Flag
()
const
exploreFlag
=
useExplore
Flag
()
const
{
account
,
chainId
}
=
useWeb3React
()
const
{
account
,
chainId
}
=
useWeb3React
()
...
@@ -292,7 +292,7 @@ export default function Header() {
...
@@ -292,7 +292,7 @@ export default function Header() {
<
StyledNavLink
id=
{
`swap-nav-link`
}
to=
{
'
/swap
'
}
>
<
StyledNavLink
id=
{
`swap-nav-link`
}
to=
{
'
/swap
'
}
>
<
Trans
>
Swap
</
Trans
>
<
Trans
>
Swap
</
Trans
>
</
StyledNavLink
>
</
StyledNavLink
>
{
phase0Flag
===
Phase0
Variant
.
Enabled
&&
(
{
exploreFlag
===
Explore
Variant
.
Enabled
&&
(
<
StyledNavLink
id=
{
`explore-nav-link`
}
to=
{
'
/explore
'
}
>
<
StyledNavLink
id=
{
`explore-nav-link`
}
to=
{
'
/explore
'
}
>
<
Trans
>
Explore
</
Trans
>
<
Trans
>
Explore
</
Trans
>
</
StyledNavLink
>
</
StyledNavLink
>
...
...
src/components/NumericalInput/index.tsx
View file @
09380698
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
React
from
'
react
'
import
React
from
'
react
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
{
escapeRegExp
}
from
'
../../utils
'
import
{
escapeRegExp
}
from
'
../../utils
'
const
StyledInput
=
styled
.
input
<
{
error
?:
boolean
;
fontSize
?:
string
;
align
?:
string
;
phase0
Flag
:
boolean
}
>
`
const
StyledInput
=
styled
.
input
<
{
error
?:
boolean
;
fontSize
?:
string
;
align
?:
string
;
redesign
Flag
:
boolean
}
>
`
color:
${({
error
,
theme
})
=>
(
error
?
theme
.
deprecated_red1
:
theme
.
deprecated_text1
)}
;
color:
${({
error
,
theme
})
=>
(
error
?
theme
.
deprecated_red1
:
theme
.
deprecated_text1
)}
;
width: 0;
width: 0;
position: relative;
position: relative;
font-weight:
${({
phase0Flag
})
=>
(
phase0
Flag
?
400
:
500
)}
;
font-weight:
${({
redesignFlag
})
=>
(
redesign
Flag
?
400
:
500
)}
;
outline: none;
outline: none;
border: none;
border: none;
flex: 1 1 auto;
flex: 1 1 auto;
background-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
none
:
theme
.
deprecated_bg1
)}
;
background-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
none
:
theme
.
deprecated_bg1
)}
;
font-size:
${({
fontSize
})
=>
fontSize
??
'
28px
'
};
font-size:
${({
fontSize
})
=>
fontSize
??
'
28px
'
};
text
-
align
:
$
{({
align
})
=>
align
&&
align
};
text
-
align
:
$
{({
align
})
=>
align
&&
align
};
white
-
space
:
nowrap
;
white
-
space
:
nowrap
;
...
@@ -36,7 +36,7 @@ const StyledInput = styled.input<{ error?: boolean; fontSize?: string; align?: s
...
@@ -36,7 +36,7 @@ const StyledInput = styled.input<{ error?: boolean; fontSize?: string; align?: s
}
}
::
placeholder
{
::
placeholder
{
color
:
$
{({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
textSecondary
:
theme
.
deprecated_text4
)}
;
color
:
$
{({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
textSecondary
:
theme
.
deprecated_text4
)}
;
}
}
`
`
...
@@ -56,8 +56,8 @@ export const Input = React.memo(function InnerInput({
...
@@ -56,8 +56,8 @@ export const Input = React.memo(function InnerInput({
align
?:
'
right
'
|
'
left
'
align
?:
'
right
'
|
'
left
'
prependSymbol
?:
string
|
undefined
prependSymbol
?:
string
|
undefined
}
&
Omit
<
React
.
HTMLProps
<
HTMLInputElement
>
,
'
ref
'
|
'
onChange
'
|
'
as
'
>
)
{
}
&
Omit
<
React
.
HTMLProps
<
HTMLInputElement
>
,
'
ref
'
|
'
onChange
'
|
'
as
'
>
)
{
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
enforcer
=
(
nextUserInput
:
string
)
=>
{
const
enforcer
=
(
nextUserInput
:
string
)
=>
{
if
(
nextUserInput
===
''
||
inputRegex
.
test
(
escapeRegExp
(
nextUserInput
)))
{
if
(
nextUserInput
===
''
||
inputRegex
.
test
(
escapeRegExp
(
nextUserInput
)))
{
onUserInput
(
nextUserInput
)
onUserInput
(
nextUserInput
)
...
@@ -68,7 +68,7 @@ export const Input = React.memo(function InnerInput({
...
@@ -68,7 +68,7 @@ export const Input = React.memo(function InnerInput({
<
StyledInput
<
StyledInput
{
...
rest
}
{
...
rest
}
value=
{
prependSymbol
&&
value
?
prependSymbol
+
value
:
value
}
value=
{
prependSymbol
&&
value
?
prependSymbol
+
value
:
value
}
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
onChange=
{
(
event
)
=>
{
onChange=
{
(
event
)
=>
{
if
(
prependSymbol
)
{
if
(
prependSymbol
)
{
const
value
=
event
.
target
.
value
const
value
=
event
.
target
.
value
...
@@ -91,7 +91,7 @@ export const Input = React.memo(function InnerInput({
...
@@ -91,7 +91,7 @@ export const Input = React.memo(function InnerInput({
// text-specific options
// text-specific options
type=
"text"
type=
"text"
pattern=
"^[0-9]*[.,]?[0-9]*$"
pattern=
"^[0-9]*[.,]?[0-9]*$"
placeholder=
{
placeholder
||
(
phase0
FlagEnabled
?
'
0
'
:
'
0.0
'
)
}
placeholder=
{
placeholder
||
(
redesign
FlagEnabled
?
'
0
'
:
'
0.0
'
)
}
minLength=
{
1
}
minLength=
{
1
}
maxLength=
{
79
}
maxLength=
{
79
}
spellCheck=
"false"
spellCheck=
"false"
...
...
src/components/QuestionHelper/index.tsx
View file @
09380698
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
ReactNode
,
useCallback
,
useState
}
from
'
react
'
import
{
ReactNode
,
useCallback
,
useState
}
from
'
react
'
import
{
HelpCircle
}
from
'
react-feather
'
import
{
HelpCircle
}
from
'
react-feather
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
Tooltip
from
'
../Tooltip
'
import
Tooltip
from
'
../Tooltip
'
const
QuestionWrapper
=
styled
.
div
<
{
phase0
Flag
:
boolean
}
>
`
const
QuestionWrapper
=
styled
.
div
<
{
redesign
Flag
:
boolean
}
>
`
display: flex;
display: flex;
align-items: center;
align-items: center;
justify-content: center;
justify-content: center;
...
@@ -18,8 +18,8 @@ const QuestionWrapper = styled.div<{ phase0Flag: boolean }>`
...
@@ -18,8 +18,8 @@ const QuestionWrapper = styled.div<{ phase0Flag: boolean }>`
cursor: default;
cursor: default;
border-radius: 36px;
border-radius: 36px;
font-size: 12px;
font-size: 12px;
border-radius:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
12px
'
}
;
border-radius:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
12px
'
}
;
color:
${({
theme
,
phase0Flag
})
=>
!
phase0
Flag
&&
theme
.
deprecated_text2
}
;
color:
${({
theme
,
redesignFlag
})
=>
!
redesign
Flag
&&
theme
.
deprecated_text2
}
;
:hover,
:hover,
:focus {
:focus {
...
@@ -27,12 +27,12 @@ const QuestionWrapper = styled.div<{ phase0Flag: boolean }>`
...
@@ -27,12 +27,12 @@ const QuestionWrapper = styled.div<{ phase0Flag: boolean }>`
}
}
`
`
const
QuestionMark
=
styled
.
span
<
{
phase0
Flag
?:
boolean
}
>
`
const
QuestionMark
=
styled
.
span
<
{
redesign
Flag
?:
boolean
}
>
`
font-size: 14px;
font-size: 14px;
margin-left:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
8px
'
}
;
margin-left:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
8px
'
}
;
align-items:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
center
'
}
;
align-items:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
center
'
}
;
color:
${({
theme
,
phase0Flag
})
=>
phase0
Flag
&&
theme
.
textSecondary
}
;
color:
${({
theme
,
redesignFlag
})
=>
redesign
Flag
&&
theme
.
textSecondary
}
;
margin-top:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
2.5px
'
}
;
margin-top:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
2.5px
'
}
;
`
`
export
default
function
QuestionHelper
({
text
}:
{
text
:
ReactNode
;
size
?:
number
})
{
export
default
function
QuestionHelper
({
text
}:
{
text
:
ReactNode
;
size
?:
number
})
{
...
@@ -40,14 +40,14 @@ export default function QuestionHelper({ text }: { text: ReactNode; size?: numbe
...
@@ -40,14 +40,14 @@ export default function QuestionHelper({ text }: { text: ReactNode; size?: numbe
const
open
=
useCallback
(()
=>
setShow
(
true
),
[
setShow
])
const
open
=
useCallback
(()
=>
setShow
(
true
),
[
setShow
])
const
close
=
useCallback
(()
=>
setShow
(
false
),
[
setShow
])
const
close
=
useCallback
(()
=>
setShow
(
false
),
[
setShow
])
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
return
(
return
(
<
span
style=
{
{
marginLeft
:
4
,
display
:
'
flex
'
,
alignItems
:
'
center
'
}
}
>
<
span
style=
{
{
marginLeft
:
4
,
display
:
'
flex
'
,
alignItems
:
'
center
'
}
}
>
<
Tooltip
text=
{
text
}
show=
{
show
}
>
<
Tooltip
text=
{
text
}
show=
{
show
}
>
<
QuestionWrapper
onClick=
{
open
}
onMouseEnter=
{
open
}
onMouseLeave=
{
close
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
QuestionWrapper
onClick=
{
open
}
onMouseEnter=
{
open
}
onMouseLeave=
{
close
}
redesignFlag=
{
redesign
FlagEnabled
}
>
<
QuestionMark
phase0Flag=
{
phase0
FlagEnabled
}
>
<
QuestionMark
redesignFlag=
{
redesign
FlagEnabled
}
>
{
phase0
FlagEnabled
?
<
HelpCircle
size=
{
16
}
></
HelpCircle
>
:
'
?
'
}
{
redesign
FlagEnabled
?
<
HelpCircle
size=
{
16
}
></
HelpCircle
>
:
'
?
'
}
</
QuestionMark
>
</
QuestionMark
>
</
QuestionWrapper
>
</
QuestionWrapper
>
</
Tooltip
>
</
Tooltip
>
...
...
src/components/SearchModal/CommonBases.tsx
View file @
09380698
...
@@ -6,7 +6,7 @@ import { AutoColumn } from 'components/Column'
...
@@ -6,7 +6,7 @@ import { AutoColumn } from 'components/Column'
import
CurrencyLogo
from
'
components/CurrencyLogo
'
import
CurrencyLogo
from
'
components/CurrencyLogo
'
import
{
AutoRow
}
from
'
components/Row
'
import
{
AutoRow
}
from
'
components/Row
'
import
{
COMMON_BASES
}
from
'
constants/routing
'
import
{
COMMON_BASES
}
from
'
constants/routing
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
useTokenInfoFromActiveList
}
from
'
hooks/useTokenInfoFromActiveList
'
import
{
useTokenInfoFromActiveList
}
from
'
hooks/useTokenInfoFromActiveList
'
import
{
Text
}
from
'
rebass
'
import
{
Text
}
from
'
rebass
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
...
@@ -18,17 +18,17 @@ const MobileWrapper = styled(AutoColumn)`
...
@@ -18,17 +18,17 @@ const MobileWrapper = styled(AutoColumn)`
`
}
;
`
}
;
`
`
const
BaseWrapper
=
styled
.
div
<
{
disable
?:
boolean
;
phase0
Flag
?:
boolean
}
>
`
const
BaseWrapper
=
styled
.
div
<
{
disable
?:
boolean
;
redesign
Flag
?:
boolean
}
>
`
border: 1px solid
border: 1px solid
${({
theme
,
disable
,
phase0
Flag
})
=>
${({
theme
,
disable
,
redesign
Flag
})
=>
disable
disable
?
phase0
Flag
?
redesign
Flag
?
theme
.
accentAction
?
theme
.
accentAction
:
theme
.
none
:
theme
.
none
:
phase0
Flag
:
redesign
Flag
?
theme
.
backgroundOutline
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg3
}
;
:
theme
.
deprecated_bg3
}
;
border-radius:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
16px
'
:
'
10px
'
)}
;
border-radius:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
16px
'
:
'
10px
'
)}
;
display: flex;
display: flex;
padding: 6px;
padding: 6px;
padding-right: 12px;
padding-right: 12px;
...
@@ -36,14 +36,15 @@ const BaseWrapper = styled.div<{ disable?: boolean; phase0Flag?: boolean }>`
...
@@ -36,14 +36,15 @@ const BaseWrapper = styled.div<{ disable?: boolean; phase0Flag?: boolean }>`
align-items: center;
align-items: center;
:hover {
:hover {
cursor:
${({
disable
})
=>
!
disable
&&
'
pointer
'
}
;
cursor:
${({
disable
})
=>
!
disable
&&
'
pointer
'
}
;
background-color:
${({
theme
,
disable
,
phase0
Flag
})
=>
background-color:
${({
theme
,
disable
,
redesign
Flag
})
=>
(
phase0
Flag
&&
theme
.
hoverDefault
)
||
(
!
disable
&&
theme
.
deprecated_bg2
)}
;
(
redesign
Flag
&&
theme
.
hoverDefault
)
||
(
!
disable
&&
theme
.
deprecated_bg2
)}
;
}
}
color:
${({
theme
,
disable
,
phase0Flag
})
=>
disable
&&
(
phase0Flag
?
theme
.
accentAction
:
theme
.
deprecated_text3
)}
;
color:
${({
theme
,
disable
,
redesignFlag
})
=>
background-color:
${({
theme
,
disable
,
phase0Flag
})
=>
disable
&&
(
redesignFlag
?
theme
.
accentAction
:
theme
.
deprecated_text3
)}
;
disable
&&
(
phase0Flag
?
theme
.
accentActionSoft
:
theme
.
deprecated_bg3
)}
;
background-color:
${({
theme
,
disable
,
redesignFlag
})
=>
filter:
${({
disable
,
phase0Flag
})
=>
disable
&&
!
phase0Flag
&&
'
grayscale(1)
'
}
;
disable
&&
(
redesignFlag
?
theme
.
accentActionSoft
:
theme
.
deprecated_bg3
)}
;
filter:
${({
disable
,
redesignFlag
})
=>
disable
&&
!
redesignFlag
&&
'
grayscale(1)
'
}
;
`
`
const
formatAnalyticsEventProperties
=
(
currency
:
Currency
,
searchQuery
:
string
,
isAddressSearch
:
string
|
false
)
=>
({
const
formatAnalyticsEventProperties
=
(
currency
:
Currency
,
searchQuery
:
string
,
isAddressSearch
:
string
|
false
)
=>
({
...
@@ -72,8 +73,8 @@ export default function CommonBases({
...
@@ -72,8 +73,8 @@ export default function CommonBases({
isAddressSearch
:
string
|
false
isAddressSearch
:
string
|
false
})
{
})
{
const
bases
=
typeof
chainId
!==
'
undefined
'
?
COMMON_BASES
[
chainId
]
??
[]
:
[]
const
bases
=
typeof
chainId
!==
'
undefined
'
?
COMMON_BASES
[
chainId
]
??
[]
:
[]
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
return
bases
.
length
>
0
?
(
return
bases
.
length
>
0
?
(
<
MobileWrapper
gap=
"md"
>
<
MobileWrapper
gap=
"md"
>
...
@@ -94,7 +95,7 @@ export default function CommonBases({
...
@@ -94,7 +95,7 @@ export default function CommonBases({
onKeyPress=
{
(
e
)
=>
!
isSelected
&&
e
.
key
===
'
Enter
'
&&
onSelect
(
currency
)
}
onKeyPress=
{
(
e
)
=>
!
isSelected
&&
e
.
key
===
'
Enter
'
&&
onSelect
(
currency
)
}
onClick=
{
()
=>
!
isSelected
&&
onSelect
(
currency
)
}
onClick=
{
()
=>
!
isSelected
&&
onSelect
(
currency
)
}
disable=
{
isSelected
}
disable=
{
isSelected
}
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
key=
{
currencyId
(
currency
)
}
key=
{
currencyId
(
currency
)
}
>
>
<
CurrencyLogoFromList
currency=
{
currency
}
/>
<
CurrencyLogoFromList
currency=
{
currency
}
/>
...
...
src/components/SearchModal/CurrencyList/index.tsx
View file @
09380698
...
@@ -7,7 +7,8 @@ import { LightGreyCard } from 'components/Card'
...
@@ -7,7 +7,8 @@ import { LightGreyCard } from 'components/Card'
import
QuestionHelper
from
'
components/QuestionHelper
'
import
QuestionHelper
from
'
components/QuestionHelper
'
import
TokenSafetyIcon
from
'
components/TokenSafety/TokenSafetyIcon
'
import
TokenSafetyIcon
from
'
components/TokenSafety/TokenSafetyIcon
'
import
{
checkWarning
}
from
'
constants/tokenSafety
'
import
{
checkWarning
}
from
'
constants/tokenSafety
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
TokenSafetyVariant
,
useTokenSafetyFlag
}
from
'
featureFlags/flags/tokenSafety
'
import
useTheme
from
'
hooks/useTheme
'
import
useTheme
from
'
hooks/useTheme
'
import
{
CSSProperties
,
MutableRefObject
,
useCallback
,
useMemo
}
from
'
react
'
import
{
CSSProperties
,
MutableRefObject
,
useCallback
,
useMemo
}
from
'
react
'
import
{
Check
}
from
'
react-feather
'
import
{
Check
}
from
'
react-feather
'
...
@@ -142,8 +143,9 @@ function CurrencyRow({
...
@@ -142,8 +143,9 @@ function CurrencyRow({
const
customAdded
=
useIsUserAddedToken
(
currency
)
const
customAdded
=
useIsUserAddedToken
(
currency
)
const
balance
=
useCurrencyBalance
(
account
??
undefined
,
currency
)
const
balance
=
useCurrencyBalance
(
account
??
undefined
,
currency
)
const
warning
=
currency
.
isNative
?
null
:
checkWarning
(
currency
.
address
)
const
warning
=
currency
.
isNative
?
null
:
checkWarning
(
currency
.
address
)
const
phase0Flag
=
usePhase0Flag
()
const
redesignFlag
=
useRedesignFlag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
RedesignVariant
.
Enabled
const
tokenSafetyFlag
=
useTokenSafetyFlag
()
// only show add or remove buttons if not on selected list
// only show add or remove buttons if not on selected list
return
(
return
(
...
@@ -155,7 +157,7 @@ function CurrencyRow({
...
@@ -155,7 +157,7 @@ function CurrencyRow({
>
>
<
MenuItem
<
MenuItem
tabIndex=
{
0
}
tabIndex=
{
0
}
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
style=
{
style
}
style=
{
style
}
className=
{
`token-item-${key}`
}
className=
{
`token-item-${key}`
}
onKeyPress=
{
(
e
)
=>
(
!
isSelected
&&
e
.
key
===
'
Enter
'
?
onSelect
()
:
null
)
}
onKeyPress=
{
(
e
)
=>
(
!
isSelected
&&
e
.
key
===
'
Enter
'
?
onSelect
()
:
null
)
}
...
@@ -170,7 +172,7 @@ function CurrencyRow({
...
@@ -170,7 +172,7 @@ function CurrencyRow({
<
Row
>
<
Row
>
<
CurrencyName
title=
{
currency
.
name
}
>
{
currency
.
name
}
</
CurrencyName
>
<
CurrencyName
title=
{
currency
.
name
}
>
{
currency
.
name
}
</
CurrencyName
>
{
phase0Flag
Enabled
&&
<
TokenSafetyIcon
warning=
{
warning
}
/>
}
{
tokenSafetyFlag
===
TokenSafetyVariant
.
Enabled
&&
<
TokenSafetyIcon
warning=
{
warning
}
/>
}
</
Row
>
</
Row
>
<
ThemedText
.
DeprecatedDarkGray
ml=
"0px"
fontSize=
{
'
12px
'
}
fontWeight=
{
300
}
>
<
ThemedText
.
DeprecatedDarkGray
ml=
"0px"
fontSize=
{
'
12px
'
}
fontWeight=
{
300
}
>
{
!
currency
.
isNative
&&
!
isOnSelectedList
&&
customAdded
?
(
{
!
currency
.
isNative
&&
!
isOnSelectedList
&&
customAdded
?
(
...
@@ -188,10 +190,10 @@ function CurrencyRow({
...
@@ -188,10 +190,10 @@ function CurrencyRow({
{
showCurrencyAmount
?
(
{
showCurrencyAmount
?
(
<
RowFixed
style=
{
{
justifySelf
:
'
flex-end
'
}
}
>
<
RowFixed
style=
{
{
justifySelf
:
'
flex-end
'
}
}
>
{
balance
?
<
Balance
balance=
{
balance
}
/>
:
account
?
<
Loader
/>
:
null
}
{
balance
?
<
Balance
balance=
{
balance
}
/>
:
account
?
<
Loader
/>
:
null
}
{
phase0
FlagEnabled
&&
isSelected
&&
<
CheckIcon
/>
}
{
redesign
FlagEnabled
&&
isSelected
&&
<
CheckIcon
/>
}
</
RowFixed
>
</
RowFixed
>
)
:
(
)
:
(
phase0
FlagEnabled
&&
redesign
FlagEnabled
&&
isSelected
&&
(
isSelected
&&
(
<
RowFixed
style=
{
{
justifySelf
:
'
flex-end
'
}
}
>
<
RowFixed
style=
{
{
justifySelf
:
'
flex-end
'
}
}
>
<
CheckIcon
/>
<
CheckIcon
/>
...
...
src/components/SearchModal/CurrencySearch.tsx
View file @
09380698
...
@@ -5,7 +5,7 @@ import { useWeb3React } from '@web3-react/core'
...
@@ -5,7 +5,7 @@ import { useWeb3React } from '@web3-react/core'
import
{
EventName
,
ModalName
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
EventName
,
ModalName
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
Trace
}
from
'
components/AmplitudeAnalytics/Trace
'
import
{
Trace
}
from
'
components/AmplitudeAnalytics/Trace
'
import
{
sendEvent
}
from
'
components/analytics
'
import
{
sendEvent
}
from
'
components/analytics
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
useDebounce
from
'
hooks/useDebounce
'
import
useDebounce
from
'
hooks/useDebounce
'
import
{
useOnClickOutside
}
from
'
hooks/useOnClickOutside
'
import
{
useOnClickOutside
}
from
'
hooks/useOnClickOutside
'
import
useTheme
from
'
hooks/useTheme
'
import
useTheme
from
'
hooks/useTheme
'
...
@@ -31,8 +31,8 @@ import CurrencyList from './CurrencyList'
...
@@ -31,8 +31,8 @@ import CurrencyList from './CurrencyList'
import
ImportRow
from
'
./ImportRow
'
import
ImportRow
from
'
./ImportRow
'
import
{
PaddedColumn
,
SearchInput
,
Separator
}
from
'
./styleds
'
import
{
PaddedColumn
,
SearchInput
,
Separator
}
from
'
./styleds
'
const
ContentWrapper
=
styled
(
Column
)
<
{
phase0
Flag
?:
boolean
}
>
`
const
ContentWrapper
=
styled
(
Column
)
<
{
redesign
Flag
?:
boolean
}
>
`
background-color:
${({
theme
,
phase0Flag
})
=>
phase0
Flag
&&
theme
.
backgroundSurface
}
;
background-color:
${({
theme
,
redesignFlag
})
=>
redesign
Flag
&&
theme
.
backgroundSurface
}
;
width: 100%;
width: 100%;
flex: 1 1;
flex: 1 1;
position: relative;
position: relative;
...
@@ -75,8 +75,8 @@ export function CurrencySearch({
...
@@ -75,8 +75,8 @@ export function CurrencySearch({
showImportView
,
showImportView
,
setImportToken
,
setImportToken
,
}:
CurrencySearchProps
)
{
}:
CurrencySearchProps
)
{
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
{
chainId
}
=
useWeb3React
()
const
{
chainId
}
=
useWeb3React
()
const
theme
=
useTheme
()
const
theme
=
useTheme
()
...
@@ -196,7 +196,7 @@ export function CurrencySearch({
...
@@ -196,7 +196,7 @@ export function CurrencySearch({
},
[])
},
[])
return
(
return
(
<
ContentWrapper
phase0Flag=
{
phase0
FlagEnabled
}
>
<
ContentWrapper
redesignFlag=
{
redesign
FlagEnabled
}
>
<
Trace
name=
{
EventName
.
TOKEN_SELECTOR_OPENED
}
modal=
{
ModalName
.
TOKEN_SELECTOR
}
shouldLogImpression
>
<
Trace
name=
{
EventName
.
TOKEN_SELECTOR_OPENED
}
modal=
{
ModalName
.
TOKEN_SELECTOR
}
shouldLogImpression
>
<
PaddedColumn
gap=
"16px"
>
<
PaddedColumn
gap=
"16px"
>
<
RowBetween
>
<
RowBetween
>
...
@@ -211,7 +211,7 @@ export function CurrencySearch({
...
@@ -211,7 +211,7 @@ export function CurrencySearch({
id=
"token-search-input"
id=
"token-search-input"
placeholder=
{
t
`Search name or paste address`
}
placeholder=
{
t
`Search name or paste address`
}
autoComplete=
"off"
autoComplete=
"off"
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
value=
{
searchQuery
}
value=
{
searchQuery
}
ref=
{
inputRef
as
RefObject
<
HTMLInputElement
>
}
ref=
{
inputRef
as
RefObject
<
HTMLInputElement
>
}
onChange=
{
handleInput
}
onChange=
{
handleInput
}
...
@@ -228,7 +228,7 @@ export function CurrencySearch({
...
@@ -228,7 +228,7 @@ export function CurrencySearch({
/>
/>
)
}
)
}
</
PaddedColumn
>
</
PaddedColumn
>
<
Separator
phase0Flag=
{
phase0
FlagEnabled
}
/>
<
Separator
redesignFlag=
{
redesign
FlagEnabled
}
/>
{
searchToken
&&
!
searchTokenIsAdded
?
(
{
searchToken
&&
!
searchTokenIsAdded
?
(
<
Column
style=
{
{
padding
:
'
20px 0
'
,
height
:
'
100%
'
}
}
>
<
Column
style=
{
{
padding
:
'
20px 0
'
,
height
:
'
100%
'
}
}
>
<
ImportRow
token=
{
searchToken
}
showImportView=
{
showImportView
}
setImportToken=
{
setImportToken
}
/>
<
ImportRow
token=
{
searchToken
}
showImportView=
{
showImportView
}
setImportToken=
{
setImportToken
}
/>
...
@@ -262,7 +262,7 @@ export function CurrencySearch({
...
@@ -262,7 +262,7 @@ export function CurrencySearch({
</
ThemedText
.
DeprecatedMain
>
</
ThemedText
.
DeprecatedMain
>
</
Column
>
</
Column
>
)
}
)
}
{
!
phase0
FlagEnabled
&&
(
{
!
redesign
FlagEnabled
&&
(
<
Footer
>
<
Footer
>
<
Row
justify=
"center"
>
<
Row
justify=
"center"
>
<
ButtonText
<
ButtonText
...
...
src/components/SearchModal/CurrencySearchModal.tsx
View file @
09380698
import
{
Currency
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
TokenList
}
from
'
@uniswap/token-lists
'
import
{
TokenList
}
from
'
@uniswap/token-lists
'
import
TokenSafety
from
'
components/TokenSafety
'
import
TokenSafety
from
'
components/TokenSafety
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
TokenSafetyVariant
,
useTokenSafetyFlag
}
from
'
featureFlags/flags/tokenSafety
'
import
usePrevious
from
'
hooks/usePrevious
'
import
usePrevious
from
'
hooks/usePrevious
'
import
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
import
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
import
{
WrappedTokenInfo
}
from
'
state/lists/wrappedTokenInfo
'
import
{
WrappedTokenInfo
}
from
'
state/lists/wrappedTokenInfo
'
...
@@ -75,7 +75,7 @@ export default function CurrencySearchModal({
...
@@ -75,7 +75,7 @@ export default function CurrencySearchModal({
[
setModalView
,
prevView
]
[
setModalView
,
prevView
]
)
)
const
phase0Flag
=
usePhase0
Flag
()
const
tokenSafetyFlag
=
useTokenSafety
Flag
()
// change min height if not searching
// change min height if not searching
let
minHeight
:
number
|
undefined
=
80
let
minHeight
:
number
|
undefined
=
80
...
@@ -102,7 +102,7 @@ export default function CurrencySearchModal({
...
@@ -102,7 +102,7 @@ export default function CurrencySearchModal({
if
(
importToken
)
{
if
(
importToken
)
{
minHeight
=
undefined
minHeight
=
undefined
content
=
content
=
phase0Flag
===
Phase0
Variant
.
Enabled
?
(
tokenSafetyFlag
===
TokenSafety
Variant
.
Enabled
?
(
<
TokenSafety
<
TokenSafety
tokenAddress=
{
importToken
.
address
}
tokenAddress=
{
importToken
.
address
}
onContinue=
{
()
=>
handleCurrencySelect
(
importToken
)
}
onContinue=
{
()
=>
handleCurrencySelect
(
importToken
)
}
...
...
src/components/SearchModal/styleds.tsx
View file @
09380698
...
@@ -21,7 +21,7 @@ export const PaddedColumn = styled(AutoColumn)`
...
@@ -21,7 +21,7 @@ export const PaddedColumn = styled(AutoColumn)`
padding: 20px;
padding: 20px;
`
`
export
const
MenuItem
=
styled
(
RowBetween
)
<
{
phase0
Flag
?:
boolean
}
>
`
export
const
MenuItem
=
styled
(
RowBetween
)
<
{
redesign
Flag
?:
boolean
}
>
`
padding: 4px 20px;
padding: 4px 20px;
height: 56px;
height: 56px;
display: grid;
display: grid;
...
@@ -30,47 +30,47 @@ export const MenuItem = styled(RowBetween)<{ phase0Flag?: boolean }>`
...
@@ -30,47 +30,47 @@ export const MenuItem = styled(RowBetween)<{ phase0Flag?: boolean }>`
cursor:
${({
disabled
})
=>
!
disabled
&&
'
pointer
'
}
;
cursor:
${({
disabled
})
=>
!
disabled
&&
'
pointer
'
}
;
pointer-events:
${({
disabled
})
=>
disabled
&&
'
none
'
}
;
pointer-events:
${({
disabled
})
=>
disabled
&&
'
none
'
}
;
:hover {
:hover {
background-color:
${({
theme
,
disabled
,
phase0
Flag
})
=>
background-color:
${({
theme
,
disabled
,
redesign
Flag
})
=>
(
phase0
Flag
&&
theme
.
hoverDefault
)
||
(
!
disabled
&&
theme
.
deprecated_bg2
)}
;
(
redesign
Flag
&&
theme
.
hoverDefault
)
||
(
!
disabled
&&
theme
.
deprecated_bg2
)}
;
}
}
opacity:
${({
disabled
,
selected
})
=>
(
disabled
||
selected
?
0.5
:
1
)}
;
opacity:
${({
disabled
,
selected
})
=>
(
disabled
||
selected
?
0.5
:
1
)}
;
`
`
export
const
SearchInput
=
styled
.
input
<
{
phase0
Flag
?:
boolean
}
>
`
export
const
SearchInput
=
styled
.
input
<
{
redesign
Flag
?:
boolean
}
>
`
position: relative;
position: relative;
display: flex;
display: flex;
padding: 16px;
padding: 16px;
height:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
40px
'
}
;
height:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
40px
'
}
;
align-items: center;
align-items: center;
width: 100%;
width: 100%;
white-space: nowrap;
white-space: nowrap;
background: none;
background: none;
background-color:
${({
theme
,
phase0Flag
})
=>
phase0
Flag
&&
theme
.
backgroundModule
}
;
background-color:
${({
theme
,
redesignFlag
})
=>
redesign
Flag
&&
theme
.
backgroundModule
}
;
border: none;
border: none;
outline: none;
outline: none;
border-radius:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
12px
'
:
'
20px
'
)}
;
border-radius:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
12px
'
:
'
20px
'
)}
;
color:
${({
theme
})
=>
theme
.
deprecated_text1
}
;
color:
${({
theme
})
=>
theme
.
deprecated_text1
}
;
border-style: solid;
border-style: solid;
border: 1px solid
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg3
)}
;
border: 1px solid
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg3
)}
;
-webkit-appearance: none;
-webkit-appearance: none;
font-size:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
16px
'
:
'
18px
'
)}
;
font-size:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
16px
'
:
'
18px
'
)}
;
::placeholder {
::placeholder {
color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
textTertiary
:
theme
.
deprecated_text3
)}
;
color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
textTertiary
:
theme
.
deprecated_text3
)}
;
font-size:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
16px
'
}
;
font-size:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
16px
'
}
;
}
}
transition: border 100ms;
transition: border 100ms;
:focus {
:focus {
border: 1px solid
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
'
transparent
'
:
theme
.
deprecated_primary1
)}
;
border: 1px solid
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
'
transparent
'
:
theme
.
deprecated_primary1
)}
;
background-color:
${({
theme
,
phase0Flag
})
=>
phase0
Flag
&&
theme
.
accentActionSoft
}
;
background-color:
${({
theme
,
redesignFlag
})
=>
redesign
Flag
&&
theme
.
accentActionSoft
}
;
outline: none;
outline: none;
}
}
`
`
export
const
Separator
=
styled
.
div
<
{
phase0
Flag
?:
boolean
}
>
`
export
const
Separator
=
styled
.
div
<
{
redesign
Flag
?:
boolean
}
>
`
width: 100%;
width: 100%;
height: 1px;
height: 1px;
background-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg2
)}
;
background-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg2
)}
;
`
`
export
const
SeparatorDark
=
styled
.
div
`
export
const
SeparatorDark
=
styled
.
div
`
...
...
src/components/Settings/index.tsx
View file @
09380698
...
@@ -3,7 +3,7 @@ import { t, Trans } from '@lingui/macro'
...
@@ -3,7 +3,7 @@ import { t, Trans } from '@lingui/macro'
import
{
Percent
}
from
'
@uniswap/sdk-core
'
import
{
Percent
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
sendEvent
}
from
'
components/analytics
'
import
{
sendEvent
}
from
'
components/analytics
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
isSupportedChainId
}
from
'
lib/hooks/routing/clientSideSmartOrderRouter
'
import
{
isSupportedChainId
}
from
'
lib/hooks/routing/clientSideSmartOrderRouter
'
import
{
useContext
,
useRef
,
useState
}
from
'
react
'
import
{
useContext
,
useRef
,
useState
}
from
'
react
'
import
{
Settings
,
X
}
from
'
react-feather
'
import
{
Settings
,
X
}
from
'
react-feather
'
...
@@ -23,16 +23,16 @@ import { RowBetween, RowFixed } from '../Row'
...
@@ -23,16 +23,16 @@ import { RowBetween, RowFixed } from '../Row'
import
Toggle
from
'
../Toggle
'
import
Toggle
from
'
../Toggle
'
import
TransactionSettings
from
'
../TransactionSettings
'
import
TransactionSettings
from
'
../TransactionSettings
'
const
StyledMenuIcon
=
styled
(
Settings
)
<
{
phase0
Flag
:
boolean
}
>
`
const
StyledMenuIcon
=
styled
(
Settings
)
<
{
redesign
Flag
:
boolean
}
>
`
height: 20px;
height: 20px;
width: 20px;
width: 20px;
> * {
> * {
stroke:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
textSecondary
:
theme
.
deprecated_text1
)}
;
stroke:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
textSecondary
:
theme
.
deprecated_text1
)}
;
}
}
`
`
const
StyledCloseIcon
=
styled
(
X
)
<
{
phase0
Flag
:
boolean
}
>
`
const
StyledCloseIcon
=
styled
(
X
)
<
{
redesign
Flag
:
boolean
}
>
`
height: 20px;
height: 20px;
width: 20px;
width: 20px;
:hover {
:hover {
...
@@ -40,7 +40,7 @@ const StyledCloseIcon = styled(X)<{ phase0Flag: boolean }>`
...
@@ -40,7 +40,7 @@ const StyledCloseIcon = styled(X)<{ phase0Flag: boolean }>`
}
}
> * {
> * {
stroke:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
textSecondary
:
theme
.
deprecated_text1
)}
;
stroke:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
textSecondary
:
theme
.
deprecated_text1
)}
;
}
}
`
`
...
@@ -83,10 +83,10 @@ const StyledMenu = styled.div`
...
@@ -83,10 +83,10 @@ const StyledMenu = styled.div`
text-align: left;
text-align: left;
`
`
const
MenuFlyout
=
styled
.
span
<
{
phase0
Flag
:
boolean
}
>
`
const
MenuFlyout
=
styled
.
span
<
{
redesign
Flag
:
boolean
}
>
`
min-width: 20.125rem;
min-width: 20.125rem;
background-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg2
)}
;
background-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg2
)}
;
border: 1px solid
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg3
)}
;
border: 1px solid
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg3
)}
;
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),
0px 24px 32px rgba(0, 0, 0, 0.01);
0px 24px 32px rgba(0, 0, 0, 0.01);
border-radius: 12px;
border-radius: 12px;
...
@@ -97,7 +97,7 @@ const MenuFlyout = styled.span<{ phase0Flag: boolean }>`
...
@@ -97,7 +97,7 @@ const MenuFlyout = styled.span<{ phase0Flag: boolean }>`
top: 2rem;
top: 2rem;
right: 0rem;
right: 0rem;
z-index: 100;
z-index: 100;
color:
${({
theme
,
phase0Flag
})
=>
phase0
Flag
&&
theme
.
textPrimary
}
;
color:
${({
theme
,
redesignFlag
})
=>
redesign
Flag
&&
theme
.
textPrimary
}
;
${({
theme
})
=>
theme
.
mediaWidth
.
upToMedium
`
${({
theme
})
=>
theme
.
mediaWidth
.
upToMedium
`
min-width: 18.125rem;
min-width: 18.125rem;
...
@@ -123,8 +123,8 @@ const ModalContentWrapper = styled.div`
...
@@ -123,8 +123,8 @@ const ModalContentWrapper = styled.div`
export
default
function
SettingsTab
({
placeholderSlippage
}:
{
placeholderSlippage
:
Percent
})
{
export
default
function
SettingsTab
({
placeholderSlippage
}:
{
placeholderSlippage
:
Percent
})
{
const
{
chainId
}
=
useWeb3React
()
const
{
chainId
}
=
useWeb3React
()
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
node
=
useRef
<
HTMLDivElement
>
()
const
node
=
useRef
<
HTMLDivElement
>
()
const
open
=
useModalIsOpen
(
ApplicationModal
.
SETTINGS
)
const
open
=
useModalIsOpen
(
ApplicationModal
.
SETTINGS
)
...
@@ -152,7 +152,7 @@ export default function SettingsTab({ placeholderSlippage }: { placeholderSlippa
...
@@ -152,7 +152,7 @@ export default function SettingsTab({ placeholderSlippage }: { placeholderSlippa
<
Text
fontWeight=
{
500
}
fontSize=
{
20
}
>
<
Text
fontWeight=
{
500
}
fontSize=
{
20
}
>
<
Trans
>
Are you sure?
</
Trans
>
<
Trans
>
Are you sure?
</
Trans
>
</
Text
>
</
Text
>
<
StyledCloseIcon
onClick=
{
()
=>
setShowConfirmation
(
false
)
}
phase0Flag=
{
phase0
FlagEnabled
}
/>
<
StyledCloseIcon
onClick=
{
()
=>
setShowConfirmation
(
false
)
}
redesignFlag=
{
redesign
FlagEnabled
}
/>
</
RowBetween
>
</
RowBetween
>
<
Break
/>
<
Break
/>
<
AutoColumn
gap=
"lg"
style=
{
{
padding
:
'
0 2rem
'
}
}
>
<
AutoColumn
gap=
"lg"
style=
{
{
padding
:
'
0 2rem
'
}
}
>
...
@@ -190,7 +190,7 @@ export default function SettingsTab({ placeholderSlippage }: { placeholderSlippa
...
@@ -190,7 +190,7 @@ export default function SettingsTab({ placeholderSlippage }: { placeholderSlippa
id=
"open-settings-dialog-button"
id=
"open-settings-dialog-button"
aria
-
label=
{
t
`Transaction Settings`
}
aria
-
label=
{
t
`Transaction Settings`
}
>
>
<
StyledMenuIcon
phase0Flag=
{
phase0
FlagEnabled
}
/>
<
StyledMenuIcon
redesignFlag=
{
redesign
FlagEnabled
}
/>
{
expertMode
?
(
{
expertMode
?
(
<
EmojiWrapper
>
<
EmojiWrapper
>
<
span
role=
"img"
aria
-
label=
"wizard-icon"
>
<
span
role=
"img"
aria
-
label=
"wizard-icon"
>
...
@@ -200,10 +200,10 @@ export default function SettingsTab({ placeholderSlippage }: { placeholderSlippa
...
@@ -200,10 +200,10 @@ export default function SettingsTab({ placeholderSlippage }: { placeholderSlippa
)
:
null
}
)
:
null
}
</
StyledMenuButton
>
</
StyledMenuButton
>
{
open
&&
(
{
open
&&
(
<
MenuFlyout
phase0Flag=
{
phase0
FlagEnabled
}
>
<
MenuFlyout
redesignFlag=
{
redesign
FlagEnabled
}
>
<
AutoColumn
gap=
"md"
style=
{
{
padding
:
'
1rem
'
}
}
>
<
AutoColumn
gap=
"md"
style=
{
{
padding
:
'
1rem
'
}
}
>
<
Text
fontWeight=
{
600
}
fontSize=
{
14
}
>
<
Text
fontWeight=
{
600
}
fontSize=
{
14
}
>
<
Trans
>
{
phase0
FlagEnabled
?
'
Settings
'
:
'
Transaction Settings
'
}
</
Trans
>
<
Trans
>
{
redesign
FlagEnabled
?
'
Settings
'
:
'
Transaction Settings
'
}
</
Trans
>
</
Text
>
</
Text
>
<
TransactionSettings
placeholderSlippage=
{
placeholderSlippage
}
/>
<
TransactionSettings
placeholderSlippage=
{
placeholderSlippage
}
/>
<
Text
fontWeight=
{
600
}
fontSize=
{
14
}
>
<
Text
fontWeight=
{
600
}
fontSize=
{
14
}
>
...
...
src/components/Toggle/index.tsx
View file @
09380698
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
darken
}
from
'
polished
'
import
{
darken
}
from
'
polished
'
import
{
useState
}
from
'
react
'
import
{
useState
}
from
'
react
'
import
styled
,
{
keyframes
}
from
'
styled-components/macro
'
import
styled
,
{
keyframes
}
from
'
styled-components/macro
'
const
Wrapper
=
styled
.
button
<
{
isActive
?:
boolean
;
activeElement
?:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
Wrapper
=
styled
.
button
<
{
isActive
?:
boolean
;
activeElement
?:
boolean
;
redesign
Flag
:
boolean
}
>
`
align-items: center;
align-items: center;
background:
${({
isActive
,
theme
,
phase0
Flag
})
=>
background:
${({
isActive
,
theme
,
redesign
Flag
})
=>
phase0
Flag
&&
isActive
?
theme
.
accentActionSoft
:
theme
.
deprecated_bg1
}
;
redesign
Flag
&&
isActive
?
theme
.
accentActionSoft
:
theme
.
deprecated_bg1
}
;
border: none;
border: none;
border-radius: 20px;
border-radius: 20px;
cursor: pointer;
cursor: pointer;
...
@@ -73,8 +73,8 @@ interface ToggleProps {
...
@@ -73,8 +73,8 @@ interface ToggleProps {
export
default
function
Toggle
({
id
,
bgColor
,
isActive
,
toggle
}:
ToggleProps
)
{
export
default
function
Toggle
({
id
,
bgColor
,
isActive
,
toggle
}:
ToggleProps
)
{
const
[
isInitialToggleLoad
,
setIsInitialToggleLoad
]
=
useState
(
true
)
const
[
isInitialToggleLoad
,
setIsInitialToggleLoad
]
=
useState
(
true
)
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
switchToggle
=
()
=>
{
const
switchToggle
=
()
=>
{
toggle
()
toggle
()
...
@@ -82,7 +82,7 @@ export default function Toggle({ id, bgColor, isActive, toggle }: ToggleProps) {
...
@@ -82,7 +82,7 @@ export default function Toggle({ id, bgColor, isActive, toggle }: ToggleProps) {
}
}
return
(
return
(
<
Wrapper
id=
{
id
}
isActive=
{
isActive
}
onClick=
{
switchToggle
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
Wrapper
id=
{
id
}
isActive=
{
isActive
}
onClick=
{
switchToggle
}
redesignFlag=
{
redesign
FlagEnabled
}
>
<
ToggleElement
isActive=
{
isActive
}
bgColor=
{
bgColor
}
isInitialToggleLoad=
{
isInitialToggleLoad
}
/>
<
ToggleElement
isActive=
{
isActive
}
bgColor=
{
bgColor
}
isInitialToggleLoad=
{
isInitialToggleLoad
}
/>
</
Wrapper
>
</
Wrapper
>
)
)
...
...
src/components/TransactionSettings/index.tsx
View file @
09380698
...
@@ -3,7 +3,7 @@ import { Percent } from '@uniswap/sdk-core'
...
@@ -3,7 +3,7 @@ import { Percent } from '@uniswap/sdk-core'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
L2_CHAIN_IDS
}
from
'
constants/chains
'
import
{
L2_CHAIN_IDS
}
from
'
constants/chains
'
import
{
DEFAULT_DEADLINE_FROM_NOW
}
from
'
constants/misc
'
import
{
DEFAULT_DEADLINE_FROM_NOW
}
from
'
constants/misc
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
ms
from
'
ms.macro
'
import
ms
from
'
ms.macro
'
import
{
darken
}
from
'
polished
'
import
{
darken
}
from
'
polished
'
import
{
useContext
,
useState
}
from
'
react
'
import
{
useContext
,
useState
}
from
'
react
'
...
@@ -42,9 +42,9 @@ const FancyButton = styled.button`
...
@@ -42,9 +42,9 @@ const FancyButton = styled.button`
}
}
`
`
const
Option
=
styled
(
FancyButton
)
<
{
active
:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
Option
=
styled
(
FancyButton
)
<
{
active
:
boolean
;
redesign
Flag
:
boolean
}
>
`
margin-right: 8px;
margin-right: 8px;
border-radius:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
12px
'
}
;
border-radius:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
12px
'
}
;
:hover {
:hover {
cursor: pointer;
cursor: pointer;
}
}
...
@@ -52,10 +52,10 @@ const Option = styled(FancyButton)<{ active: boolean; phase0Flag: boolean }>`
...
@@ -52,10 +52,10 @@ const Option = styled(FancyButton)<{ active: boolean; phase0Flag: boolean }>`
color:
${({
active
,
theme
})
=>
(
active
?
theme
.
deprecated_white
:
theme
.
deprecated_text1
)}
;
color:
${({
active
,
theme
})
=>
(
active
?
theme
.
deprecated_white
:
theme
.
deprecated_text1
)}
;
`
`
const
Input
=
styled
.
input
<
{
phase0
Flag
:
boolean
}
>
`
const
Input
=
styled
.
input
<
{
redesign
Flag
:
boolean
}
>
`
background:
${({
theme
})
=>
theme
.
deprecated_bg1
}
;
background:
${({
theme
})
=>
theme
.
deprecated_bg1
}
;
font-size: 16px;
font-size: 16px;
border-radius:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
12px
'
}
;
border-radius:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
12px
'
}
;
width: auto;
width: auto;
outline: none;
outline: none;
&::-webkit-outer-spin-button,
&::-webkit-outer-spin-button,
...
@@ -66,11 +66,11 @@ const Input = styled.input<{ phase0Flag: boolean }>`
...
@@ -66,11 +66,11 @@ const Input = styled.input<{ phase0Flag: boolean }>`
text-align: right;
text-align: right;
`
`
const
OptionCustom
=
styled
(
FancyButton
)
<
{
active
?:
boolean
;
warning
?:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
OptionCustom
=
styled
(
FancyButton
)
<
{
active
?:
boolean
;
warning
?:
boolean
;
redesign
Flag
:
boolean
}
>
`
height: 2rem;
height: 2rem;
position: relative;
position: relative;
padding: 0 0.75rem;
padding: 0 0.75rem;
border-radius:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
12px
'
}
;
border-radius:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
12px
'
}
;
flex: 1;
flex: 1;
border:
${({
theme
,
active
,
warning
})
=>
border:
${({
theme
,
active
,
warning
})
=>
active
active
...
@@ -105,8 +105,8 @@ const THREE_DAYS_IN_SECONDS = ms`3 days` / 1000
...
@@ -105,8 +105,8 @@ const THREE_DAYS_IN_SECONDS = ms`3 days` / 1000
export
default
function
TransactionSettings
({
placeholderSlippage
}:
TransactionSettingsProps
)
{
export
default
function
TransactionSettings
({
placeholderSlippage
}:
TransactionSettingsProps
)
{
const
{
chainId
}
=
useWeb3React
()
const
{
chainId
}
=
useWeb3React
()
const
theme
=
useContext
(
ThemeContext
)
const
theme
=
useContext
(
ThemeContext
)
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
userSlippageTolerance
=
useUserSlippageTolerance
()
const
userSlippageTolerance
=
useUserSlippageTolerance
()
const
setUserSlippageTolerance
=
useSetUserSlippageTolerance
()
const
setUserSlippageTolerance
=
useSetUserSlippageTolerance
()
...
@@ -182,7 +182,7 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
...
@@ -182,7 +182,7 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
</
RowFixed
>
</
RowFixed
>
<
RowBetween
>
<
RowBetween
>
<
Option
<
Option
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
parseSlippageInput
(
''
)
parseSlippageInput
(
''
)
}
}
}
}
...
@@ -191,7 +191,7 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
...
@@ -191,7 +191,7 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
<
Trans
>
Auto
</
Trans
>
<
Trans
>
Auto
</
Trans
>
</
Option
>
</
Option
>
<
OptionCustom
<
OptionCustom
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
active=
{
userSlippageTolerance
!==
'
auto
'
}
active=
{
userSlippageTolerance
!==
'
auto
'
}
warning=
{
!!
slippageError
}
warning=
{
!!
slippageError
}
tabIndex=
{
-
1
}
tabIndex=
{
-
1
}
...
@@ -205,7 +205,7 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
...
@@ -205,7 +205,7 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
</
SlippageEmojiContainer
>
</
SlippageEmojiContainer
>
)
:
null
}
)
:
null
}
<
Input
<
Input
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
placeholder=
{
placeholderSlippage
.
toFixed
(
2
)
}
placeholder=
{
placeholderSlippage
.
toFixed
(
2
)
}
value=
{
value=
{
slippageInput
.
length
>
0
slippageInput
.
length
>
0
...
@@ -259,10 +259,10 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
...
@@ -259,10 +259,10 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
style=
{
{
width
:
'
80px
'
}
}
style=
{
{
width
:
'
80px
'
}
}
warning=
{
!!
deadlineError
}
warning=
{
!!
deadlineError
}
tabIndex=
{
-
1
}
tabIndex=
{
-
1
}
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
>
>
<
Input
<
Input
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
placeholder=
{
(
DEFAULT_DEADLINE_FROM_NOW
/
60
).
toString
()
}
placeholder=
{
(
DEFAULT_DEADLINE_FROM_NOW
/
60
).
toString
()
}
value=
{
value=
{
deadlineInput
.
length
>
0
deadlineInput
.
length
>
0
...
...
src/components/swap/AdvancedSwapDetails.tsx
View file @
09380698
...
@@ -4,7 +4,7 @@ import { useWeb3React } from '@web3-react/core'
...
@@ -4,7 +4,7 @@ import { useWeb3React } from '@web3-react/core'
import
Card
from
'
components/Card
'
import
Card
from
'
components/Card
'
import
{
LoadingRows
}
from
'
components/Loader/styled
'
import
{
LoadingRows
}
from
'
components/Loader/styled
'
import
{
SUPPORTED_GAS_ESTIMATE_CHAIN_IDS
}
from
'
constants/chains
'
import
{
SUPPORTED_GAS_ESTIMATE_CHAIN_IDS
}
from
'
constants/chains
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
useNativeCurrency
from
'
lib/hooks/useNativeCurrency
'
import
useNativeCurrency
from
'
lib/hooks/useNativeCurrency
'
import
{
useContext
,
useMemo
}
from
'
react
'
import
{
useContext
,
useMemo
}
from
'
react
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
...
@@ -55,8 +55,8 @@ export function AdvancedSwapDetails({
...
@@ -55,8 +55,8 @@ export function AdvancedSwapDetails({
const
theme
=
useContext
(
ThemeContext
)
const
theme
=
useContext
(
ThemeContext
)
const
{
chainId
}
=
useWeb3React
()
const
{
chainId
}
=
useWeb3React
()
const
nativeCurrency
=
useNativeCurrency
()
const
nativeCurrency
=
useNativeCurrency
()
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
{
expectedOutputAmount
,
priceImpact
}
=
useMemo
(()
=>
{
const
{
expectedOutputAmount
,
priceImpact
}
=
useMemo
(()
=>
{
return
{
return
{
...
@@ -109,7 +109,7 @@ export function AdvancedSwapDetails({
...
@@ -109,7 +109,7 @@ export function AdvancedSwapDetails({
</
ThemedText
.
DeprecatedBlack
>
</
ThemedText
.
DeprecatedBlack
>
</
TextWithLoadingPlaceholder
>
</
TextWithLoadingPlaceholder
>
</
RowBetween
>
</
RowBetween
>
<
Separator
phase0Flag=
{
phase0
FlagEnabled
}
/>
<
Separator
redesignFlag=
{
redesign
FlagEnabled
}
/>
<
RowBetween
>
<
RowBetween
>
<
RowFixed
style=
{
{
marginRight
:
'
20px
'
}
}
>
<
RowFixed
style=
{
{
marginRight
:
'
20px
'
}
}
>
<
MouseoverTooltip
<
MouseoverTooltip
...
...
src/components/swap/SwapDetailsDropdown.tsx
View file @
09380698
...
@@ -10,7 +10,7 @@ import { LoadingOpacityContainer } from 'components/Loader/styled'
...
@@ -10,7 +10,7 @@ import { LoadingOpacityContainer } from 'components/Loader/styled'
import
Row
,
{
RowBetween
,
RowFixed
}
from
'
components/Row
'
import
Row
,
{
RowBetween
,
RowFixed
}
from
'
components/Row
'
import
{
MouseoverTooltipContent
}
from
'
components/Tooltip
'
import
{
MouseoverTooltipContent
}
from
'
components/Tooltip
'
import
{
SUPPORTED_GAS_ESTIMATE_CHAIN_IDS
}
from
'
constants/chains
'
import
{
SUPPORTED_GAS_ESTIMATE_CHAIN_IDS
}
from
'
constants/chains
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
useState
}
from
'
react
'
import
{
useState
}
from
'
react
'
import
{
ChevronDown
,
Info
}
from
'
react-feather
'
import
{
ChevronDown
,
Info
}
from
'
react-feather
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
...
@@ -35,20 +35,20 @@ const StyledInfoIcon = styled(Info)`
...
@@ -35,20 +35,20 @@ const StyledInfoIcon = styled(Info)`
color:
${({
theme
})
=>
theme
.
deprecated_text3
}
;
color:
${({
theme
})
=>
theme
.
deprecated_text3
}
;
`
`
const
StyledCard
=
styled
(
OutlineCard
)
<
{
phase0
Flag
:
boolean
}
>
`
const
StyledCard
=
styled
(
OutlineCard
)
<
{
redesign
Flag
:
boolean
}
>
`
padding: 12px;
padding: 12px;
border: 1px solid
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg3
)}
;
border: 1px solid
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg3
)}
;
`
`
const
StyledHeaderRow
=
styled
(
RowBetween
)
<
{
disabled
:
boolean
;
open
:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
StyledHeaderRow
=
styled
(
RowBetween
)
<
{
disabled
:
boolean
;
open
:
boolean
;
redesign
Flag
:
boolean
}
>
`
padding:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
8px 0px 0px 0px
'
:
'
4px 8px
'
)}
;
padding:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
8px 0px 0px 0px
'
:
'
4px 8px
'
)}
;
background-color:
${({
open
,
theme
,
phase0Flag
})
=>
(
open
&&
!
phase0
Flag
?
theme
.
deprecated_bg1
:
theme
.
none
)}
;
background-color:
${({
open
,
theme
,
redesignFlag
})
=>
(
open
&&
!
redesign
Flag
?
theme
.
deprecated_bg1
:
theme
.
none
)}
;
align-items: center;
align-items: center;
border-top: 1px solid
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundOutline
:
theme
.
none
)}
;
border-top: 1px solid
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundOutline
:
theme
.
none
)}
;
margin-top:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
8px
'
}
;
margin-top:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
8px
'
}
;
cursor:
${({
disabled
})
=>
(
disabled
?
'
initial
'
:
'
pointer
'
)}
;
cursor:
${({
disabled
})
=>
(
disabled
?
'
initial
'
:
'
pointer
'
)}
;
min-height: 40px;
min-height: 40px;
border-radius:
${({
phase0Flag
})
=>
!
phase0
Flag
&&
'
12px
'
}
;
border-radius:
${({
redesignFlag
})
=>
!
redesign
Flag
&&
'
12px
'
}
;
`
`
const
RotatingArrow
=
styled
(
ChevronDown
)
<
{
open
?:
boolean
}
>
`
const
RotatingArrow
=
styled
(
ChevronDown
)
<
{
open
?:
boolean
}
>
`
...
@@ -128,8 +128,8 @@ export default function SwapDetailsDropdown({
...
@@ -128,8 +128,8 @@ export default function SwapDetailsDropdown({
const
theme
=
useTheme
()
const
theme
=
useTheme
()
const
{
chainId
}
=
useWeb3React
()
const
{
chainId
}
=
useWeb3React
()
const
[
showDetails
,
setShowDetails
]
=
useState
(
false
)
const
[
showDetails
,
setShowDetails
]
=
useState
(
false
)
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
return
(
return
(
<
Wrapper
style=
{
{
marginTop
:
'
8px
'
}
}
>
<
Wrapper
style=
{
{
marginTop
:
'
8px
'
}
}
>
...
@@ -141,7 +141,7 @@ export default function SwapDetailsDropdown({
...
@@ -141,7 +141,7 @@ export default function SwapDetailsDropdown({
shouldLogImpression=
{
!
showDetails
}
shouldLogImpression=
{
!
showDetails
}
>
>
<
StyledHeaderRow
<
StyledHeaderRow
phase0Flag=
{
phase0
FlagEnabled
}
redesignFlag=
{
redesign
FlagEnabled
}
onClick=
{
()
=>
setShowDetails
(
!
showDetails
)
}
onClick=
{
()
=>
setShowDetails
(
!
showDetails
)
}
disabled=
{
!
trade
}
disabled=
{
!
trade
}
open=
{
showDetails
}
open=
{
showDetails
}
...
@@ -212,7 +212,7 @@ export default function SwapDetailsDropdown({
...
@@ -212,7 +212,7 @@ export default function SwapDetailsDropdown({
<
AnimatedDropdown
open=
{
showDetails
}
>
<
AnimatedDropdown
open=
{
showDetails
}
>
<
AutoColumn
gap=
{
'
8px
'
}
style=
{
{
padding
:
'
0
'
,
paddingBottom
:
'
8px
'
}
}
>
<
AutoColumn
gap=
{
'
8px
'
}
style=
{
{
padding
:
'
0
'
,
paddingBottom
:
'
8px
'
}
}
>
{
trade
?
(
{
trade
?
(
<
StyledCard
phase0Flag=
{
phase0
FlagEnabled
}
>
<
StyledCard
redesignFlag=
{
redesign
FlagEnabled
}
>
<
AdvancedSwapDetails
trade=
{
trade
}
allowedSlippage=
{
allowedSlippage
}
syncing=
{
syncing
}
/>
<
AdvancedSwapDetails
trade=
{
trade
}
allowedSlippage=
{
allowedSlippage
}
syncing=
{
syncing
}
/>
</
StyledCard
>
</
StyledCard
>
)
:
null
}
)
:
null
}
...
...
src/components/swap/SwapModalHeader.tsx
View file @
09380698
...
@@ -4,7 +4,7 @@ import { Price } from '@uniswap/sdk-core'
...
@@ -4,7 +4,7 @@ import { Price } from '@uniswap/sdk-core'
import
{
sendAnalyticsEvent
}
from
'
components/AmplitudeAnalytics
'
import
{
sendAnalyticsEvent
}
from
'
components/AmplitudeAnalytics
'
import
{
EventName
,
SWAP_PRICE_UPDATE_USER_RESPONSE
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
EventName
,
SWAP_PRICE_UPDATE_USER_RESPONSE
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
formatPercentInBasisPointsNumber
}
from
'
components/AmplitudeAnalytics/utils
'
import
{
formatPercentInBasisPointsNumber
}
from
'
components/AmplitudeAnalytics/utils
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
useContext
,
useEffect
,
useState
}
from
'
react
'
import
{
useContext
,
useEffect
,
useState
}
from
'
react
'
import
{
AlertTriangle
,
ArrowDown
}
from
'
react-feather
'
import
{
AlertTriangle
,
ArrowDown
}
from
'
react-feather
'
import
{
Text
}
from
'
rebass
'
import
{
Text
}
from
'
rebass
'
...
@@ -25,11 +25,11 @@ import TradePrice from '../swap/TradePrice'
...
@@ -25,11 +25,11 @@ import TradePrice from '../swap/TradePrice'
import
{
AdvancedSwapDetails
}
from
'
./AdvancedSwapDetails
'
import
{
AdvancedSwapDetails
}
from
'
./AdvancedSwapDetails
'
import
{
SwapShowAcceptChanges
,
TruncatedText
}
from
'
./styleds
'
import
{
SwapShowAcceptChanges
,
TruncatedText
}
from
'
./styleds
'
const
ArrowWrapper
=
styled
.
div
<
{
phase0
Flag
:
boolean
}
>
`
const
ArrowWrapper
=
styled
.
div
<
{
redesign
Flag
:
boolean
}
>
`
padding: 4px;
padding: 4px;
border-radius: 12px;
border-radius: 12px;
height:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
40px
'
:
'
32px
'
)}
;
height:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
40px
'
:
'
32px
'
)}
;
width:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
40px
'
:
'
32px
'
)}
;
width:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
40px
'
:
'
32px
'
)}
;
position: relative;
position: relative;
margin-top: -18px;
margin-top: -18px;
margin-bottom: -18px;
margin-bottom: -18px;
...
@@ -37,9 +37,9 @@ const ArrowWrapper = styled.div<{ phase0Flag: boolean }>`
...
@@ -37,9 +37,9 @@ const ArrowWrapper = styled.div<{ phase0Flag: boolean }>`
display: flex;
display: flex;
justify-content: center;
justify-content: center;
align-items: center;
align-items: center;
background-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg1
)}
;
background-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg1
)}
;
border: 4px solid;
border: 4px solid;
border-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundModule
:
theme
.
deprecated_bg0
)}
;
border-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundModule
:
theme
.
deprecated_bg0
)}
;
z-index: 2;
z-index: 2;
`
`
...
@@ -85,8 +85,8 @@ export default function SwapModalHeader({
...
@@ -85,8 +85,8 @@ export default function SwapModalHeader({
onAcceptChanges
:
()
=>
void
onAcceptChanges
:
()
=>
void
})
{
})
{
const
theme
=
useContext
(
ThemeContext
)
const
theme
=
useContext
(
ThemeContext
)
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
[
showInverted
,
setShowInverted
]
=
useState
<
boolean
>
(
false
)
const
[
showInverted
,
setShowInverted
]
=
useState
<
boolean
>
(
false
)
const
[
lastExecutionPrice
,
setLastExecutionPrice
]
=
useState
(
trade
.
executionPrice
)
const
[
lastExecutionPrice
,
setLastExecutionPrice
]
=
useState
(
trade
.
executionPrice
)
...
@@ -137,8 +137,8 @@ export default function SwapModalHeader({
...
@@ -137,8 +137,8 @@ export default function SwapModalHeader({
</
RowBetween
>
</
RowBetween
>
</
AutoColumn
>
</
AutoColumn
>
</
LightCard
>
</
LightCard
>
<
ArrowWrapper
phase0Flag=
{
phase0
FlagEnabled
}
>
<
ArrowWrapper
redesignFlag=
{
redesign
FlagEnabled
}
>
<
ArrowDown
size=
"16"
color=
{
phase0
FlagEnabled
?
theme
.
textPrimary
:
theme
.
deprecated_text2
}
/>
<
ArrowDown
size=
"16"
color=
{
redesign
FlagEnabled
?
theme
.
textPrimary
:
theme
.
deprecated_text2
}
/>
</
ArrowWrapper
>
</
ArrowWrapper
>
<
LightCard
padding=
"0.75rem 1rem"
style=
{
{
marginBottom
:
'
0.25rem
'
}
}
>
<
LightCard
padding=
"0.75rem 1rem"
style=
{
{
marginBottom
:
'
0.25rem
'
}
}
>
<
AutoColumn
gap=
{
'
8px
'
}
>
<
AutoColumn
gap=
{
'
8px
'
}
>
...
...
src/components/swap/SwapRoute.tsx
View file @
09380698
...
@@ -12,7 +12,7 @@ import { LoadingRows } from 'components/Loader/styled'
...
@@ -12,7 +12,7 @@ import { LoadingRows } from 'components/Loader/styled'
import
RoutingDiagram
from
'
components/RoutingDiagram/RoutingDiagram
'
import
RoutingDiagram
from
'
components/RoutingDiagram/RoutingDiagram
'
import
{
AutoRow
,
RowBetween
}
from
'
components/Row
'
import
{
AutoRow
,
RowBetween
}
from
'
components/Row
'
import
{
SUPPORTED_GAS_ESTIMATE_CHAIN_IDS
}
from
'
constants/chains
'
import
{
SUPPORTED_GAS_ESTIMATE_CHAIN_IDS
}
from
'
constants/chains
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
useAutoRouterSupported
from
'
hooks/useAutoRouterSupported
'
import
useAutoRouterSupported
from
'
hooks/useAutoRouterSupported
'
import
{
memo
,
useState
}
from
'
react
'
import
{
memo
,
useState
}
from
'
react
'
import
{
Plus
}
from
'
react-feather
'
import
{
Plus
}
from
'
react-feather
'
...
@@ -23,12 +23,12 @@ import { Separator, ThemedText } from 'theme'
...
@@ -23,12 +23,12 @@ import { Separator, ThemedText } from 'theme'
import
{
AutoRouterLabel
,
AutoRouterLogo
}
from
'
./RouterLabel
'
import
{
AutoRouterLabel
,
AutoRouterLogo
}
from
'
./RouterLabel
'
const
Wrapper
=
styled
(
AutoColumn
)
<
{
darkMode
?:
boolean
;
fixedOpen
?:
boolean
;
phase0
Flag
:
boolean
}
>
`
const
Wrapper
=
styled
(
AutoColumn
)
<
{
darkMode
?:
boolean
;
fixedOpen
?:
boolean
;
redesign
Flag
:
boolean
}
>
`
padding:
${({
fixedOpen
})
=>
(
fixedOpen
?
'
12px
'
:
'
12px 8px 12px 12px
'
)}
;
padding:
${({
fixedOpen
})
=>
(
fixedOpen
?
'
12px
'
:
'
12px 8px 12px 12px
'
)}
;
border-radius: 16px;
border-radius: 16px;
border: 1px solid
border: 1px solid
${({
theme
,
fixedOpen
,
phase0
Flag
})
=>
${({
theme
,
fixedOpen
,
redesign
Flag
})
=>
fixedOpen
?
'
transparent
'
:
phase0
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg2
}
;
fixedOpen
?
'
transparent
'
:
redesign
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg2
}
;
cursor: pointer;
cursor: pointer;
`
`
...
@@ -56,8 +56,8 @@ export default memo(function SwapRoute({ trade, syncing, fixedOpen = false, ...r
...
@@ -56,8 +56,8 @@ export default memo(function SwapRoute({ trade, syncing, fixedOpen = false, ...r
const
routes
=
getTokenPath
(
trade
)
const
routes
=
getTokenPath
(
trade
)
const
[
open
,
setOpen
]
=
useState
(
false
)
const
[
open
,
setOpen
]
=
useState
(
false
)
const
{
chainId
}
=
useWeb3React
()
const
{
chainId
}
=
useWeb3React
()
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
[
darkMode
]
=
useDarkModeManager
()
const
[
darkMode
]
=
useDarkModeManager
()
...
@@ -68,7 +68,7 @@ export default memo(function SwapRoute({ trade, syncing, fixedOpen = false, ...r
...
@@ -68,7 +68,7 @@ export default memo(function SwapRoute({ trade, syncing, fixedOpen = false, ...r
:
undefined
:
undefined
return
(
return
(
<
Wrapper
{
...
rest
}
darkMode=
{
darkMode
}
fixedOpen=
{
fixedOpen
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
Wrapper
{
...
rest
}
darkMode=
{
darkMode
}
fixedOpen=
{
fixedOpen
}
redesignFlag=
{
redesign
FlagEnabled
}
>
<
TraceEvent
<
TraceEvent
events=
{
[
Event
.
onClick
]
}
events=
{
[
Event
.
onClick
]
}
name=
{
EventName
.
SWAP_AUTOROUTER_VISUALIZATION_EXPANDED
}
name=
{
EventName
.
SWAP_AUTOROUTER_VISUALIZATION_EXPANDED
}
...
...
src/components/swap/styleds.tsx
View file @
09380698
...
@@ -15,19 +15,19 @@ export const Wrapper = styled.div`
...
@@ -15,19 +15,19 @@ export const Wrapper = styled.div`
padding: 8px;
padding: 8px;
`
`
export
const
ArrowWrapper
=
styled
.
div
<
{
clickable
:
boolean
;
phase0
Flag
:
boolean
}
>
`
export
const
ArrowWrapper
=
styled
.
div
<
{
clickable
:
boolean
;
redesign
Flag
:
boolean
}
>
`
padding: 4px;
padding: 4px;
border-radius: 12px;
border-radius: 12px;
height:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
40px
'
:
'
32px
'
)}
;
height:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
40px
'
:
'
32px
'
)}
;
width:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
40px
'
:
'
32px
'
)}
;
width:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
40px
'
:
'
32px
'
)}
;
position: relative;
position: relative;
margin-top: -14px;
margin-top: -14px;
margin-bottom:
${({
phase0Flag
})
=>
(
phase0
Flag
?
'
-18px
'
:
'
-14px
'
)}
;
margin-bottom:
${({
redesignFlag
})
=>
(
redesign
Flag
?
'
-18px
'
:
'
-14px
'
)}
;
left: calc(50% - 16px);
left: calc(50% - 16px);
/* transform: rotate(90deg); */
/* transform: rotate(90deg); */
background-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg1
)}
;
background-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg1
)}
;
border: 4px solid;
border: 4px solid;
border-color:
${({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundModule
:
theme
.
deprecated_bg0
)}
;
border-color:
${({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundModule
:
theme
.
deprecated_bg0
)}
;
z-index: 2;
z-index: 2;
${({
clickable
})
=>
${({
clickable
})
=>
...
...
src/featureFlags/flags/explore.ts
0 → 100644
View file @
09380698
import
{
BaseVariant
,
FeatureFlag
,
useBaseFlag
}
from
'
../index
'
export
function
useExploreFlag
():
BaseVariant
{
return
useBaseFlag
(
FeatureFlag
.
explore
)
}
export
{
BaseVariant
as
ExploreVariant
}
src/featureFlags/flags/phase0.ts
deleted
100644 → 0
View file @
1d96961f
import
{
BaseVariant
,
useBaseFlag
}
from
'
../index
'
export
function
usePhase0Flag
():
BaseVariant
{
return
useBaseFlag
(
'
phase0
'
)
}
export
{
BaseVariant
as
Phase0Variant
}
src/featureFlags/flags/phase1.ts
View file @
09380698
import
{
BaseVariant
,
useBaseFlag
}
from
'
../index
'
import
{
BaseVariant
,
FeatureFlag
,
useBaseFlag
}
from
'
../index
'
export
function
usePhase1Flag
():
BaseVariant
{
export
function
usePhase1Flag
():
BaseVariant
{
return
useBaseFlag
(
'
phase1
'
)
return
useBaseFlag
(
FeatureFlag
.
phase1
)
}
}
export
{
BaseVariant
as
Phase1Variant
}
export
{
BaseVariant
as
Phase1Variant
}
src/featureFlags/flags/redesign.ts
0 → 100644
View file @
09380698
import
{
BaseVariant
,
FeatureFlag
,
useBaseFlag
}
from
'
../index
'
export
function
useRedesignFlag
():
BaseVariant
{
return
useBaseFlag
(
FeatureFlag
.
redesign
)
}
export
{
BaseVariant
as
RedesignVariant
}
src/featureFlags/flags/tokenSafety.ts
0 → 100644
View file @
09380698
import
{
BaseVariant
,
FeatureFlag
,
useBaseFlag
}
from
'
../index
'
export
function
useTokenSafetyFlag
():
BaseVariant
{
return
useBaseFlag
(
FeatureFlag
.
tokenSafety
)
}
export
{
BaseVariant
as
TokenSafetyVariant
}
src/featureFlags/index.tsx
View file @
09380698
...
@@ -54,8 +54,10 @@ export enum BaseVariant {
...
@@ -54,8 +54,10 @@ export enum BaseVariant {
}
}
export
enum
FeatureFlag
{
export
enum
FeatureFlag
{
phase0
=
'
phase0
'
,
explore
=
'
explore
'
,
phase1
=
'
phase1
'
,
phase1
=
'
phase1
'
,
redesign
=
'
redesign
'
,
tokenSafety
=
'
tokenSafety
'
,
}
}
export
function
useBaseFlag
(
flag
:
string
):
BaseVariant
{
export
function
useBaseFlag
(
flag
:
string
):
BaseVariant
{
...
...
src/pages/App.tsx
View file @
09380698
...
@@ -4,7 +4,7 @@ import { Trace } from 'components/AmplitudeAnalytics/Trace'
...
@@ -4,7 +4,7 @@ import { Trace } from 'components/AmplitudeAnalytics/Trace'
import
Loader
from
'
components/Loader
'
import
Loader
from
'
components/Loader
'
import
TopLevelModals
from
'
components/TopLevelModals
'
import
TopLevelModals
from
'
components/TopLevelModals
'
import
{
useFeatureFlagsIsLoaded
}
from
'
featureFlags
'
import
{
useFeatureFlagsIsLoaded
}
from
'
featureFlags
'
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
ExploreVariant
,
useExploreFlag
}
from
'
featureFlags/flags/explore
'
import
ApeModeQueryParamReader
from
'
hooks/useApeModeQueryParamReader
'
import
ApeModeQueryParamReader
from
'
hooks/useApeModeQueryParamReader
'
import
{
lazy
,
Suspense
,
useEffect
}
from
'
react
'
import
{
lazy
,
Suspense
,
useEffect
}
from
'
react
'
import
{
Navigate
,
Route
,
Routes
,
useLocation
}
from
'
react-router-dom
'
import
{
Navigate
,
Route
,
Routes
,
useLocation
}
from
'
react-router-dom
'
...
@@ -104,7 +104,7 @@ const LazyLoadSpinner = () => (
...
@@ -104,7 +104,7 @@ const LazyLoadSpinner = () => (
export
default
function
App
()
{
export
default
function
App
()
{
const
isLoaded
=
useFeatureFlagsIsLoaded
()
const
isLoaded
=
useFeatureFlagsIsLoaded
()
const
phase0Flag
=
usePhase0
Flag
()
const
exploreFlag
=
useExplore
Flag
()
const
{
pathname
}
=
useLocation
()
const
{
pathname
}
=
useLocation
()
const
currentPage
=
getCurrentPageFromLocation
(
pathname
)
const
currentPage
=
getCurrentPageFromLocation
(
pathname
)
...
@@ -150,7 +150,7 @@ export default function App() {
...
@@ -150,7 +150,7 @@ export default function App() {
<
Suspense
fallback=
{
<
Loader
/>
}
>
<
Suspense
fallback=
{
<
Loader
/>
}
>
{
isLoaded
?
(
{
isLoaded
?
(
<
Routes
>
<
Routes
>
{
phase0Flag
===
Phase0
Variant
.
Enabled
&&
(
{
exploreFlag
===
Explore
Variant
.
Enabled
&&
(
<>
<>
<
Route
path=
"/explore"
element=
{
<
Explore
/>
}
/>
<
Route
path=
"/explore"
element=
{
<
Explore
/>
}
/>
<
Route
<
Route
...
...
src/pages/AppBody.tsx
View file @
09380698
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
React
from
'
react
'
import
React
from
'
react
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
{
Z_INDEX
}
from
'
theme
'
import
{
Z_INDEX
}
from
'
theme
'
export
const
BodyWrapper
=
styled
.
main
<
{
margin
?:
string
;
maxWidth
?:
string
;
phase0
Flag
?:
boolean
}
>
`
export
const
BodyWrapper
=
styled
.
main
<
{
margin
?:
string
;
maxWidth
?:
string
;
redesign
Flag
?:
boolean
}
>
`
position: relative;
position: relative;
margin-top:
${({
margin
})
=>
margin
??
'
0px
'
};
margin-top:
${({
margin
})
=>
margin
??
'
0px
'
};
max
-
width
:
$
{({
maxWidth
,
phase0Flag
})
=>
maxWidth
??
(
phase0
Flag
?
'
420px
'
:
'
480px
'
)};
max
-
width
:
$
{({
maxWidth
,
redesignFlag
})
=>
maxWidth
??
(
redesign
Flag
?
'
420px
'
:
'
480px
'
)};
width
:
100
%
;
width
:
100
%
;
background
:
$
{({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg0
)};
background
:
$
{({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundSurface
:
theme
.
deprecated_bg0
)};
border
-
radius
:
$
{({
phase0Flag
})
=>
(
phase0
Flag
?
'
16px
'
:
'
24px
'
)};
border
-
radius
:
$
{({
redesignFlag
})
=>
(
redesign
Flag
?
'
16px
'
:
'
24px
'
)};
border
:
1
px
solid
$
{({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundOutline
:
theme
.
none
)};
border
:
1
px
solid
$
{({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundOutline
:
theme
.
none
)};
margin
-
top
:
1
rem
;
margin
-
top
:
1
rem
;
margin
-
left
:
auto
;
margin
-
left
:
auto
;
margin
-
right
:
auto
;
margin
-
right
:
auto
;
z
-
index
:
$
{
Z_INDEX
.
deprecated_content
}
;
z
-
index
:
$
{
Z_INDEX
.
deprecated_content
}
;
font-feature-settings:
${({
phase0Flag
})
=>
phase0
Flag
&&
"
'ss02' off
"
}
;
font-feature-settings:
${({
redesignFlag
})
=>
redesign
Flag
&&
"
'ss02' off
"
}
;
box-shadow:
${({
phase0
Flag
})
=>
box-shadow:
${({
redesign
Flag
})
=>
!
phase0
Flag
&&
!
redesign
Flag
&&
'
0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 24px 32px rgba(0, 0, 0, 0.01)
'
}
;
'
0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 24px 32px rgba(0, 0, 0, 0.01)
'
}
;
`
`
...
@@ -25,10 +25,10 @@ export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string; pha
...
@@ -25,10 +25,10 @@ export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string; pha
* The styled container element that wraps the content of most pages and the tabs.
* The styled container element that wraps the content of most pages and the tabs.
*/
*/
export
default
function
AppBody
({
children
,
...
rest
}:
{
children
:
React
.
ReactNode
})
{
export
default
function
AppBody
({
children
,
...
rest
}:
{
children
:
React
.
ReactNode
})
{
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
return
(
return
(
<
BodyWrapper
{
...
rest
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
BodyWrapper
{
...
rest
}
redesignFlag=
{
redesign
FlagEnabled
}
>
{
children
}
{
children
}
</
BodyWrapper
>
</
BodyWrapper
>
)
)
...
...
src/pages/Swap/index.tsx
View file @
09380698
...
@@ -22,7 +22,7 @@ import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter
...
@@ -22,7 +22,7 @@ import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter
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
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
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
'
...
@@ -90,9 +90,9 @@ const ArrowUpWrapper = styled.div`
...
@@ -90,9 +90,9 @@ const ArrowUpWrapper = styled.div`
margin-left: 56%;
margin-left: 56%;
margin-top: -18%;
margin-top: -18%;
`
`
const
BottomWrapper
=
styled
.
div
<
{
phase0
Flag
:
boolean
}
>
`
const
BottomWrapper
=
styled
.
div
<
{
redesign
Flag
:
boolean
}
>
`
${({
phase0
Flag
})
=>
${({
redesign
Flag
})
=>
phase0
Flag
&&
redesign
Flag
&&
css
`
css
`
background-color:
${({
theme
})
=>
theme
.
backgroundModule
}
;
background-color:
${({
theme
})
=>
theme
.
backgroundModule
}
;
border-radius: 12px;
border-radius: 12px;
...
@@ -103,12 +103,12 @@ const BottomWrapper = styled.div<{ phase0Flag: boolean }>`
...
@@ -103,12 +103,12 @@ const BottomWrapper = styled.div<{ phase0Flag: boolean }>`
font-weight: 500;
font-weight: 500;
`
}
`
}
`
`
const
TopInputWrapper
=
styled
.
div
<
{
phase0
Flag
:
boolean
}
>
`
const
TopInputWrapper
=
styled
.
div
<
{
redesign
Flag
:
boolean
}
>
`
padding:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
0px 12px
'
}
;
padding:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
0px 12px
'
}
;
visibility:
${({
phase0Flag
})
=>
!
phase0
Flag
&&
'
none
'
}
;
visibility:
${({
redesignFlag
})
=>
!
redesign
Flag
&&
'
none
'
}
;
`
`
const
BottomInputWrapper
=
styled
.
div
<
{
phase0
Flag
:
boolean
}
>
`
const
BottomInputWrapper
=
styled
.
div
<
{
redesign
Flag
:
boolean
}
>
`
padding:
${({
phase0Flag
})
=>
phase0
Flag
&&
'
8px 0px
'
}
;
padding:
${({
redesignFlag
})
=>
redesign
Flag
&&
'
8px 0px
'
}
;
`
`
export
function
getIsValidSwapQuote
(
export
function
getIsValidSwapQuote
(
...
@@ -155,8 +155,8 @@ const formatSwapQuoteReceivedEventProperties = (
...
@@ -155,8 +155,8 @@ const formatSwapQuoteReceivedEventProperties = (
export
default
function
Swap
()
{
export
default
function
Swap
()
{
const
navigate
=
useNavigate
()
const
navigate
=
useNavigate
()
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0Flag
===
Phase0
Variant
.
Enabled
const
redesignFlagEnabled
=
redesignFlag
===
Redesign
Variant
.
Enabled
const
{
account
,
chainId
}
=
useWeb3React
()
const
{
account
,
chainId
}
=
useWeb3React
()
const
loadedUrlParams
=
useDefaultsFromURLSearch
()
const
loadedUrlParams
=
useDefaultsFromURLSearch
()
const
[
newSwapQuoteNeedsLogging
,
setNewSwapQuoteNeedsLogging
]
=
useState
(
true
)
const
[
newSwapQuoteNeedsLogging
,
setNewSwapQuoteNeedsLogging
]
=
useState
(
true
)
...
@@ -526,7 +526,7 @@ export default function Swap() {
...
@@ -526,7 +526,7 @@ export default function Swap() {
return
(
return
(
<
Trace
page=
{
PageName
.
SWAP_PAGE
}
shouldLogImpression
>
<
Trace
page=
{
PageName
.
SWAP_PAGE
}
shouldLogImpression
>
<>
<>
{
phase0Flag
===
Phase0
Variant
.
Enabled
?
(
{
redesignFlag
===
Redesign
Variant
.
Enabled
?
(
<
TokenSafetyModal
<
TokenSafetyModal
isOpen=
{
importTokensNotInDefault
.
length
>
0
&&
!
dismissTokenWarning
}
isOpen=
{
importTokensNotInDefault
.
length
>
0
&&
!
dismissTokenWarning
}
tokenAddress=
{
importTokensNotInDefault
[
0
]?.
address
}
tokenAddress=
{
importTokensNotInDefault
[
0
]?.
address
}
...
@@ -562,7 +562,7 @@ export default function Swap() {
...
@@ -562,7 +562,7 @@ export default function Swap() {
<
AutoColumn
gap=
{
'
0px
'
}
>
<
AutoColumn
gap=
{
'
0px
'
}
>
<
div
style=
{
{
display
:
'
relative
'
}
}
>
<
div
style=
{
{
display
:
'
relative
'
}
}
>
<
TopInputWrapper
phase0Flag=
{
phase0
FlagEnabled
}
>
<
TopInputWrapper
redesignFlag=
{
redesign
FlagEnabled
}
>
<
Trace
section=
{
SectionName
.
CURRENCY_INPUT_PANEL
}
>
<
Trace
section=
{
SectionName
.
CURRENCY_INPUT_PANEL
}
>
<
CurrencyInputPanel
<
CurrencyInputPanel
label=
{
label=
{
...
@@ -586,13 +586,13 @@ export default function Swap() {
...
@@ -586,13 +586,13 @@ export default function Swap() {
/>
/>
</
Trace
>
</
Trace
>
</
TopInputWrapper
>
</
TopInputWrapper
>
<
ArrowWrapper
clickable=
{
isSupportedChain
(
chainId
)
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
ArrowWrapper
clickable=
{
isSupportedChain
(
chainId
)
}
redesignFlag=
{
redesign
FlagEnabled
}
>
<
TraceEvent
<
TraceEvent
events=
{
[
Event
.
onClick
]
}
events=
{
[
Event
.
onClick
]
}
name=
{
EventName
.
SWAP_TOKENS_REVERSED
}
name=
{
EventName
.
SWAP_TOKENS_REVERSED
}
element=
{
ElementName
.
SWAP_TOKENS_REVERSE_ARROW_BUTTON
}
element=
{
ElementName
.
SWAP_TOKENS_REVERSE_ARROW_BUTTON
}
>
>
{
phase0
FlagEnabled
?
(
{
redesign
FlagEnabled
?
(
<
ArrowContainer
<
ArrowContainer
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setApprovalSubmitted
(
false
)
// reset 2 step UI for approvals
setApprovalSubmitted
(
false
)
// reset 2 step UI for approvals
...
@@ -624,10 +624,10 @@ export default function Swap() {
...
@@ -624,10 +624,10 @@ export default function Swap() {
</
TraceEvent
>
</
TraceEvent
>
</
ArrowWrapper
>
</
ArrowWrapper
>
</
div
>
</
div
>
<
BottomWrapper
phase0Flag=
{
phase0
FlagEnabled
}
>
<
BottomWrapper
redesignFlag=
{
redesign
FlagEnabled
}
>
{
phase0
FlagEnabled
&&
'
For
'
}
{
redesign
FlagEnabled
&&
'
For
'
}
<
AutoColumn
gap=
{
phase0
FlagEnabled
?
'
0px
'
:
'
8px
'
}
>
<
AutoColumn
gap=
{
redesign
FlagEnabled
?
'
0px
'
:
'
8px
'
}
>
<
BottomInputWrapper
phase0Flag=
{
phase0
FlagEnabled
}
>
<
BottomInputWrapper
redesignFlag=
{
redesign
FlagEnabled
}
>
<
Trace
section=
{
SectionName
.
CURRENCY_OUTPUT_PANEL
}
>
<
Trace
section=
{
SectionName
.
CURRENCY_OUTPUT_PANEL
}
>
<
CurrencyInputPanel
<
CurrencyInputPanel
value=
{
formattedAmounts
[
Field
.
OUTPUT
]
}
value=
{
formattedAmounts
[
Field
.
OUTPUT
]
}
...
@@ -655,7 +655,7 @@ export default function Swap() {
...
@@ -655,7 +655,7 @@ export default function Swap() {
{
recipient
!==
null
&&
!
showWrap
?
(
{
recipient
!==
null
&&
!
showWrap
?
(
<>
<>
<
AutoRow
justify=
"space-between"
style=
{
{
padding
:
'
0 1rem
'
}
}
>
<
AutoRow
justify=
"space-between"
style=
{
{
padding
:
'
0 1rem
'
}
}
>
<
ArrowWrapper
clickable=
{
false
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
ArrowWrapper
clickable=
{
false
}
redesignFlag=
{
redesign
FlagEnabled
}
>
<
ArrowDown
size=
"16"
color=
{
theme
.
deprecated_text2
}
/>
<
ArrowDown
size=
"16"
color=
{
theme
.
deprecated_text2
}
/>
</
ArrowWrapper
>
</
ArrowWrapper
>
<
LinkStyledButton
id=
"remove-recipient-button"
onClick=
{
()
=>
onChangeRecipient
(
null
)
}
>
<
LinkStyledButton
id=
"remove-recipient-button"
onClick=
{
()
=>
onChangeRecipient
(
null
)
}
>
...
@@ -691,7 +691,7 @@ export default function Swap() {
...
@@ -691,7 +691,7 @@ export default function Swap() {
properties=
{
{
received_swap_quote
:
getIsValidSwapQuote
(
trade
,
tradeState
,
swapInputError
)
}
}
properties=
{
{
received_swap_quote
:
getIsValidSwapQuote
(
trade
,
tradeState
,
swapInputError
)
}
}
element=
{
ElementName
.
CONNECT_WALLET_BUTTON
}
element=
{
ElementName
.
CONNECT_WALLET_BUTTON
}
>
>
<
ButtonLight
onClick=
{
toggleWalletModal
}
phase0Flag=
{
phase0
FlagEnabled
}
>
<
ButtonLight
onClick=
{
toggleWalletModal
}
redesignFlag=
{
redesign
FlagEnabled
}
>
<
Trans
>
Connect Wallet
</
Trans
>
<
Trans
>
Connect Wallet
</
Trans
>
</
ButtonLight
>
</
ButtonLight
>
</
TraceEvent
>
</
TraceEvent
>
...
...
src/theme/RadialGradientByChainUpdater.ts
View file @
09380698
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
BaseVariant
}
from
'
featureFlags
'
import
{
BaseVariant
}
from
'
featureFlags
'
import
{
use
Phase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
use
RedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
useEffect
}
from
'
react
'
import
{
useEffect
}
from
'
react
'
import
{
useDarkModeManager
}
from
'
state/user/hooks
'
import
{
useDarkModeManager
}
from
'
state/user/hooks
'
...
@@ -31,8 +31,8 @@ const setBackground = (newValues: TargetBackgroundStyles) =>
...
@@ -31,8 +31,8 @@ const setBackground = (newValues: TargetBackgroundStyles) =>
export
default
function
RadialGradientByChainUpdater
():
null
{
export
default
function
RadialGradientByChainUpdater
():
null
{
const
{
chainId
}
=
useWeb3React
()
const
{
chainId
}
=
useWeb3React
()
const
[
darkMode
]
=
useDarkModeManager
()
const
[
darkMode
]
=
useDarkModeManager
()
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
phase0FlagEnabled
=
phase0
Flag
===
BaseVariant
.
Enabled
const
redesignFlagEnabled
=
redesign
Flag
===
BaseVariant
.
Enabled
// manage background color
// manage background color
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
backgroundRadialGradientElement
)
{
if
(
!
backgroundRadialGradientElement
)
{
...
@@ -43,10 +43,10 @@ export default function RadialGradientByChainUpdater(): null {
...
@@ -43,10 +43,10 @@ export default function RadialGradientByChainUpdater(): null {
case
SupportedChainId
.
ARBITRUM_ONE
:
case
SupportedChainId
.
ARBITRUM_ONE
:
case
SupportedChainId
.
ARBITRUM_RINKEBY
:
case
SupportedChainId
.
ARBITRUM_RINKEBY
:
setBackground
(
backgroundResetStyles
)
setBackground
(
backgroundResetStyles
)
const
arbitrumLightGradient
=
phase0
FlagEnabled
const
arbitrumLightGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(205, 232, 251, 0.7) 0%, rgba(252, 243, 249, 0.6536) 49.48%, rgba(255, 255, 255, 0) 100%), #FFFFFF
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(205, 232, 251, 0.7) 0%, rgba(252, 243, 249, 0.6536) 49.48%, rgba(255, 255, 255, 0) 100%), #FFFFFF
'
:
'
radial-gradient(150% 100% at 50% 0%, #CDE8FB 0%, #FCF3F9 50%, #FFFFFF 100%)
'
:
'
radial-gradient(150% 100% at 50% 0%, #CDE8FB 0%, #FCF3F9 50%, #FFFFFF 100%)
'
const
arbitrumDarkGradient
=
phase0
FlagEnabled
const
arbitrumDarkGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(10, 41, 75, 0.7) 0%, rgba(34, 30, 48, 0.6536) 49.48%, rgba(31, 33, 40, 0) 100%), #0D0E0E
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(10, 41, 75, 0.7) 0%, rgba(34, 30, 48, 0.6536) 49.48%, rgba(31, 33, 40, 0) 100%), #0D0E0E
'
:
'
radial-gradient(150% 100% at 50% 0%, #0A294B 0%, #221E30 50%, #1F2128 100%)
'
:
'
radial-gradient(150% 100% at 50% 0%, #0A294B 0%, #221E30 50%, #1F2128 100%)
'
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
arbitrumDarkGradient
:
arbitrumLightGradient
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
arbitrumDarkGradient
:
arbitrumLightGradient
...
@@ -54,10 +54,10 @@ export default function RadialGradientByChainUpdater(): null {
...
@@ -54,10 +54,10 @@ export default function RadialGradientByChainUpdater(): null {
case
SupportedChainId
.
OPTIMISM
:
case
SupportedChainId
.
OPTIMISM
:
case
SupportedChainId
.
OPTIMISTIC_KOVAN
:
case
SupportedChainId
.
OPTIMISTIC_KOVAN
:
setBackground
(
backgroundResetStyles
)
setBackground
(
backgroundResetStyles
)
const
optimismLightGradient
=
phase0
FlagEnabled
const
optimismLightGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(255, 251, 242, 0.8) 0%, rgba(255, 244, 249, 0.6958) 50.52%, rgba(255, 255, 255, 0) 100%), #FFFFFF
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(255, 251, 242, 0.8) 0%, rgba(255, 244, 249, 0.6958) 50.52%, rgba(255, 255, 255, 0) 100%), #FFFFFF
'
:
'
radial-gradient(150% 100% at 50% 0%, #FFFBF2 2%, #FFF4F9 53%, #FFFFFF 100%)
'
:
'
radial-gradient(150% 100% at 50% 0%, #FFFBF2 2%, #FFF4F9 53%, #FFFFFF 100%)
'
const
optimismDarkGradient
=
phase0
FlagEnabled
const
optimismDarkGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(62, 46, 56, 0.8) 0%, rgba(44, 31, 45, 0.6958) 50.52%, rgba(31, 33, 40, 0) 100%), #0D0E0E
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(62, 46, 56, 0.8) 0%, rgba(44, 31, 45, 0.6958) 50.52%, rgba(31, 33, 40, 0) 100%), #0D0E0E
'
:
'
radial-gradient(150% 100% at 50% 0%, #3E2E38 2%, #2C1F2D 53%, #1F2128 100%)
'
:
'
radial-gradient(150% 100% at 50% 0%, #3E2E38 2%, #2C1F2D 53%, #1F2128 100%)
'
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
optimismDarkGradient
:
optimismLightGradient
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
optimismDarkGradient
:
optimismLightGradient
...
@@ -65,14 +65,14 @@ export default function RadialGradientByChainUpdater(): null {
...
@@ -65,14 +65,14 @@ export default function RadialGradientByChainUpdater(): null {
case
SupportedChainId
.
POLYGON
:
case
SupportedChainId
.
POLYGON
:
case
SupportedChainId
.
POLYGON_MUMBAI
:
case
SupportedChainId
.
POLYGON_MUMBAI
:
setBackground
(
backgroundResetStyles
)
setBackground
(
backgroundResetStyles
)
const
polygonLightGradient
=
phase0
FlagEnabled
const
polygonLightGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(130, 71, 229, 0.2) 0%, rgba(200, 168, 255, 0.05) 52.6%, rgba(0, 0, 0, 0) 100%), #FFFFFF
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(130, 71, 229, 0.2) 0%, rgba(200, 168, 255, 0.05) 52.6%, rgba(0, 0, 0, 0) 100%), #FFFFFF
'
:
'
radial-gradient(153.32% 100% at 47.26% 0%, rgba(130, 71, 229, 0.0864) 0%, rgba(0, 41, 255, 0.06) 48.19%, rgba(0, 41, 255, 0.012) 100%), #FFFFFF
'
:
'
radial-gradient(153.32% 100% at 47.26% 0%, rgba(130, 71, 229, 0.0864) 0%, rgba(0, 41, 255, 0.06) 48.19%, rgba(0, 41, 255, 0.012) 100%), #FFFFFF
'
const
polygonDarkGradient
=
phase0
FlagEnabled
const
polygonDarkGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(130, 71, 229, 0.2) 0%, rgba(200, 168, 255, 0.05) 52.6%, rgba(0, 0, 0, 0) 100%), #0D0E0E
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(130, 71, 229, 0.2) 0%, rgba(200, 168, 255, 0.05) 52.6%, rgba(0, 0, 0, 0) 100%), #0D0E0E
'
:
'
radial-gradient(150.6% 98.22% at 48.06% 0%, rgba(130, 71, 229, 0.6) 0%, rgba(200, 168, 255, 0) 100%), #1F2128
'
:
'
radial-gradient(150.6% 98.22% at 48.06% 0%, rgba(130, 71, 229, 0.6) 0%, rgba(200, 168, 255, 0) 100%), #1F2128
'
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
polygonDarkGradient
:
polygonLightGradient
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
polygonDarkGradient
:
polygonLightGradient
backgroundRadialGradientElement
.
style
.
backgroundBlendMode
=
phase0
FlagEnabled
backgroundRadialGradientElement
.
style
.
backgroundBlendMode
=
redesign
FlagEnabled
?
'
none
'
?
'
none
'
:
darkMode
:
darkMode
?
'
overlay,normal
'
?
'
overlay,normal
'
...
@@ -81,14 +81,14 @@ export default function RadialGradientByChainUpdater(): null {
...
@@ -81,14 +81,14 @@ export default function RadialGradientByChainUpdater(): null {
case
SupportedChainId
.
CELO
:
case
SupportedChainId
.
CELO
:
case
SupportedChainId
.
CELO_ALFAJORES
:
case
SupportedChainId
.
CELO_ALFAJORES
:
setBackground
(
backgroundResetStyles
)
setBackground
(
backgroundResetStyles
)
const
celoLightGradient
=
phase0
FlagEnabled
const
celoLightGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(186, 228, 210, 0.7) 0%, rgba(252, 243, 249, 0.6536) 49.48%, rgba(255, 255, 255, 0) 100%), #FFFFFF
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(186, 228, 210, 0.7) 0%, rgba(252, 243, 249, 0.6536) 49.48%, rgba(255, 255, 255, 0) 100%), #FFFFFF
'
:
'
radial-gradient(150% 100% at 50% 0%,#35D07F35 0, #FBCC5C35 100%)
'
:
'
radial-gradient(150% 100% at 50% 0%,#35D07F35 0, #FBCC5C35 100%)
'
const
celoDarkGradient
=
phase0
FlagEnabled
const
celoDarkGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(20, 49, 37, 0.29) 0%, rgba(12, 31, 23, 0.6536) 49.48%, rgba(31, 33, 40, 0) 100%, rgba(31, 33, 40, 0) 100%), #0D0E0E
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(20, 49, 37, 0.29) 0%, rgba(12, 31, 23, 0.6536) 49.48%, rgba(31, 33, 40, 0) 100%, rgba(31, 33, 40, 0) 100%), #0D0E0E
'
:
'
radial-gradient(150% 100% at 50% 0%, rgb(2 80 47) 2%, rgb(12 41 28) 53%, rgb(31, 33, 40) 100%)
'
:
'
radial-gradient(150% 100% at 50% 0%, rgb(2 80 47) 2%, rgb(12 41 28) 53%, rgb(31, 33, 40) 100%)
'
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
celoDarkGradient
:
celoLightGradient
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
celoDarkGradient
:
celoLightGradient
backgroundRadialGradientElement
.
style
.
backgroundBlendMode
=
phase0
FlagEnabled
backgroundRadialGradientElement
.
style
.
backgroundBlendMode
=
redesign
FlagEnabled
?
'
none
'
?
'
none
'
:
darkMode
:
darkMode
?
'
overlay,normal
'
?
'
overlay,normal
'
...
@@ -96,19 +96,19 @@ export default function RadialGradientByChainUpdater(): null {
...
@@ -96,19 +96,19 @@ export default function RadialGradientByChainUpdater(): null {
break
break
default
:
default
:
setBackground
(
initialStyles
)
setBackground
(
initialStyles
)
const
defaultLightGradient
=
phase0
FlagEnabled
const
defaultLightGradient
=
redesign
FlagEnabled
?
'
radial-gradient(100% 100% at 50% 0%, rgba(255, 184, 226, 0.51) 0%, rgba(255, 255, 255, 0) 100%), #FFFFFF
'
?
'
radial-gradient(100% 100% at 50% 0%, rgba(255, 184, 226, 0.51) 0%, rgba(255, 255, 255, 0) 100%), #FFFFFF
'
:
'
radial-gradient(50% 50% at 50% 50%,#fc077d10 0,rgba(255,255,255,0) 100%)
'
:
'
radial-gradient(50% 50% at 50% 50%,#fc077d10 0,rgba(255,255,255,0) 100%)
'
const
defaultDarkGradient
=
phase0
FlagEnabled
const
defaultDarkGradient
=
redesign
FlagEnabled
?
'
linear-gradient(180deg, #202738 0%, #070816 100%)
'
?
'
linear-gradient(180deg, #202738 0%, #070816 100%)
'
:
'
radial-gradient(50% 50% at 50% 50%,#fc077d10 0,rgba(255,255,255,0) 100%)
'
:
'
radial-gradient(50% 50% at 50% 50%,#fc077d10 0,rgba(255,255,255,0) 100%)
'
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
defaultDarkGradient
:
defaultLightGradient
backgroundRadialGradientElement
.
style
.
background
=
darkMode
?
defaultDarkGradient
:
defaultLightGradient
backgroundRadialGradientElement
.
style
.
backgroundBlendMode
=
phase0
FlagEnabled
backgroundRadialGradientElement
.
style
.
backgroundBlendMode
=
redesign
FlagEnabled
?
'
none
'
?
'
none
'
:
darkMode
:
darkMode
?
'
overlay,normal
'
?
'
overlay,normal
'
:
'
multiply,normal
'
:
'
multiply,normal
'
}
}
},
[
darkMode
,
chainId
,
phase0
FlagEnabled
])
},
[
darkMode
,
chainId
,
redesign
FlagEnabled
])
return
null
return
null
}
}
src/theme/components.tsx
View file @
09380698
...
@@ -296,8 +296,8 @@ export const SmallOnly = styled.span`
...
@@ -296,8 +296,8 @@ export const SmallOnly = styled.span`
`
};
`
};
`
`
export const Separator = styled.div<{
phase0
Flag?: boolean }>`
export const Separator = styled.div<{
redesign
Flag?: boolean }>`
width
:
100
%
;
width
:
100
%
;
height
:
1
px
;
height
:
1
px
;
background
-
color
:
$
{({
theme
,
phase0Flag
})
=>
(
phase0
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg2
)};
background
-
color
:
$
{({
theme
,
redesignFlag
})
=>
(
redesign
Flag
?
theme
.
backgroundOutline
:
theme
.
deprecated_bg2
)};
`
`
src/theme/index.tsx
View file @
09380698
import
{
Phase0Variant
,
usePhase0Flag
}
from
'
featureFlags/flags/phase0
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
React
,
{
useMemo
}
from
'
react
'
import
React
,
{
useMemo
}
from
'
react
'
import
{
Text
,
TextProps
as
TextPropsOriginal
}
from
'
rebass
'
import
{
Text
,
TextProps
as
TextPropsOriginal
}
from
'
rebass
'
import
styled
,
{
import
styled
,
{
...
@@ -272,9 +272,12 @@ function getTheme(darkMode: boolean, isNewColorsEnabled: boolean): DefaultTheme
...
@@ -272,9 +272,12 @@ function getTheme(darkMode: boolean, isNewColorsEnabled: boolean): DefaultTheme
}
}
export
default
function
ThemeProvider
({
children
}:
{
children
:
React
.
ReactNode
})
{
export
default
function
ThemeProvider
({
children
}:
{
children
:
React
.
ReactNode
})
{
const
phase0Flag
=
usePhase0
Flag
()
const
redesignFlag
=
useRedesign
Flag
()
const
darkMode
=
useIsDarkMode
()
const
darkMode
=
useIsDarkMode
()
const
themeObject
=
useMemo
(()
=>
getTheme
(
darkMode
,
phase0Flag
===
Phase0Variant
.
Enabled
),
[
darkMode
,
phase0Flag
])
const
themeObject
=
useMemo
(
()
=>
getTheme
(
darkMode
,
redesignFlag
===
RedesignVariant
.
Enabled
),
[
darkMode
,
redesignFlag
]
)
return
<
StyledComponentsThemeProvider
theme=
{
themeObject
}
>
{
children
}
</
StyledComponentsThemeProvider
>
return
<
StyledComponentsThemeProvider
theme=
{
themeObject
}
>
{
children
}
</
StyledComponentsThemeProvider
>
}
}
...
...
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