Skip to content

Commit

Permalink
Set the initial value of the amount field to 0
Browse files Browse the repository at this point in the history
... instead of empty string.

Earlier the "0" was in the placeholder, but not in the actual value,
and this was causing some problems.
  • Loading branch information
csillag committed Sep 29, 2022
1 parent f74d793 commit 1d0eb1f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/app/pages/AccountPage/Features/SendTransaction/index.tsx
Expand Up @@ -25,7 +25,7 @@ export function SendTransaction(props: SendTransactionProps) {
const { error, success } = useSelector(selectTransaction)
const validators = useSelector(selectValidators)
const [recipient, setRecipient] = useState('')
const [amount, setAmount] = useState('')
const [amount, setAmount] = useState('0')
const sendTransaction = () =>
dispatch(
transactionActions.sendTransaction({
Expand Down Expand Up @@ -70,7 +70,7 @@ export function SendTransaction(props: SendTransactionProps) {

return (
<Box border={{ color: 'background-front-border', size: '1px' }} round="5px" background="background-front">
<Form>
<Form onSubmit={onSubmit}>
<Box fill gap="medium" pad="medium">
<FormField
htmlFor="recipient-id"
Expand All @@ -90,7 +90,7 @@ export function SendTransaction(props: SendTransactionProps) {
<TextInput
id="amount-id"
name="amount"
placeholder="0"
placeholder={t('account.sendTransaction.enterAmount', 'Enter an amount')}
type="number"
step="any"
min="0"
Expand All @@ -103,7 +103,7 @@ export function SendTransaction(props: SendTransactionProps) {
<Button
type="submit"
label={t('account.sendTransaction.send', 'Send')}
onClick={onSubmit}
// onClick={onSubmit}
primary
/>
</Box>
Expand Down
Expand Up @@ -1086,11 +1086,11 @@ exports[`<AccountPage /> should match snapshot 1`] = `
id="amount-id"
min="0"
name="amount"
placeholder="0"
placeholder="Enter an amount"
required=""
step="any"
type="number"
value=""
value="0"
/>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Expand Up @@ -24,6 +24,7 @@
"title": "Are you sure you want to continue?"
},
"enterAddress": "Enter an address",
"enterAmount": "Enter an amount",
"recipient": "Recipient",
"send": "Send",
"success": "Transaction successfully sent. The transaction might take up to a minute to appear on your account."
Expand Down

0 comments on commit 1d0eb1f

Please sign in to comment.