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
efa3d552
Unverified
Commit
efa3d552
authored
Feb 03, 2022
by
Zach Pomerantz
Committed by
GitHub
Feb 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: only show max where appropriate (#3229)
parent
5c0246cf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
12 deletions
+6
-12
Input.tsx
src/lib/components/Swap/Input.tsx
+5
-4
Output.tsx
src/lib/components/Swap/Output.tsx
+1
-8
No files found.
src/lib/components/Swap/Input.tsx
View file @
efa3d552
...
...
@@ -4,7 +4,7 @@ import { useSwapAmount, useSwapCurrency, useSwapInfo } from 'lib/hooks/swap'
import
{
usePrefetchCurrencyColor
}
from
'
lib/hooks/useCurrencyColor
'
import
{
Field
}
from
'
lib/state/swap
'
import
styled
,
{
ThemedText
}
from
'
lib/theme
'
import
{
use
Callback
}
from
'
react
'
import
{
use
Memo
}
from
'
react
'
import
{
formatCurrencyAmount
}
from
'
utils/formatCurrencyAmount
'
import
Column
from
'
../Column
'
...
...
@@ -42,10 +42,11 @@ export default function Input({ disabled }: InputProps) {
//TODO(ianlapham): mimic logic from app swap page
const
mockApproved
=
true
const
onMax
=
use
Callback
(()
=>
{
if
(
balance
)
{
updateSwapInputAmount
(
balance
.
toExact
())
const
onMax
=
use
Memo
(()
=>
{
if
(
balance
?.
greaterThan
(
0
)
)
{
return
()
=>
updateSwapInputAmount
(
balance
.
toExact
())
}
return
},
[
balance
,
updateSwapInputAmount
])
return
(
...
...
src/lib/components/Swap/Output.tsx
View file @
efa3d552
...
...
@@ -7,7 +7,7 @@ import { useSwapAmount, useSwapCurrency, useSwapInfo } from 'lib/hooks/swap'
import
useCurrencyColor
from
'
lib/hooks/useCurrencyColor
'
import
{
Field
}
from
'
lib/state/swap
'
import
styled
,
{
DynamicThemeProvider
,
ThemedText
}
from
'
lib/theme
'
import
{
ReactNode
,
use
Callback
,
use
Memo
}
from
'
react
'
import
{
ReactNode
,
useMemo
}
from
'
react
'
import
{
computeFiatValuePriceImpact
}
from
'
utils/computeFiatValuePriceImpact
'
import
{
formatCurrencyAmount
}
from
'
utils/formatCurrencyAmount
'
...
...
@@ -69,12 +69,6 @@ export default function Output({ disabled, children }: OutputProps) {
return
''
},
[
priceImpact
,
outputUSDC
])
const
onMax
=
useCallback
(()
=>
{
if
(
balance
)
{
updateSwapOutputAmount
(
balance
.
toExact
())
}
},
[
balance
,
updateSwapOutputAmount
])
return
(
<
DynamicThemeProvider
color=
{
color
}
>
<
OutputColumn
hasColor=
{
hasColor
}
gap=
{
0.5
}
>
...
...
@@ -87,7 +81,6 @@ export default function Output({ disabled, children }: OutputProps) {
currency=
{
swapOutputCurrency
}
amount=
{
(
swapOutputAmount
!==
undefined
?
swapOutputAmount
:
outputCurrencyAmount
?.
toSignificant
(
6
))
??
''
}
disabled=
{
disabled
}
onMax=
{
onMax
}
onChangeInput=
{
updateSwapOutputAmount
}
onChangeCurrency=
{
updateSwapOutputCurrency
}
>
...
...
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