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
124b83ae
Unverified
Commit
124b83ae
authored
May 03, 2021
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some clean up in showing the route
parent
0dcd5743
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
57 deletions
+30
-57
index.tsx
src/components/CurrencyInputPanel/index.tsx
+2
-2
AdvancedSwapDetails.tsx
src/components/swap/AdvancedSwapDetails.tsx
+27
-54
SwapRoute.tsx
src/components/swap/SwapRoute.tsx
+1
-1
No files found.
src/components/CurrencyInputPanel/index.tsx
View file @
124b83ae
...
@@ -200,10 +200,10 @@ export default function CurrencyInputPanel({
...
@@ -200,10 +200,10 @@ export default function CurrencyInputPanel({
if
(
!
priceImpact
)
return
undefined
if
(
!
priceImpact
)
return
undefined
if
(
priceImpact
.
lessThan
(
'
0
'
))
return
theme
.
green1
if
(
priceImpact
.
lessThan
(
'
0
'
))
return
theme
.
green1
const
severity
=
warningSeverity
(
priceImpact
)
const
severity
=
warningSeverity
(
priceImpact
)
if
(
severity
<
1
)
return
undefined
if
(
severity
<
1
)
return
theme
.
text4
if
(
severity
<
3
)
return
theme
.
yellow1
if
(
severity
<
3
)
return
theme
.
yellow1
return
theme
.
red1
return
theme
.
red1
},
[
priceImpact
,
theme
.
green1
,
theme
.
red1
,
theme
.
yellow1
])
},
[
priceImpact
,
theme
.
green1
,
theme
.
red1
,
theme
.
text4
,
theme
.
yellow1
])
return
(
return
(
<
InputPanel
id=
{
id
}
hideInput=
{
hideInput
}
{
...
rest
}
>
<
InputPanel
id=
{
id
}
hideInput=
{
hideInput
}
{
...
rest
}
>
...
...
src/components/swap/AdvancedSwapDetails.tsx
View file @
124b83ae
...
@@ -6,73 +6,46 @@ import { TYPE } from '../../theme'
...
@@ -6,73 +6,46 @@ import { TYPE } from '../../theme'
import
{
computeTradePriceBreakdown
}
from
'
../../utils/prices
'
import
{
computeTradePriceBreakdown
}
from
'
../../utils/prices
'
import
{
AutoColumn
}
from
'
../Column
'
import
{
AutoColumn
}
from
'
../Column
'
import
{
RowBetween
,
RowFixed
}
from
'
../Row
'
import
{
RowBetween
,
RowFixed
}
from
'
../Row
'
import
FormattedPriceImpact
from
'
./FormattedPriceImpact
'
import
SwapRoute
from
'
./SwapRoute
'
import
SwapRoute
from
'
./SwapRoute
'
function
TradeSummary
({
trade
}:
{
trade
:
V2Trade
|
V3Trade
})
{
export
interface
AdvancedSwapDetailsProps
{
trade
?:
V2Trade
|
V3Trade
}
export
function
AdvancedSwapDetails
({
trade
}:
AdvancedSwapDetailsProps
)
{
const
theme
=
useContext
(
ThemeContext
)
const
theme
=
useContext
(
ThemeContext
)
const
{
priceImpactWithoutFee
,
realizedLPFee
}
=
computeTradePriceBreakdown
(
trade
)
return
(
const
{
realizedLPFee
}
=
computeTradePriceBreakdown
(
trade
)
<>
<
AutoColumn
gap=
{
'
8px
'
}
>
const
showRoute
=
Boolean
(
<
RowBetween
>
(
trade
&&
trade
instanceof
V2Trade
&&
trade
.
route
.
pairs
.
length
>
1
)
||
<
RowFixed
>
(
trade
instanceof
V3Trade
&&
trade
.
route
.
pools
.
length
>
1
)
<
TYPE
.
black
fontSize=
{
12
}
fontWeight=
{
400
}
color=
{
theme
.
text2
}
>
)
Price Impact
</
TYPE
.
black
>
{
/* <QuestionHelper text="The difference between the market price and estimated price due to trade size." /> */
}
</
RowFixed
>
<
FormattedPriceImpact
priceImpact=
{
priceImpactWithoutFee
}
/>
</
RowBetween
>
return
!
trade
?
null
:
(
<
AutoColumn
gap=
"8px"
>
<
RowBetween
>
<
RowBetween
>
<
RowFixed
>
<
RowFixed
>
<
TYPE
.
black
fontSize=
{
12
}
fontWeight=
{
400
}
color=
{
theme
.
text2
}
>
<
TYPE
.
black
fontSize=
{
12
}
fontWeight=
{
400
}
color=
{
theme
.
text2
}
>
Liquidity Provider Fee
Liquidity Provider Fee
</
TYPE
.
black
>
</
TYPE
.
black
>
{
/* <QuestionHelper text="A portion of each trade goes to liquidity providers as a protocol incentive." /> */
}
</
RowFixed
>
</
RowFixed
>
<
TYPE
.
black
fontSize=
{
12
}
color=
{
theme
.
text1
}
>
<
TYPE
.
black
fontSize=
{
12
}
color=
{
theme
.
text1
}
>
{
realizedLPFee
?
`${realizedLPFee.toSignificant(4)} ${trade.inputAmount.currency.symbol}`
:
'
-
'
}
{
realizedLPFee
?
`${realizedLPFee.toSignificant(4)} ${trade.inputAmount.currency.symbol}`
:
'
-
'
}
</
TYPE
.
black
>
</
TYPE
.
black
>
</
RowBetween
>
</
RowBetween
>
</
AutoColumn
>
</>
)
}
export
interface
AdvancedSwapDetailsProps
{
trade
?:
V2Trade
|
V3Trade
}
export
function
AdvancedSwapDetails
({
trade
}:
AdvancedSwapDetailsProps
)
{
const
theme
=
useContext
(
ThemeContext
)
const
showRoute
=
Boolean
(
(
trade
&&
trade
instanceof
V2Trade
&&
trade
.
route
.
pairs
.
length
>
2
)
||
(
trade
instanceof
V3Trade
&&
trade
.
route
.
pools
.
length
>
2
)
)
return
(
<
AutoColumn
gap=
"0px"
>
{
trade
&&
(
<>
<
TradeSummary
trade=
{
trade
}
/>
{
showRoute
&&
(
{
showRoute
&&
(
<>
<
RowBetween
>
<
RowBetween
style=
{
{
padding
:
'
4px 16px
'
}
}
>
<
RowFixed
>
<
span
style=
{
{
display
:
'
flex
'
,
alignItems
:
'
center
'
}
}
>
<
TYPE
.
black
fontSize=
{
12
}
fontWeight=
{
400
}
color=
{
theme
.
text2
}
>
<
TYPE
.
black
fontSize=
{
14
}
fontWeight=
{
400
}
color=
{
theme
.
text2
}
>
Route
Route
</
TYPE
.
black
>
</
TYPE
.
black
>
{
/* <QuestionHelper text="Routing through these tokens resulted in the best price for your trade." /> */
}
</
RowFixed
>
</
span
>
<
TYPE
.
black
fontSize=
{
12
}
color=
{
theme
.
text1
}
>
<
SwapRoute
trade=
{
trade
}
/>
<
SwapRoute
trade=
{
trade
}
/>
</
TYPE
.
black
>
</
RowBetween
>
</
RowBetween
>
</>
)
}
</>
)
}
)
}
</
AutoColumn
>
</
AutoColumn
>
)
)
...
...
src/components/swap/SwapRoute.tsx
View file @
124b83ae
...
@@ -32,7 +32,7 @@ export default memo(function SwapRoute({ trade }: { trade: V2Trade | V3Trade })
...
@@ -32,7 +32,7 @@ export default memo(function SwapRoute({ trade }: { trade: V2Trade | V3Trade })
return
(
return
(
<
Fragment
key=
{
i
}
>
<
Fragment
key=
{
i
}
>
<
Flex
alignItems=
"end"
>
<
Flex
alignItems=
"end"
>
<
TYPE
.
black
fontSize=
{
1
4
}
color=
{
theme
.
text1
}
ml=
"0.125rem"
mr=
"0.125rem"
>
<
TYPE
.
black
fontSize=
{
1
2
}
color=
{
theme
.
text1
}
ml=
"0.125rem"
mr=
"0.125rem"
>
{
currency
.
symbol
}
{
currency
.
symbol
}
</
TYPE
.
black
>
</
TYPE
.
black
>
</
Flex
>
</
Flex
>
...
...
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