aboutsummaryrefslogtreecommitdiff
path: root/packages/bank-ui
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-06-16 12:04:44 -0300
committerSebastian <sebasjm@gmail.com>2024-06-16 12:04:44 -0300
commit1e2d09017fd5bd0a8b5def8a30f5a7c07e8a7156 (patch)
treea6a04bebfbba57435ce1d429743a841533792e2c /packages/bank-ui
parent4ca0466c1a766905043343cd1716a09b3c2d4b9a (diff)
downloadwallet-core-1e2d09017fd5bd0a8b5def8a30f5a7c07e8a7156.tar.xz
addressing 976ef6296: showing withdrawal info when amount is suggested
Diffstat (limited to 'packages/bank-ui')
-rw-r--r--packages/bank-ui/src/pages/SolveChallengePage.tsx3
-rw-r--r--packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx16
-rw-r--r--packages/bank-ui/src/pages/WithdrawalQRCode.tsx35
3 files changed, 27 insertions, 27 deletions
diff --git a/packages/bank-ui/src/pages/SolveChallengePage.tsx b/packages/bank-ui/src/pages/SolveChallengePage.tsx
index 6d22d8da7..e4ca13ed6 100644
--- a/packages/bank-ui/src/pages/SolveChallengePage.tsx
+++ b/packages/bank-ui/src/pages/SolveChallengePage.tsx
@@ -699,14 +699,13 @@ function ShowWithdrawalDetails({ id }: { id: string }): VNode {
<div class="px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
<dt class="text-sm font-medium leading-6 text-gray-900">Amount</dt>
<dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0">
- {/* FIXME: THIS IS STUPID! We need to fix the reason why details.body.amount could be undefined here! */}
{details.body.amount !== undefined ? (
<RenderAmount
value={Amounts.parseOrThrow(details.body.amount)}
spec={config.currency_specification}
/>
) : (
- "Unable to find the amount."
+ <i18n.Translate>No amount specified yet.</i18n.Translate>
)}
</dd>
</div>
diff --git a/packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx b/packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx
index b270c447a..25fa36d55 100644
--- a/packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx
+++ b/packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx
@@ -52,7 +52,7 @@ interface Props {
account: PaytoUri;
reserve: string;
username: string;
- amount: AmountJson;
+ amount?: AmountJson;
};
onAuthorizationRequired: () => void;
}
@@ -357,10 +357,16 @@ export function WithdrawalConfirmationQuestion({
<i18n.Translate>Amount</i18n.Translate>
</dt>
<dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0">
- <RenderAmount
- value={details.amount}
- spec={config.currency_specification}
- />
+ {details.amount !== undefined ? (
+ <RenderAmount
+ value={details.amount}
+ spec={config.currency_specification}
+ />
+ ) : (
+ <i18n.Translate>
+ No amount specified yet.
+ </i18n.Translate>
+ )}
</dd>
</div>
{Amounts.isZero(wireFee) ? undefined : (
diff --git a/packages/bank-ui/src/pages/WithdrawalQRCode.tsx b/packages/bank-ui/src/pages/WithdrawalQRCode.tsx
index 6901c2a87..f43a6a89c 100644
--- a/packages/bank-ui/src/pages/WithdrawalQRCode.tsx
+++ b/packages/bank-ui/src/pages/WithdrawalQRCode.tsx
@@ -232,26 +232,21 @@ export function WithdrawalQRCode({
}
return (
- /* FIXME: THIS IS STUPID! We need to fix the reason why data.amount could be undefined here! */
- data.amount !== undefined ? (
- <WithdrawalConfirmationQuestion
- withdrawUri={withdrawUri}
- routeHere={routeWithdrawalDetails}
- details={{
- username: data.username,
- account,
- reserve: data.selected_reserve_pub,
- amount: Amounts.parseOrThrow(data.amount),
- }}
- onAuthorizationRequired={onAuthorizationRequired}
- onAborted={() => {
- notifyInfo(i18n.str`Operation canceled`);
- onOperationAborted();
- }}
- />
- ) : (
- <p>Unable to find the amount.</p>
- )
+ <WithdrawalConfirmationQuestion
+ withdrawUri={withdrawUri}
+ routeHere={routeWithdrawalDetails}
+ details={{
+ username: data.username,
+ account,
+ reserve: data.selected_reserve_pub,
+ amount: !data.amount ? undefined : Amounts.parseOrThrow(data.amount),
+ }}
+ onAuthorizationRequired={onAuthorizationRequired}
+ onAborted={() => {
+ notifyInfo(i18n.str`Operation canceled`);
+ onOperationAborted();
+ }}
+ />
);
}