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
88712b50
Unverified
Commit
88712b50
authored
Feb 10, 2022
by
Ian Lapham
Committed by
GitHub
Feb 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: adjust max button for native currencies (#3279)
* adjust max button for native currencies * update var naming
parent
1af34ae0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Input.tsx
src/lib/components/Swap/Input.tsx
+7
-3
No files found.
src/lib/components/Swap/Input.tsx
View file @
88712b50
...
@@ -10,6 +10,7 @@ import styled, { ThemedText } from 'lib/theme'
...
@@ -10,6 +10,7 @@ import styled, { ThemedText } from 'lib/theme'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
TradeState
}
from
'
state/routing/types
'
import
{
TradeState
}
from
'
state/routing/types
'
import
{
formatCurrencyAmount
}
from
'
utils/formatCurrencyAmount
'
import
{
formatCurrencyAmount
}
from
'
utils/formatCurrencyAmount
'
import
{
maxAmountSpend
}
from
'
utils/maxAmountSpend
'
import
Column
from
'
../Column
'
import
Column
from
'
../Column
'
import
Row
from
'
../Row
'
import
Row
from
'
../Row
'
...
@@ -59,12 +60,15 @@ export default function Input({ disabled }: InputProps) {
...
@@ -59,12 +60,15 @@ export default function Input({ disabled }: InputProps) {
//TODO(ianlapham): mimic logic from app swap page
//TODO(ianlapham): mimic logic from app swap page
const
mockApproved
=
true
const
mockApproved
=
true
// account for gas needed if using max on native token
const
maxAmount
=
useMemo
(()
=>
maxAmountSpend
(
balance
),
[
balance
])
const
onMax
=
useMemo
(()
=>
{
const
onMax
=
useMemo
(()
=>
{
if
(
balance
?.
greaterThan
(
0
))
{
if
(
maxAmount
?.
greaterThan
(
0
))
{
return
()
=>
updateSwapInputAmount
(
balance
.
toExact
())
return
()
=>
updateSwapInputAmount
(
maxAmount
.
toExact
())
}
}
return
return
},
[
balance
,
updateSwapInputAmount
])
},
[
maxAmount
,
updateSwapInputAmount
])
return
(
return
(
<
InputColumn
gap=
{
0.5
}
approved=
{
mockApproved
}
>
<
InputColumn
gap=
{
0.5
}
approved=
{
mockApproved
}
>
...
...
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