Skip to content
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

Minor UI fixes #2639

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions wormhole-connect/src/hooks/useAmountValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ export const useAmountValidation = (props: Props): HookReturn => {
// All quotes fail.
if (allRoutesFailed) {
if (minAmount) {
const amountDisplay = sdkAmount.display(minAmount);
const formattedAmount = sdkAmount.whole(minAmount).toLocaleString('en', {
maximumFractionDigits: 4,
});
return {
error: `Amount too small (min ~${amountDisplay} ${props.tokenSymbol})`,
error: `Amount too small (min ~${formattedAmount} ${props.tokenSymbol})`,
};
} else {
return {
Expand All @@ -95,9 +97,11 @@ export const useAmountValidation = (props: Props): HookReturn => {

// MinQuote warnings information
if (minAmount) {
const amountDisplay = sdkAmount.display(minAmount);
const formattedAmount = sdkAmount.whole(minAmount).toLocaleString('en', {
maximumFractionDigits: 4,
});
return {
warning: `More routes available for amounts exceeding ${amountDisplay} ${props.tokenSymbol}`,
warning: `More routes available for amounts exceeding ${formattedAmount} ${props.tokenSymbol}`,
};
}

Expand Down
2 changes: 1 addition & 1 deletion wormhole-connect/src/utils/sdkv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,5 +445,5 @@ export const isMinAmountError = (
error?: Error,
): error is routes.MinAmountError => {
const unsafeCastError = error as routes.MinAmountError;
return isAmount(unsafeCastError?.min?.amount);
return isAmount(unsafeCastError?.min);
};
9 changes: 1 addition & 8 deletions wormhole-connect/src/views/v2/Bridge/AmountInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,12 @@ const AmountInput = (props: Props) => {
e.currentTarget.blur();
},
step: '0.1',
pattern: '[0-9]+([.|,][0-9]{1,2})?',
}}
placeholder="0"
variant="standard"
value={amount}
onChange={handleChange}
onWheel={(e) => {
artursapek marked this conversation as resolved.
Show resolved Hide resolved
// IMPORTANT: We need to prevent the scroll behavior on number inputs.
// Otherwise it'll increase/decrease the value when user scrolls on the input control.
// See for details: https://github.com/mui/material-ui/issues/7960
if (e.target instanceof HTMLElement) {
e.target.blur();
}
}}
InputProps={{
disableUnderline: true,
endAdornment: (
Expand Down
14 changes: 8 additions & 6 deletions wormhole-connect/src/views/v2/Bridge/ReviewTransaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,14 @@ const ReviewTransaction = (props: Props) => {
destinationGasDrop={receiveNativeAmount}
quote={quote}
/>
<Collapse in={showGasSlider}>
<GasSlider
destinationGasDrop={receiveNativeAmount || 0}
disabled={isGasSliderDisabled}
/>
</Collapse>
{showGasSlider && (
<Collapse in={showGasSlider}>
<GasSlider
destinationGasDrop={receiveNativeAmount || 0}
disabled={isGasSliderDisabled}
/>
</Collapse>
)}
<SendError humanError={sendError} internalError={sendErrorInternal} />
{confirmTransactionButton}
</Stack>
Expand Down
15 changes: 12 additions & 3 deletions wormhole-connect/src/views/v2/Redeem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,20 @@ const useStyles = makeStyles()((theme) => ({
width: '100%',
},
actionButton: {
padding: '8px 16px',
padding: '12px 16px',
backgroundColor: theme.palette.primary.main,
borderRadius: '8px',
margin: 'auto',
maxWidth: '420px',
width: '100%',
},
claimButton: {
backgroundColor: theme.palette.warning.light,
color: theme.palette.background.default,
'&:hover': {
backgroundColor: theme.palette.warning.main,
},
},
errorBox: {
maxWidth: '420px',
},
Expand Down Expand Up @@ -543,7 +550,7 @@ const Redeem = () => {

return (
<Button
className={classes.actionButton}
className={joinClass([classes.actionButton, classes.claimButton])}
disabled={isClaimInProgress || !isTxAttested}
variant={claimError ? 'error' : 'primary'}
onClick={handleManualClaim}
Expand All @@ -556,7 +563,9 @@ const Redeem = () => {
</Typography>
</Stack>
) : (
<Typography textTransform="none">Claim</Typography>
<Typography textTransform="none">
Claim tokens to complete transfer
</Typography>
)}
</Button>
);
Expand Down
Loading