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
b0fa08e9
Unverified
Commit
b0fa08e9
authored
Apr 28, 2021
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show a loading indicator
parent
b09eb8fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
index.tsx
src/pages/Swap/index.tsx
+11
-6
No files found.
src/pages/Swap/index.tsx
View file @
b0fa08e9
...
@@ -21,7 +21,7 @@ import { AutoRow } from '../../components/Row'
...
@@ -21,7 +21,7 @@ import { AutoRow } from '../../components/Row'
import
BetterTradeLink
from
'
../../components/swap/BetterTradeLink
'
import
BetterTradeLink
from
'
../../components/swap/BetterTradeLink
'
import
confirmPriceImpactWithoutFee
from
'
../../components/swap/confirmPriceImpactWithoutFee
'
import
confirmPriceImpactWithoutFee
from
'
../../components/swap/confirmPriceImpactWithoutFee
'
import
ConfirmSwapModal
from
'
../../components/swap/ConfirmSwapModal
'
import
ConfirmSwapModal
from
'
../../components/swap/ConfirmSwapModal
'
import
{
ArrowWrapper
,
BottomGrouping
,
SwapCallbackError
,
Wrapper
}
from
'
../../components/swap/styleds
'
import
{
ArrowWrapper
,
BottomGrouping
,
Dots
,
SwapCallbackError
,
Wrapper
}
from
'
../../components/swap/styleds
'
import
SwapHeader
from
'
../../components/swap/SwapHeader
'
import
SwapHeader
from
'
../../components/swap/SwapHeader
'
import
TradePrice
from
'
../../components/swap/TradePrice
'
import
TradePrice
from
'
../../components/swap/TradePrice
'
import
TokenWarningModal
from
'
../../components/TokenWarningModal
'
import
TokenWarningModal
from
'
../../components/TokenWarningModal
'
...
@@ -178,11 +178,11 @@ export default function Swap({ history }: RouteComponentProps) {
...
@@ -178,11 +178,11 @@ export default function Swap({ history }: RouteComponentProps) {
:
parsedAmounts
[
dependentField
]?.
toSignificant
(
6
)
??
''
,
:
parsedAmounts
[
dependentField
]?.
toSignificant
(
6
)
??
''
,
}
}
const
route
=
trade
?.
route
const
userHasSpecifiedInputOutput
=
Boolean
(
const
userHasSpecifiedInputOutput
=
Boolean
(
currencies
[
Field
.
INPUT
]
&&
currencies
[
Field
.
OUTPUT
]
&&
parsedAmounts
[
independentField
]?.
greaterThan
(
JSBI
.
BigInt
(
0
))
currencies
[
Field
.
INPUT
]
&&
currencies
[
Field
.
OUTPUT
]
&&
parsedAmounts
[
independentField
]?.
greaterThan
(
JSBI
.
BigInt
(
0
))
)
)
const
noRoute
=
!
route
const
routeNotFound
=
!
trade
?.
route
const
isLoadingRoute
=
toggledVersion
===
Version
.
v3
&&
V3TradeState
.
LOADING
===
v3TradeState
// check whether the user has approved the router on the input token
// check whether the user has approved the router on the input token
const
[
approvalState
,
approveCallback
]
=
useApproveCallbackFromTrade
(
trade
,
allowedSlippage
)
const
[
approvalState
,
approveCallback
]
=
useApproveCallbackFromTrade
(
trade
,
allowedSlippage
)
...
@@ -409,10 +409,15 @@ export default function Swap({ history }: RouteComponentProps) {
...
@@ -409,10 +409,15 @@ export default function Swap({ history }: RouteComponentProps) {
{
wrapInputError
??
{
wrapInputError
??
(
wrapType
===
WrapType
.
WRAP
?
'
Wrap
'
:
wrapType
===
WrapType
.
UNWRAP
?
'
Unwrap
'
:
null
)
}
(
wrapType
===
WrapType
.
WRAP
?
'
Wrap
'
:
wrapType
===
WrapType
.
UNWRAP
?
'
Unwrap
'
:
null
)
}
</
ButtonPrimary
>
</
ButtonPrimary
>
)
:
noRoute
&&
userHasSpecifiedInputOutput
?
(
)
:
routeNotFound
&&
userHasSpecifiedInputOutput
?
(
<
GreyCard
style=
{
{
textAlign
:
'
center
'
}
}
>
<
GreyCard
style=
{
{
textAlign
:
'
center
'
}
}
>
<
TYPE
.
main
mb=
"4px"
>
Insufficient liquidity for this trade.
</
TYPE
.
main
>
<
TYPE
.
main
mb=
"4px"
>
{
singleHopOnly
&&
<
TYPE
.
main
mb=
"4px"
>
Try enabling multi-hop trades.
</
TYPE
.
main
>
}
{
isLoadingRoute
?
(
<
Dots
>
Loading
</
Dots
>
)
:
(
`Insufficient liquidity for this trade.${singleHopOnly ? ' Try enabling multi-hop trades.' : ''}`
)
}
</
TYPE
.
main
>
</
GreyCard
>
</
GreyCard
>
)
:
showApproveFlow
?
(
)
:
showApproveFlow
?
(
<
AutoRow
style=
{
{
flexWrap
:
'
nowrap
'
,
width
:
'
100%
'
}
}
>
<
AutoRow
style=
{
{
flexWrap
:
'
nowrap
'
,
width
:
'
100%
'
}
}
>
...
...
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