Skip to content

Commit

Permalink
fix scroll issue, limit input to the minimum supported amount (#291)
Browse files Browse the repository at this point in the history
* fix scroll issue, limit input to the minimun supported amount

* [skip ci] - bump version
  • Loading branch information
sebastianscatularo authored Aug 8, 2023
1 parent 8d25433 commit bce549f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xlabs/portal-bridge-ui",
"version": "0.1.58",
"version": "0.1.59",
"private": true,
"dependencies": {
"@certusone/wormhole-sdk": "^0.9.22",
Expand Down
4 changes: 4 additions & 0 deletions src/components/NumberTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export default function NumberTextField({
type="number"
{...props}
InputProps={{
inputProps: {
min: 0,
onWheel: (e) => e.currentTarget.blur(),
},
endAdornment: onMaxClick ? (
<InputAdornment position="end">
<Button
Expand Down
9 changes: 7 additions & 2 deletions src/store/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ export const selectTransferSourceError = (
if (
parseUnits(
state.transfer.amount,
state.transfer.sourceParsedTokenAccount.decimals
state.transfer.sourceParsedTokenAccount.isNativeAsset
? state.transfer.sourceParsedTokenAccount.decimals
: state.transfer.sourceParsedTokenAccount.decimals - 10
).lte(0)
) {
return "Amount must be greater than zero";
Expand All @@ -267,7 +269,10 @@ export const selectTransferSourceError = (
}
} catch (e: any) {
if (e?.message) {
return e.message.substring(0, e.message.indexOf("("));
return `Invalid amount - ${e.message.substring(
0,
e.message.indexOf("(")
)}`;
}
return "Invalid amount";
}
Expand Down

0 comments on commit bce549f

Please sign in to comment.