From 219e48f35196e54361dc17d6ca7de6e095c46eeb Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 28 Nov 2022 15:33:45 -0300
Subject: fix #7497

---
 .../taler-wallet-webextension/src/NavigationBar.tsx  | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/NavigationBar.tsx')

diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx b/packages/taler-wallet-webextension/src/NavigationBar.tsx
index b900fab9d..8fb289aa6 100644
--- a/packages/taler-wallet-webextension/src/NavigationBar.tsx
+++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx
@@ -193,6 +193,16 @@ VNode {
 
 export function WalletNavBar({ path = "" }: { path?: string }): VNode {
   const { i18n } = useTranslationContext();
+
+  const api = wxApi; //FIXME: as parameter
+  const hook = useAsyncAsHook(async () => {
+    return await api.wallet.call(
+      WalletApiOperation.GetUserAttentionUnreadCount,
+      {},
+    );
+  });
+  const attentionCount = !hook || hook.hasError ? 0 : hook.response.total;
+
   return (
     <NavigationHeaderHolder>
       <NavigationHeader>
@@ -209,9 +219,13 @@ export function WalletNavBar({ path = "" }: { path?: string }): VNode {
           <i18n.Translate>Backup</i18n.Translate>
         </a>
 
-        <a href={Pages.notifications}>
-          <i18n.Translate>Notifications</i18n.Translate>
-        </a>
+        {attentionCount > 0 ? (
+          <a href={Pages.notifications}>
+            <i18n.Translate>Notifications</i18n.Translate>
+          </a>
+        ) : (
+          <Fragment />
+        )}
 
         <JustInDevMode>
           <a href={Pages.dev} class={path.startsWith("/dev") ? "active" : ""}>
-- 
cgit v1.2.3

