gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (a51abcff -> c13f3cf1)


From: gnunet
Subject: [taler-wallet-core] branch master updated (a51abcff -> c13f3cf1)
Date: Tue, 25 Jan 2022 14:29:49 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a change to branch master
in repository wallet-core.

    from a51abcff make refund-gone test case pass again (see #7158)
     new a06f7f7c -fix: autocomplete check
     new c13f3cf1 fix #7162

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/anastasis-webui/.storybook/preview.js     |  8 +++-
 .../src/pages/home/AttributeEntryScreen.tsx        |  2 +-
 .../src/NavigationBar.tsx                          |  2 +-
 packages/taler-wallet-webextension/src/cta/Tip.tsx |  3 +-
 .../src/popupEntryPoint.tsx                        |  7 ----
 .../src/wallet/ManualWithdrawPage.tsx              | 12 +++---
 .../src/wallet/ReserveCreated.tsx                  |  6 +--
 .../src/wallet/Transaction.tsx                     | 48 +++++++++-------------
 .../src/walletEntryPoint.tsx                       | 24 ++++++++---
 9 files changed, 58 insertions(+), 54 deletions(-)

diff --git a/packages/anastasis-webui/.storybook/preview.js 
b/packages/anastasis-webui/.storybook/preview.js
index 9ab4d940..4b61856e 100644
--- a/packages/anastasis-webui/.storybook/preview.js
+++ b/packages/anastasis-webui/.storybook/preview.js
@@ -23,8 +23,12 @@ export const parameters = {
   controls: { expanded: true },
   options: {
     storySort: (a, b) => {
-      return (a[1].args.order ?? 0) - (b[1].args.order ?? 0)
-      // return a[1].kind === b[1].kind ? 0 : a[1].id.localeCompare(b[1].id, 
undefined, { numeric: true })
+      if (!a || !a[1]) {
+        // 
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#v7-style-story-sort
+        console.log(a, b)
+        return (a?.args.order ?? 0) - (b?.args.order ?? 0)
+      }
+      return (a?.[1]?.args?.order ?? 0) - (b?.[1]?.args?.order ?? 0)
     }
   },
 }
diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx 
b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx
index a1f38474..c14365d2 100644
--- a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx
@@ -40,7 +40,7 @@ export function AttributeEntryScreen(): VNode {
 
     function addAutocomplete(newValue: string): string {
       const ac = spec.autocomplete;
-      if (!ac || ac.length < newValue.length || ac[newValue.length] === "?")
+      if (!ac || ac.length <= newValue.length || ac[newValue.length] === "?")
         return newValue;
 
       if (!value || newValue.length < value.length) {
diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx 
b/packages/taler-wallet-webextension/src/NavigationBar.tsx
index c16bcb53..9aaeb0d1 100644
--- a/packages/taler-wallet-webextension/src/NavigationBar.tsx
+++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx
@@ -32,7 +32,7 @@ export enum Pages {
   welcome = "/welcome",
 
   balance = "/balance",
-  balance_history = "/balance/history/:currency",
+  balance_history = "/balance/history/:currency?",
   balance_manual_withdraw = "/balance/manual-withdraw/:currency?",
   balance_deposit = "/balance/deposit/:currency",
   balance_transaction = "/balance/transaction/:tid",
diff --git a/packages/taler-wallet-webextension/src/cta/Tip.tsx 
b/packages/taler-wallet-webextension/src/cta/Tip.tsx
index 5a9ab720..3f8b09bd 100644
--- a/packages/taler-wallet-webextension/src/cta/Tip.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Tip.tsx
@@ -23,6 +23,7 @@
 import { PrepareTipResult } from "@gnu-taler/taler-util";
 import { h, VNode } from "preact";
 import { useEffect, useState } from "preact/hooks";
+import { Loading } from "../components/Loading";
 import { AmountView } from "../renderHtml";
 import * as wxApi from "../wxApi";
 
@@ -105,7 +106,7 @@ export function TipPage({ talerTipUri }: Props): VNode {
   }
 
   if (!prepareTipResult) {
-    return <span>Loading ...</span>;
+    return <Loading />;
   }
 
   return (
diff --git a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx 
b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx
index 5169c854..80e67f88 100644
--- a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx
+++ b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx
@@ -127,13 +127,6 @@ function Application(): VNode {
 
               <Route path={Pages.pending} component={Pending} />
 
-              <Route
-                path={Pages.balance_transaction}
-                component={({ tid }: { tid: string }) =>
-                  goToWalletPage(Pages.balance_transaction.replace(":tid", 
tid))
-                }
-              />
-
               <Route
                 path={Pages.backup}
                 component={BackupPage}
diff --git 
a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
index 86c3c145..1f860379 100644
--- a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
@@ -21,7 +21,6 @@ import {
   NotificationType,
 } from "@gnu-taler/taler-util";
 import { h, VNode } from "preact";
-import { route } from "preact-router";
 import { useState } from "preact/hooks";
 import { Loading } from "../components/Loading";
 import { LoadingError } from "../components/LoadingError";
@@ -32,7 +31,12 @@ import { CreateManualWithdraw } from 
"./CreateManualWithdraw";
 import { ExchangeAddPage } from "./ExchangeAddPage";
 import { ReserveCreated } from "./ReserveCreated";
 
-export function ManualWithdrawPage({ currency }: { currency?: string }): VNode 
{
+interface Props {
+  currency?: string;
+  onCancel: () => void;
+}
+
+export function ManualWithdrawPage({ currency, onCancel }: Props): VNode {
   const [success, setSuccess] = useState<
     | {
         response: AcceptManualWithdrawalResult;
@@ -80,9 +84,7 @@ export function ManualWithdrawPage({ currency }: { currency?: 
string }): VNode {
         payto={success.response.exchangePaytoUris[0]}
         exchangeBaseUrl={success.exchangeBaseUrl}
         amount={success.amount}
-        onBack={() => {
-          route(Pages.balance);
-        }}
+        onCancel={onCancel}
       />
     );
   }
diff --git a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx 
b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
index ae820d8f..7ccef2da 100644
--- a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
@@ -9,13 +9,13 @@ export interface Props {
   payto: string;
   exchangeBaseUrl: string;
   amount: AmountJson;
-  onBack: () => void;
+  onCancel: () => void;
 }
 
 export function ReserveCreated({
   reservePub,
   payto,
-  onBack,
+  onCancel,
   exchangeBaseUrl,
   amount,
 }: Props): VNode {
@@ -55,7 +55,7 @@ export function ReserveCreated({
       </section>
       <footer>
         <div />
-        <ButtonDestructive onClick={onBack}>
+        <ButtonDestructive onClick={onCancel}>
           Cancel withdrawal
         </ButtonDestructive>
       </footer>
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx 
b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index 21bfc943..423a641a 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -26,11 +26,12 @@ import {
 } 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";
 import emptyImg from "../../static/img/empty.png";
 import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType";
 import { ErrorTalerOperation } from "../components/ErrorTalerOperation";
+import { Loading } from "../components/Loading";
+import { LoadingError } from "../components/LoadingError";
 import { Part } from "../components/Part";
 import {
   Button,
@@ -49,7 +50,11 @@ import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
 import { Pages } from "../NavigationBar";
 import * as wxApi from "../wxApi";
 
-export function TransactionPage({ tid }: { tid: string }): VNode {
+interface Props {
+  tid: string;
+  goToWalletHistory: (currency?: string) => void;
+}
+export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
   async function getTransaction(): Promise<Transaction> {
     const res = await wxApi.getTransactions();
     const ts = res.transactions.filter((t) => t.transactionId === tid);
@@ -65,43 +70,30 @@ export function TransactionPage({ tid }: { tid: string }): 
VNode {
   ]);
 
   if (!state) {
-    return (
-      <div>
-        <i18n.Translate>Loading ...</i18n.Translate>
-      </div>
-    );
+    return <Loading />;
   }
 
   if (state.hasError) {
-    route(Pages.balance);
     return (
-      <div>
-        <i18n.Translate>
-          There was an error. Redirecting into the history page
-        </i18n.Translate>
-      </div>
+      <LoadingError
+        title="Could not load the transaction information"
+        error={state}
+      />
     );
   }
 
-  function goToHistory(): void {
-    const currency =
-      state !== undefined && !state.hasError
-        ? Amounts.parseOrThrow(state.response.amountRaw).currency
-        : undefined;
-
-    if (currency) {
-      route(Pages.balance_history.replace(":currency", currency));
-    } else {
-      route(Pages.balance);
-    }
-  }
+  const currency = Amounts.parse(state.response.amountRaw)?.currency;
 
   return (
     <TransactionView
       transaction={state.response}
-      onDelete={() => wxApi.deleteTransaction(tid).then(goToHistory)}
-      onRetry={() => wxApi.retryTransaction(tid).then(goToHistory)}
-      onBack={goToHistory}
+      onDelete={() =>
+        wxApi.deleteTransaction(tid).then(() => goToWalletHistory(currency))
+      }
+      onRetry={() =>
+        wxApi.retryTransaction(tid).then(() => goToWalletHistory(currency))
+      }
+      onBack={() => goToWalletHistory(currency)}
     />
   );
 }
diff --git a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx 
b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
index c8bbc7f7..629b93fc 100644
--- a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
+++ b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
@@ -121,12 +121,6 @@ function Application(): VNode {
                  * BALANCE
                  */}
 
-                <Route
-                  path={Pages.balance}
-                  component={Redirect}
-                  to={Pages.balance_history.replace(":currency", "")}
-                />
-
                 <Route
                   path={Pages.balance_history}
                   component={HistoryPage}
@@ -145,11 +139,22 @@ function Application(): VNode {
                 <Route
                   path={Pages.balance_transaction}
                   component={TransactionPage}
+                  goToWalletHistory={(currency?: string) => {
+                    route(
+                      Pages.balance_history.replace(
+                        ":currency",
+                        currency || "",
+                      ),
+                    );
+                  }}
                 />
 
                 <Route
                   path={Pages.balance_manual_withdraw}
                   component={ManualWithdrawPage}
+                  onCancel={() => {
+                    route(Pages.balance);
+                  }}
                 />
 
                 <Route
@@ -232,7 +237,14 @@ function Application(): VNode {
 
                 {/**
                  * NOT FOUND
+                 * all redirects should be at the end
                  */}
+                <Route
+                  path={Pages.balance}
+                  component={Redirect}
+                  to={Pages.balance_history.replace(":currency", "")}
+                />
+
                 <Route
                   default
                   component={Redirect}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]