gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: use preact matcher internal a


From: gnunet
Subject: [taler-wallet-core] branch master updated: use preact matcher internal api call
Date: Fri, 03 Jun 2022 15:19:42 +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 d2563c16 use preact matcher internal api call
d2563c16 is described below

commit d2563c16473b2848ecf8a45474dd43983faceac0
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Jun 3 10:19:33 2022 -0300

    use preact matcher internal api call
---
 .../src/wallet/Application.tsx                     | 23 ++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx 
b/packages/taler-wallet-webextension/src/wallet/Application.tsx
index 84aa0dd8..b0527f72 100644
--- a/packages/taler-wallet-webextension/src/wallet/Application.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx
@@ -247,8 +247,23 @@ function Redirect({ to }: { to: string }): null {
   return null;
 }
 
-function shouldShowPendingOperations(path: string): boolean {
-  // FIXME: replace includes with a match API like preact router does
-  // [Pages.balanceHistory, Pages.dev, Pages.settings, Pages.backup]
-  return ["/balance/history/", "/dev", "/settings", "/backup"].includes(path);
+function matchesRoute(url: string, route: string): boolean {
+  type MatcherFunc = (
+    url: string,
+    route: string,
+    opts: any,
+  ) => Record<string, string> | false;
+
+  const internalPreactMatcher: MatcherFunc = (Router as any).exec;
+  const result = internalPreactMatcher(url, route, {});
+  return !result ? false : true;
+}
+
+function shouldShowPendingOperations(url: string): boolean {
+  return [
+    Pages.balanceHistory.pattern,
+    Pages.dev,
+    Pages.settings,
+    Pages.backup,
+  ].some((p) => matchesRoute(url, p));
 }

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