-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: show relays even when 0 relays left #2789
Changes from 1 commit
79edddc
8db5a5e
93e9e88
c29d803
8359c8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,43 +11,72 @@ export const SPONSOR_LOGOS = { | |
[chains.gor]: '/images/common/token-placeholder.svg', | ||
} | ||
|
||
const SponsoredBy = ({ relays, tooltip }: { relays: RelayResponse; tooltip?: string }) => { | ||
const SponsoredBy = ({ | ||
relays, | ||
tooltip, | ||
shouldRelay, | ||
}: { | ||
relays?: RelayResponse | ||
tooltip?: string | ||
shouldRelay: boolean | ||
}) => { | ||
const chain = useCurrentChain() | ||
|
||
return ( | ||
<Box className={css.sponsoredBy}> | ||
<SvgIcon component={GasStationIcon} inheritViewBox className={css.icon} /> | ||
<div> | ||
<Stack direction="row" spacing={0.5} alignItems="center"> | ||
<Typography variant="body2" fontWeight={700} letterSpacing="0.1px"> | ||
Sponsored by | ||
|
||
{shouldRelay ? ( | ||
<div> | ||
<Stack direction="row" spacing={0.5} alignItems="center"> | ||
<Typography variant="body2" fontWeight={700} letterSpacing="0.1px"> | ||
Sponsored by | ||
</Typography> | ||
|
||
<img src={SPONSOR_LOGOS[chain?.chainId || '']} alt={chain?.chainName} className={css.logo} /> | ||
<Typography variant="body2" fontWeight={700} letterSpacing="0.1px"> | ||
{chain?.chainName} | ||
</Typography> | ||
|
||
{tooltip ? ( | ||
<Tooltip title={tooltip} placement="top" arrow> | ||
<span style={{ display: 'flex' }}> | ||
<SvgIcon | ||
component={InfoIcon} | ||
inheritViewBox | ||
color="info" | ||
fontSize="small" | ||
sx={{ verticalAlign: 'middle', color: '#B2B5B2' }} | ||
/> | ||
</span> | ||
</Tooltip> | ||
) : null} | ||
</Stack> | ||
|
||
<Typography variant="body2" color="primary.light"> | ||
Transactions per hour:{' '} | ||
<Box component="span" sx={{ fontWeight: '700', color: 'text.primary' }}> | ||
{relays?.remaining ?? 0} of {relays?.limit ?? 0} | ||
</Box> | ||
{relays && !relays.remaining && ( | ||
<Box component="span" sx={{ color: 'error.main' }}> | ||
{' '} | ||
— will reset in the next hour | ||
</Box> | ||
Comment on lines
+61
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is slightly redundant since the label already says "Transactions per hour". Maybe we could instead make the "0 of 5" a red color? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this based on Liliya's feedback. It might be redundant, but it's definitely clearer. IMO we should err on the safe side. |
||
)} | ||
</Typography> | ||
<img src={SPONSOR_LOGOS[chain?.chainId || '']} alt={chain?.chainName} className={css.logo} /> | ||
</div> | ||
) : ( | ||
<div> | ||
<Typography variant="body2" fontWeight={700} letterSpacing="0.1px"> | ||
{chain?.chainName} | ||
Pay gas from the connected wallet | ||
</Typography> | ||
|
||
<Typography variant="body2" color="primary.light"> | ||
Please make sure your wallet has sufficient funds. | ||
</Typography> | ||
{tooltip ? ( | ||
<Tooltip title={tooltip} placement="top" arrow> | ||
<span style={{ display: 'flex' }}> | ||
<SvgIcon | ||
component={InfoIcon} | ||
inheritViewBox | ||
color="info" | ||
fontSize="small" | ||
sx={{ verticalAlign: 'middle', color: '#B2B5B2' }} | ||
/> | ||
</span> | ||
</Tooltip> | ||
) : null} | ||
</Stack> | ||
|
||
<Typography variant="body2" color="primary.light"> | ||
Transactions per hour:{' '} | ||
<Box component="span" sx={{ fontWeight: '700', color: 'text.primary' }}> | ||
{relays.remaining} of {relays.limit} | ||
</Box> | ||
</Typography> | ||
</div> | ||
</div> | ||
)} | ||
</Box> | ||
) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this naming is more confusing now since its not about if the user can relay but if their wallet supports relaying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it to
canWalletRelay
.