From 4853f796776aab39b5cd5b652df219c5092b0f46 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Thu, 29 Jun 2023 00:10:04 -0300
Subject: fix: #7875 - show retry on pending state

---
 .../src/wallet/Transaction.tsx                     | 38 ++++++++++++----------
 1 file changed, 21 insertions(+), 17 deletions(-)

(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 fbd6f6ea4..e164a28c5 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -43,14 +43,14 @@ import {
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { useTranslationContext } from "@gnu-taler/web-util/browser";
 import { styled } from "@linaria/react";
-import { differenceInSeconds, isPast } from "date-fns";
+import { isPast } from "date-fns";
 import { ComponentChildren, Fragment, h, VNode } from "preact";
 import { useEffect, useState } from "preact/hooks";
 import emptyImg from "../../static/img/empty.png";
 import { Amount } from "../components/Amount.js";
 import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType.js";
-import { CopyButton } from "../components/CopyButton.js";
 import { AlertView, ErrorAlertView } from "../components/CurrentAlerts.js";
+import { EnabledBySettings } from "../components/EnabledBySettings.js";
 import { Loading } from "../components/Loading.js";
 import { Kind, Part, PartCollapsible, PartPayto } from "../components/Part.js";
 import { QR } from "../components/QR.js";
@@ -59,24 +59,29 @@ import {
   CenteredDialog,
   ErrorBox,
   InfoBox,
+  Link,
   ListOfProducts,
   Overlay,
   Row,
   SmallLightText,
   SubTitle,
-  SuccessBox,
+  SvgIcon,
   WarningBox,
 } from "../components/styled/index.js";
 import { Time } from "../components/Time.js";
 import { alertFromError, useAlertContext } from "../context/alert.js";
 import { useBackendContext } from "../context/backend.js";
 import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
+import { useSettings } from "../hooks/useSettings.js";
 import { Button } from "../mui/Button.js";
 import { SafeHandler } from "../mui/handlers.js";
 import { Pages } from "../NavigationBar.js";
 import { assertUnreachable } from "../utils/index.js";
-import { EnabledBySettings } from "../components/EnabledBySettings.js";
-import { useSettings } from "../hooks/useSettings.js";
+import refreshIcon from "../svg/refresh_24px.inline.svg";
+import refreshIcon1 from "../svg/refresh_outlined_24px.inline.svg";
+import refreshIcon2 from "../svg/refresh_rounded_24px.inline.svg";
+import refreshIcon3 from "../svg/refresh_sharp_24px.inline.svg";
+import refreshIcon4 from "../svg/refresh_two_tone_24px.inline.svg";
 
 interface Props {
   tid: string;
@@ -271,7 +276,16 @@ function TransactionTemplate({
         )}
         {transaction.txState.major === TransactionMajorState.Pending && (
           <WarningBox>
-            <i18n.Translate>This transaction is not completed</i18n.Translate>
+            <div style={{ justifyContent: "center", lineHeight: "25px" }}>
+              <i18n.Translate>This transaction is not completed</i18n.Translate>
+              <Link onClick={onRetry}>
+                <SvgIcon
+                  title={i18n.str`Retry`}
+                  dangerouslySetInnerHTML={{ __html: refreshIcon }}
+                  color="black"
+                />
+              </Link>
+            </div>
           </WarningBox>
         )}
         {transaction.txState.major === TransactionMajorState.Aborted && (
@@ -360,14 +374,6 @@ function TransactionTemplate({
       <footer>
         <div />
         <div>
-          {showButton.retry && (
-            <Button
-              variant="contained"
-              onClick={safely("retry transaction", onRetry)}
-            >
-              <i18n.Translate>Retry</i18n.Translate>
-            </Button>
-          )}
           {showButton.abort && (
             <Button
               variant="contained"
@@ -1937,7 +1943,6 @@ function getShowButtonStates(transaction: Transaction) {
   let abort = false;
   let fail = false;
   let resume = false;
-  let retry = false;
   let remove = false;
   let suspend = false;
 
@@ -1959,14 +1964,13 @@ function getShowButtonStates(transaction: Transaction) {
         fail = true;
         break;
       case TransactionAction.Retry:
-        retry = true;
         break;
       default:
         assertUnreachable(a);
         break;
     }
   });
-  return { abort, fail, resume, retry, remove, suspend };
+  return { abort, fail, resume, remove, suspend };
 }
 
 function ShowWithdrawalDetailForBankIntegrated({
-- 
cgit v1.2.3

