From 6787772107034033b274f09482bd8efc37317815 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 27 May 2024 11:28:22 -0300 Subject: =?UTF-8?q?dd53:=20Valid=20until=E2=80=9D=20is=20likely=20confusin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/cta/InvoicePay/views.tsx | 21 ++++++++++---- .../src/cta/Payment/views.tsx | 32 ++++++++++++++-------- .../src/cta/TransferPickup/views.tsx | 22 ++++++++++----- 3 files changed, 52 insertions(+), 23 deletions(-) (limited to 'packages/taler-wallet-webextension/src/cta') diff --git a/packages/taler-wallet-webextension/src/cta/InvoicePay/views.tsx b/packages/taler-wallet-webextension/src/cta/InvoicePay/views.tsx index 547d5ac9a..0d8035136 100644 --- a/packages/taler-wallet-webextension/src/cta/InvoicePay/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/InvoicePay/views.tsx @@ -24,12 +24,21 @@ import { InvoicePaymentDetails, } from "../../wallet/Transaction.js"; import { State } from "./index.js"; +import { AbsoluteTime, Duration } from "@gnu-taler/taler-util"; export function ReadyView( state: State.Ready | State.NoBalanceForCurrency | State.NoEnoughBalance, ): VNode { const { i18n } = useTranslationContext(); const { summary, effective, raw, expiration, uri, status, payStatus } = state; + + const inFiveMinutes = AbsoluteTime.addDuration( + AbsoluteTime.now(), + Duration.fromSpec({ minutes: 5 }), + ); + const willExpireSoon = + expiration && AbsoluteTime.cmp(expiration, inFiveMinutes) === -1; + return (
@@ -42,11 +51,13 @@ export function ReadyView( /> } /> - } - kind="neutral" - /> + {willExpireSoon && ( + } + kind="neutral" + /> + )}
@@ -65,7 +77,12 @@ export function BaseView(state: SupportedStates): VNode { Purchase   - {contractTerms.minimum_age}+ + + {contractTerms.minimum_age}+ + ) : ( Purchase @@ -79,17 +96,10 @@ export function BaseView(state: SupportedStates): VNode { text={} kind="neutral" /> - {contractTerms.pay_deadline && ( + {willExpireSoon && ( - } + title={i18n.str`Expires at`} + text={