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
b3c44f20
Unverified
Commit
b3c44f20
authored
Oct 26, 2022
by
Jordan Frankfurt
Committed by
GitHub
Oct 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: bag footer layout (#5003)
* fix: bag footer layout * pr feedback * remove balance from footer
parent
8a5045f6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
21 deletions
+44
-21
Bag.tsx
src/nft/components/bag/Bag.tsx
+3
-6
BagFooter.tsx
src/nft/components/bag/BagFooter.tsx
+41
-15
No files found.
src/nft/components/bag/Bag.tsx
View file @
b3c44f20
...
@@ -123,11 +123,9 @@ const Bag = () => {
...
@@ -123,11 +123,9 @@ const Bag = () => {
return
{
totalEthPrice
,
totalUsdPrice
}
return
{
totalEthPrice
,
totalUsdPrice
}
},
[
itemsInBag
,
fetchedPriceData
])
},
[
itemsInBag
,
fetchedPriceData
])
const
{
balance
,
sufficientBalance
}
=
useMemo
(()
=>
{
const
sufficientBalance
=
useMemo
(()
=>
{
const
balance
:
BigNumber
=
parseEther
(
balanceInEth
.
toString
())
const
balance
=
parseEther
(
balanceInEth
.
toString
())
const
sufficientBalance
=
isConnected
?
BigNumber
.
from
(
balance
).
gte
(
totalEthPrice
)
:
true
return
isConnected
?
BigNumber
.
from
(
balance
).
gte
(
totalEthPrice
)
:
true
return
{
balance
,
sufficientBalance
}
},
[
balanceInEth
,
totalEthPrice
,
isConnected
])
},
[
balanceInEth
,
totalEthPrice
,
isConnected
])
const
purchaseAssets
=
async
(
routingData
:
RouteResponse
)
=>
{
const
purchaseAssets
=
async
(
routingData
:
RouteResponse
)
=>
{
...
@@ -278,7 +276,6 @@ const Bag = () => {
...
@@ -278,7 +276,6 @@ const Bag = () => {
<
ScrollingIndicator
show=
{
userCanScroll
&&
scrollProgress
<
100
}
/>
<
ScrollingIndicator
show=
{
userCanScroll
&&
scrollProgress
<
100
}
/>
{
hasAssetsToShow
&&
!
isProfilePage
&&
(
{
hasAssetsToShow
&&
!
isProfilePage
&&
(
<
BagFooter
<
BagFooter
balance=
{
balance
}
sufficientBalance=
{
sufficientBalance
}
sufficientBalance=
{
sufficientBalance
}
isConnected=
{
isConnected
}
isConnected=
{
isConnected
}
totalEthPrice=
{
totalEthPrice
}
totalEthPrice=
{
totalEthPrice
}
...
...
src/nft/components/bag/BagFooter.tsx
View file @
b3c44f20
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
import
{
Trans
}
from
'
@lingui/macro
'
import
Loader
from
'
components/Loader
'
import
Loader
from
'
components/Loader
'
import
{
Box
}
from
'
nft/components/Box
'
import
{
Box
}
from
'
nft/components/Box
'
import
{
Column
,
Row
}
from
'
nft/components/Flex
'
import
{
Column
,
Row
}
from
'
nft/components/Flex
'
import
{
bodySmall
}
from
'
nft/css/common.css
'
import
{
bodySmall
}
from
'
nft/css/common.css
'
import
{
BagStatus
}
from
'
nft/types
'
import
{
BagStatus
}
from
'
nft/types
'
import
{
ethNumberStandardFormatter
,
formatWeiToDecimal
}
from
'
nft/utils
'
import
{
ethNumberStandardFormatter
,
formatWeiToDecimal
}
from
'
nft/utils
'
import
{
AlertTriangle
}
from
'
react-feather
'
import
{
useModalIsOpen
,
useToggleWalletModal
}
from
'
state/application/hooks
'
import
{
useModalIsOpen
,
useToggleWalletModal
}
from
'
state/application/hooks
'
import
{
ApplicationModal
}
from
'
state/application/reducer
'
import
{
ApplicationModal
}
from
'
state/application/reducer
'
import
styled
from
'
styled-components/macro
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
*
as
styles
from
'
./BagFooter.css
'
import
*
as
styles
from
'
./BagFooter.css
'
const
Footer
=
styled
.
div
<
{
$showWarning
:
boolean
}
>
`
border-top: 1px solid
${({
theme
})
=>
theme
.
backgroundOutline
}
;
color:
${({
theme
})
=>
theme
.
textPrimary
}
;
display: flex;
flex-direction: column;
padding: 12px 16px;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
border-top-left-radius:
${({
$showWarning
})
=>
(
$showWarning
?
'
0
'
:
'
12
'
)}
px;
border-top-right-radius:
${({
$showWarning
})
=>
(
$showWarning
?
'
0
'
:
'
12
'
)}
px;
`
const
WarningIcon
=
styled
(
AlertTriangle
)
`
width: 14px;
margin-right: 4px;
color:
${({
theme
})
=>
theme
.
accentWarning
}
;
`
const
WarningText
=
styled
(
ThemedText
.
BodyPrimary
)
`
align-items: center;
color:
${({
theme
})
=>
theme
.
accentWarning
}
;
display: flex;
justify-content: center;
margin: 12px 0 !important;
text-align: center;
`
interface
BagFooterProps
{
interface
BagFooterProps
{
balance
:
BigNumber
isConnected
:
boolean
isConnected
:
boolean
sufficientBalance
:
boolean
sufficientBalance
:
boolean
totalEthPrice
:
BigNumber
totalEthPrice
:
BigNumber
...
@@ -30,7 +58,6 @@ const PENDING_BAG_STATUSES = [
...
@@ -30,7 +58,6 @@ const PENDING_BAG_STATUSES = [
]
]
export
const
BagFooter
=
({
export
const
BagFooter
=
({
balance
,
isConnected
,
isConnected
,
sufficientBalance
,
sufficientBalance
,
totalEthPrice
,
totalEthPrice
,
...
@@ -49,18 +76,7 @@ export const BagFooter = ({
...
@@ -49,18 +76,7 @@ export const BagFooter = ({
return
(
return
(
<
Column
className=
{
styles
.
footerContainer
}
>
<
Column
className=
{
styles
.
footerContainer
}
>
{
showWarning
&&
(
<
Footer
$showWarning=
{
showWarning
}
>
<
Row
className=
{
styles
.
warningContainer
}
>
{
!
sufficientBalance
?
`Insufficient funds (${formatWeiToDecimal(balance.toString())} ETH)`
:
`Something went wrong. Please try again.`
}
</
Row
>
)
}
<
Column
borderTopLeftRadius=
{
showWarning
?
'
0
'
:
'
12
'
}
borderTopRightRadius=
{
showWarning
?
'
0
'
:
'
12
'
}
className=
{
styles
.
footer
}
>
<
Column
gap=
"4"
paddingTop=
"8"
paddingBottom=
"20"
>
<
Column
gap=
"4"
paddingTop=
"8"
paddingBottom=
"20"
>
<
Row
justifyContent=
"space-between"
>
<
Row
justifyContent=
"space-between"
>
<
Box
>
<
Box
>
...
@@ -76,6 +92,16 @@ export const BagFooter = ({
...
@@ -76,6 +92,16 @@ export const BagFooter = ({
{
`${ethNumberStandardFormatter(totalUsdPrice, true)}`
}
{
`${ethNumberStandardFormatter(totalUsdPrice, true)}`
}
</
Row
>
</
Row
>
</
Column
>
</
Column
>
{
showWarning
&&
(
<
WarningText
fontSize=
"14px"
lineHeight=
"20px"
>
<
WarningIcon
/>
{
!
sufficientBalance
?
(
<
Trans
>
Insufficient funds
</
Trans
>
)
:
(
<
Trans
>
Something went wrong. Please try again.
</
Trans
>
)
}
</
WarningText
>
)
}
<
Row
<
Row
as=
"button"
as=
"button"
color=
"explicitWhite"
color=
"explicitWhite"
...
@@ -98,7 +124,7 @@ export const BagFooter = ({
...
@@ -98,7 +124,7 @@ export const BagFooter = ({
?
'
Transaction pending
'
?
'
Transaction pending
'
:
'
Pay
'
}
:
'
Pay
'
}
</
Row
>
</
Row
>
</
Column
>
</
Footer
>
</
Column
>
</
Column
>
)
)
}
}
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