diff options
author | Sebastian <sebasjm@gmail.com> | 2022-10-29 20:10:46 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-10-29 20:10:46 -0300 |
commit | 7d69aca76f33098c9e7671d157265c63b7bdf99d (patch) | |
tree | b27cdbb7fd060306c60691373ca0cf6070adc8e8 /packages/taler-wallet-webextension/src/wallet/ManageAccount | |
parent | 5ed4d5d54da2bfac8eca3b58e51737c48e7d065f (diff) | |
download | wallet-core-7d69aca76f33098c9e7671d157265c63b7bdf99d.tar.xz |
add receiver name to iban form and fix some bugs
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/ManageAccount')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts | 2 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/ManageAccount/views.tsx | 38 |
2 files changed, 31 insertions, 9 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts b/packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts index 0dc34c326..f180fc1c0 100644 --- a/packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts +++ b/packages/taler-wallet-webextension/src/wallet/ManageAccount/state.ts @@ -71,7 +71,7 @@ export function useComponentState( ? "that account is already present" : undefined; - const unableToAdd = !type || !alias || paytoUriError !== undefined || uri !== undefined; + const unableToAdd = !type || !alias || paytoUriError !== undefined || uri === undefined; const accountByType: AccountByType = { iban: [], diff --git a/packages/taler-wallet-webextension/src/wallet/ManageAccount/views.tsx b/packages/taler-wallet-webextension/src/wallet/ManageAccount/views.tsx index 9bb9e5814..74c585f66 100644 --- a/packages/taler-wallet-webextension/src/wallet/ManageAccount/views.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ManageAccount/views.tsx @@ -204,6 +204,9 @@ function IbanTable({ <th> <i18n.Translate>Int. Account Number</i18n.Translate> </th> + <th> + <i18n.Translate>Account name</i18n.Translate> + </th> <th class="kyc"> <i18n.Translate>KYC</i18n.Translate> </th> @@ -217,6 +220,7 @@ function IbanTable({ <tr key={account.alias}> <td>{account.alias}</td> <td>{p.targetPath}</td> + <td>{p.params["receiver-name"]}</td> <td class="kyc"> {account.kyc_completed ? ( <SvgIcon @@ -484,9 +488,11 @@ function TalerBankAddressAccount({ function IbanAddressAccount({ field }: { field: TextFieldHandler }): VNode { const { i18n } = useTranslationContext(); - const [value, setValue] = useState<string | undefined>(undefined); + const [number, setNumber] = useState<string | undefined>(undefined); + const [name, setName] = useState<string | undefined>(undefined); const errors = undefinedIfEmpty({ - value: !value ? i18n.str`Can't be empty` : undefined, + number: !number ? i18n.str`Can't be empty` : undefined, + name: !name ? i18n.str`Can't be empty` : undefined, }); return ( <Fragment> @@ -494,17 +500,33 @@ function IbanAddressAccount({ field }: { field: TextFieldHandler }): VNode { label="IBAN number" variant="standard" fullWidth - value={value} - error={value !== undefined && !!errors?.value} + value={number} + error={number !== undefined && !!errors?.number} onChange={(v) => { - setValue(v); + setNumber(v); if (!errors) { - field.onInput(`payto://iban/${v}`); + field.onInput(`payto://iban/${v}?receiver-name=${name}`); } }} /> - {value !== undefined && errors?.value && ( - <ErrorMessage title={<span>{errors?.value}</span>} /> + {number !== undefined && errors?.number && ( + <ErrorMessage title={<span>{errors?.number}</span>} /> + )} + <TextField + label="Account name" + variant="standard" + fullWidth + value={name} + error={name !== undefined && !!errors?.name} + onChange={(v) => { + setName(v); + if (!errors) { + field.onInput(`payto://iban/${number}?receiver-name=${v}`); + } + }} + /> + {name !== undefined && errors?.name && ( + <ErrorMessage title={<span>{errors?.name}</span>} /> )} </Fragment> ); |