summaryrefslogtreecommitdiff
path: root/packages/bank-ui/src/pages/SolveChallengePage.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/bank-ui/src/pages/SolveChallengePage.tsx')
-rw-r--r--packages/bank-ui/src/pages/SolveChallengePage.tsx43
1 files changed, 27 insertions, 16 deletions
diff --git a/packages/bank-ui/src/pages/SolveChallengePage.tsx b/packages/bank-ui/src/pages/SolveChallengePage.tsx
index b2e053b3c..528cc12df 100644
--- a/packages/bank-ui/src/pages/SolveChallengePage.tsx
+++ b/packages/bank-ui/src/pages/SolveChallengePage.tsx
@@ -34,21 +34,20 @@ import {
useLocalNotification,
useTranslationContext,
} from "@gnu-taler/web-util/browser";
-import { format } from "date-fns";
import { Fragment, VNode, h } from "preact";
import { useEffect, useState } from "preact/hooks";
import { ErrorLoadingWithDebug } from "../components/ErrorLoadingWithDebug.js";
+import { Time } from "../components/Time.js";
import { useBankCoreApiContext } from "../context/config.js";
+import { useNavigationContext } from "../context/navigation.js";
import { useWithdrawalDetails } from "../hooks/account.js";
-import { useSessionState } from "../hooks/session.js";
import { ChallengeInProgess, useBankState } from "../hooks/bank-state.js";
import { useConversionInfo } from "../hooks/regional.js";
+import { useSessionState } from "../hooks/session.js";
import { RouteDefinition } from "../route.js";
import { undefinedIfEmpty } from "../utils.js";
import { RenderAmount } from "./PaytoWireTransferForm.js";
import { OperationNotFound } from "./WithdrawalQRCode.js";
-import { useNavigationContext } from "../context/navigation.js";
-import { Time } from "../components/Time.js";
export function SolveChallengePage({
onChallengeCompleted,
@@ -107,6 +106,7 @@ export function SolveChallengePage({
title: i18n.str`Cashout not found. It may be also mean that it was already aborted.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
case HttpStatusCode.Unauthorized:
return notify({
@@ -114,6 +114,7 @@ export function SolveChallengePage({
title: i18n.str`Cashout not found. It may be also mean that it was already aborted.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
case TalerErrorCode.BANK_TAN_CHANNEL_SCRIPT_FAILED:
return notify({
@@ -121,6 +122,7 @@ export function SolveChallengePage({
title: i18n.str`Cashout not found. It may be also mean that it was already aborted.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
default:
assertUnreachable(resp);
@@ -145,6 +147,7 @@ export function SolveChallengePage({
title: i18n.str`Challenge not found.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
case HttpStatusCode.Unauthorized:
return notify({
@@ -152,6 +155,7 @@ export function SolveChallengePage({
title: i18n.str`This user is not authorized to complete this challenge.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
case HttpStatusCode.TooManyRequests:
return notify({
@@ -159,6 +163,7 @@ export function SolveChallengePage({
title: i18n.str`Too many attempts, try another code.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
case TalerErrorCode.BANK_TAN_CHALLENGE_FAILED:
return notify({
@@ -166,6 +171,7 @@ export function SolveChallengePage({
title: i18n.str`The confirmation code is wrong, try again.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
case TalerErrorCode.BANK_TAN_CHALLENGE_EXPIRED:
return notify({
@@ -173,6 +179,7 @@ export function SolveChallengePage({
title: i18n.str`The operation expired.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
default:
assertUnreachable(resp);
@@ -206,6 +213,7 @@ export function SolveChallengePage({
title: i18n.str`The operation failed.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
+ when: AbsoluteTime.now(),
});
}
// another challenge required, save the request and the ID
@@ -220,6 +228,7 @@ export function SolveChallengePage({
return notify({
type: "info",
title: i18n.str`The operation needs another confirmation to complete.`,
+ when: AbsoluteTime.now(),
});
}
updateBankState("currentChallenge", undefined);
@@ -267,7 +276,7 @@ export function SolveChallengePage({
onStart={startChallenge}
onCancel={() => {
updateBankState("currentChallenge", undefined);
- navigateTo(ch.location)
+ navigateTo(ch.location);
}}
/>
{ch.info && (
@@ -341,15 +350,15 @@ function ChallengeDetails({
onStart: () => void;
onCancel: () => void;
}): VNode {
- const { i18n, dateLocale } = useTranslationContext();
+ const { i18n } = useTranslationContext();
const { config } = useBankCoreApiContext();
- const firstTime = AbsoluteTime.isNever(challenge.sent)
+ const firstTime = AbsoluteTime.isNever(challenge.sent);
useEffect(() => {
if (firstTime) {
- onStart()
+ onStart();
}
- }, [])
+ }, []);
return (
<div class="px-4 mt-4 ">
<div class="w-full">
@@ -535,9 +544,11 @@ function ChallengeDetails({
<i18n.Translate>Sent at</i18n.Translate>
</dt>
<dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0">
- <Time format="dd/MM/yyyy HH:mm:ss"
+ <Time
+ format="dd/MM/yyyy HH:mm:ss"
timestamp={challenge.sent}
- relative={Duration.fromSpec({ days: 1 })} />
+ relative={Duration.fromSpec({ days: 1 })}
+ />
</dd>
</div>
)}
@@ -668,11 +679,11 @@ function ShowCashoutDetails({
switch (info.case) {
case HttpStatusCode.NotImplemented: {
return (
- <Attention
- type="danger"
- title={i18n.str`Cashout are disabled`}
- >
- <i18n.Translate>Cashout should be enable by configuration and the conversion rate should be initialized with fee, ratio and rounding mode.</i18n.Translate>
+ <Attention type="danger" title={i18n.str`Cashout are disabled`}>
+ <i18n.Translate>
+ Cashout should be enable by configuration and the conversion rate
+ should be initialized with fee, ratio and rounding mode.
+ </i18n.Translate>
</Attention>
);
}