From 505eb07d8e42d6787dc23b2024b76e05f807e1ad Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 6 Dec 2021 10:31:19 -0300
Subject: show error details in devmode

---
 packages/taler-wallet-webextension/src/wallet/Transaction.tsx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'packages/taler-wallet-webextension/src/wallet/Transaction.tsx')

diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index 6cc836f60..22947d0c4 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -24,6 +24,7 @@ import {
   TransactionType,
   WithdrawalType,
 } from "@gnu-taler/taler-util";
+import { differenceInSeconds } from "date-fns";
 import { ComponentChildren, Fragment, h, VNode } from "preact";
 import { route } from "preact-router";
 import { useState } from "preact/hooks";
@@ -110,6 +111,7 @@ export function TransactionView({
   onBack,
 }: WalletTransactionProps): VNode {
   const [confirmBeforeForget, setConfirmBeforeForget] = useState(false);
+
   function doCheckBeforeForget(): void {
     if (
       transaction.pending &&
@@ -120,11 +122,18 @@ export function TransactionView({
       onDelete();
     }
   }
+
   function TransactionTemplate({
     children,
   }: {
     children: ComponentChildren;
   }): VNode {
+    const showRetry =
+      transaction.error !== undefined ||
+      transaction.timestamp.t_ms === "never" ||
+      (transaction.pending &&
+        differenceInSeconds(new Date(), transaction.timestamp.t_ms) > 10);
+
     return (
       <Fragment>
         <section style={{ padding: 8, textAlign: "center" }}>
@@ -144,7 +153,7 @@ export function TransactionView({
             <i18n.Translate> &lt; Back </i18n.Translate>
           </Button>
           <div>
-            {transaction?.error ? (
+            {showRetry ? (
               <ButtonPrimary onClick={onRetry}>
                 <i18n.Translate>retry</i18n.Translate>
               </ButtonPrimary>
-- 
cgit v1.2.3

