gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: fix: #7072


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix: #7072
Date: Wed, 13 Apr 2022 21:10:39 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new bd76b5d7 fix: #7072
bd76b5d7 is described below

commit bd76b5d76f0e03d2d511b6cc0aae4636a2ec52c9
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Apr 13 16:10:11 2022 -0300

    fix: #7072
---
 packages/anastasis-webui/src/pages/home/index.tsx | 40 ++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/packages/anastasis-webui/src/pages/home/index.tsx 
b/packages/anastasis-webui/src/pages/home/index.tsx
index 7d191ae0..cf31d68e 100644
--- a/packages/anastasis-webui/src/pages/home/index.tsx
+++ b/packages/anastasis-webui/src/pages/home/index.tsx
@@ -6,7 +6,7 @@ import {
   h,
   VNode,
 } from "preact";
-import { useErrorBoundary } from "preact/hooks";
+import { useCallback, useEffect, useErrorBoundary } from "preact/hooks";
 import { AsyncButton } from "../../components/AsyncButton";
 import { Menu } from "../../components/menu";
 import { Notifications } from "../../components/Notifications";
@@ -103,6 +103,28 @@ export function AnastasisClientFrame(props: 
AnastasisClientFrameProps): VNode {
     } else {
       await reducer.transition("next", {});
     }
+    reducer.currentReducerState?.reducer_type;
+
+    const stateName = !reducer.currentReducerState
+      ? "not-defined"
+      : reducer.currentReducerState.reducer_type === "backup"
+      ? `#backup-${reducer.currentReducerState.backup_state}`
+      : reducer.currentReducerState.reducer_type === "recovery"
+      ? `recovery-${reducer.currentReducerState.recovery_state}`
+      : reducer.currentReducerState.reducer_type === "error"
+      ? `error-${reducer.currentReducerState.code}`
+      : "unknown";
+
+    const id: number =
+      typeof history.state.id === "number" ? history.state.id : 1;
+
+    history.pushState(
+      {
+        id: id + 1,
+      },
+      "unused",
+      stateName,
+    );
   };
   const handleKeyPress = (
     e: h.JSX.TargetedKeyboardEvent<HTMLDivElement>,
@@ -110,6 +132,22 @@ export function AnastasisClientFrame(props: 
AnastasisClientFrameProps): VNode {
     console.log("Got key press", e.key);
     // FIXME: By default, "next" action should be executed here
   };
+
+  const browserOnBackButton = useCallback((ev: PopStateEvent) => {
+    console.log("BACK BACK", JSON.stringify(ev.state));
+    reducer.back();
+    // reducer
+    return false;
+  }, []);
+
+  useEffect(() => {
+    window.addEventListener("popstate", browserOnBackButton);
+
+    return () => {
+      window.removeEventListener("popstate", browserOnBackButton);
+    };
+  }, []);
+
   return (
     <Fragment>
       <Menu title="Anastasis" />

-- 
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]