[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 11/19: no-fix: removing unused showPublicHistories
From: |
gnunet |
Subject: |
[taler-wallet-core] 11/19: no-fix: removing unused showPublicHistories |
Date: |
Wed, 07 Dec 2022 20:08:39 +0100 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository wallet-core.
commit 93dc9b947ffc2bcbc8053c05c31850288bf1a22c
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Dec 7 11:39:57 2022 -0300
no-fix: removing unused showPublicHistories
---
packages/demobank-ui/src/context/pageState.ts | 3 --
packages/demobank-ui/src/pages/home/BankFrame.tsx | 19 +-----------
.../src/pages/home/PublicHistoriesPage.tsx | 34 ++++++++--------------
3 files changed, 13 insertions(+), 43 deletions(-)
diff --git a/packages/demobank-ui/src/context/pageState.ts
b/packages/demobank-ui/src/context/pageState.ts
index 3d7ccd85b..4ef21b8f0 100644
--- a/packages/demobank-ui/src/context/pageState.ts
+++ b/packages/demobank-ui/src/context/pageState.ts
@@ -31,7 +31,6 @@ const initial: Type = {
pageState: {
isLoggedIn: false,
isRawPayto: false,
- showPublicHistories: false,
withdrawalInProgress: false,
},
pageStateSetter: () => {
@@ -62,7 +61,6 @@ function usePageState(
state: PageStateType = {
isLoggedIn: false,
isRawPayto: false,
- showPublicHistories: false,
withdrawalInProgress: false,
},
): [PageStateType, StateUpdater<PageStateType>] {
@@ -102,7 +100,6 @@ function usePageState(
export interface PageStateType {
isLoggedIn: boolean;
isRawPayto: boolean;
- showPublicHistories: boolean;
withdrawalInProgress: boolean;
error?: {
description?: string;
diff --git a/packages/demobank-ui/src/pages/home/BankFrame.tsx
b/packages/demobank-ui/src/pages/home/BankFrame.tsx
index 9b4bc4567..2d405e58c 100644
--- a/packages/demobank-ui/src/pages/home/BankFrame.tsx
+++ b/packages/demobank-ui/src/pages/home/BankFrame.tsx
@@ -75,13 +75,7 @@ export function BankFrame(Props: any): VNode {
This part of the demo shows how a bank that supports Taler
directly would work. In addition to using your own bank
account,
you can also see the transaction history of some{" "}
- <a
- href="/public-accounts"
- onClick={goPublicAccounts(pageStateSetter)}
- >
- Public Accounts
- </a>
- .
+ <a href="/public-accounts">Public Accounts</a>.
</i18n.Translate>
</p>,
)}
@@ -134,17 +128,6 @@ function maybeDemoContent(content: VNode): VNode {
return <Fragment />;
}
-/**
- * Bring the state to show the public accounts page.
- */
-function goPublicAccounts(pageStateSetter: StateUpdater<PageStateType>) {
- return () =>
- pageStateSetter((prevState) => ({
- ...prevState,
- showPublicHistories: true,
- }));
-}
-
function ErrorBanner(Props: any): VNode | null {
const [pageState, pageStateSetter] = Props.pageState;
// const { i18n } = useTranslationContext();
diff --git a/packages/demobank-ui/src/pages/home/PublicHistoriesPage.tsx
b/packages/demobank-ui/src/pages/home/PublicHistoriesPage.tsx
index 216808e5c..215dc7321 100644
--- a/packages/demobank-ui/src/pages/home/PublicHistoriesPage.tsx
+++ b/packages/demobank-ui/src/pages/home/PublicHistoriesPage.tsx
@@ -16,6 +16,7 @@
import { hooks } from "@gnu-taler/web-util/lib/index.browser";
import { Fragment, h, VNode } from "preact";
+import { route } from "preact-router";
import { StateUpdater } from "preact/hooks";
import useSWR, { SWRConfig } from "swr";
import { PageStateType, usePageContext } from "../../context/pageState.js";
@@ -25,25 +26,10 @@ import { BankFrame } from "./BankFrame.js";
import { Transactions } from "./Transactions.js";
export function PublicHistoriesPage(): VNode {
- const { pageState, pageStateSetter } = usePageContext();
- // const { i18n } = useTranslationContext();
return (
<SWRWithoutCredentials baseUrl={getBankBackendBaseUrl()}>
<BankFrame>
- <PublicHistories pageStateSetter={pageStateSetter}>
- <br />
- <a
- class="pure-button"
- onClick={() => {
- pageStateSetter((prevState: PageStateType) => ({
- ...prevState,
- showPublicHistories: false,
- }));
- }}
- >
- Go back
- </a>
- </PublicHistories>
+ <PublicHistories />
</BankFrame>
</SWRWithoutCredentials>
);
@@ -71,7 +57,8 @@ function SWRWithoutCredentials(Props: any): VNode {
/**
* Show histories of public accounts.
*/
-function PublicHistories(Props: any): VNode {
+function PublicHistories(): VNode {
+ const { pageState, pageStateSetter } = usePageContext();
const [showAccount, setShowAccount] = useShowPublicAccount();
const { data, error } = useSWR("access-api/public-accounts");
const { i18n } = useTranslationContext();
@@ -81,10 +68,10 @@ function PublicHistories(Props: any): VNode {
switch (error.status) {
case 404:
console.log("public accounts: 404", error);
- Props.pageStateSetter((prevState: PageStateType) => ({
+ route("/account");
+ pageStateSetter((prevState: PageStateType) => ({
...prevState,
- showPublicHistories: false,
error: {
title: i18n.str`List of public accounts was not found.`,
debug: JSON.stringify(error),
@@ -93,10 +80,10 @@ function PublicHistories(Props: any): VNode {
break;
default:
console.log("public accounts: non-404 error", error);
- Props.pageStateSetter((prevState: PageStateType) => ({
+ route("/account");
+ pageStateSetter((prevState: PageStateType) => ({
...prevState,
- showPublicHistories: false,
error: {
title: i18n.str`List of public accounts could not be retrieved.`,
debug: JSON.stringify(error),
@@ -155,7 +142,10 @@ function PublicHistories(Props: any): VNode {
) : (
<p>No public transactions found.</p>
)}
- {Props.children}
+ <br />
+ <a href="/account" class="pure-button">
+ Go back
+ </a>
</div>
</article>
</section>
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-wallet-core] branch master updated (0c19050ae -> 46835d515), gnunet, 2022/12/07
- [taler-wallet-core] 03/19: fix: remove red style when input is invalid, gnunet, 2022/12/07
- [taler-wallet-core] 04/19: no-fix: move out useBackend hook, gnunet, 2022/12/07
- [taler-wallet-core] 02/19: no-fix: move pagestate provider to app component and move some common hooks to web-utils, gnunet, 2022/12/07
- [taler-wallet-core] 13/19: also listen for tab title change, gnunet, 2022/12/07
- [taler-wallet-core] 01/19: pretty, gnunet, 2022/12/07
- [taler-wallet-core] 05/19: fix: empty form should not allow the "send" button, gnunet, 2022/12/07
- [taler-wallet-core] 19/19: no-fix: user logger instead of console.log, gnunet, 2022/12/07
- [taler-wallet-core] 11/19: no-fix: removing unused showPublicHistories,
gnunet <=
- [taler-wallet-core] 15/19: fix jsx config, gnunet, 2022/12/07
- [taler-wallet-core] 14/19: fix: updating the title is better that location.hash, gnunet, 2022/12/07
- [taler-wallet-core] 08/19: no-fix: move out routing, gnunet, 2022/12/07
- [taler-wallet-core] 16/19: no-fix: remove unused, gnunet, 2022/12/07
- [taler-wallet-core] 12/19: no-fix: moved out AccountPage, gnunet, 2022/12/07
- [taler-wallet-core] 07/19: fix: show error message on login and registration form, prevent saving password on localstorage, gnunet, 2022/12/07
- [taler-wallet-core] 18/19: feature: useLocalStorage also update when the localStorage has been updated from other window, gnunet, 2022/12/07
- [taler-wallet-core] 06/19: fix: better loading page while waiting for server response, gnunet, 2022/12/07
- [taler-wallet-core] 17/19: no-fix: remove 'any' and login status is taken from backend, gnunet, 2022/12/07
- [taler-wallet-core] 09/19: no-fix: moving out public histories page, gnunet, 2022/12/07