From e05ba843a061c8050648ce922f36ed3d8e1cf24a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 24 Nov 2022 23:16:01 -0300 Subject: fix 7465 --- .../src/NavigationBar.tsx | 45 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 4 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 ff2404800..b900fab9d 100644 --- a/packages/taler-wallet-webextension/src/NavigationBar.tsx +++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx @@ -24,7 +24,7 @@ /** * Imports. */ -import { h, VNode } from "preact"; +import { Fragment, h, VNode } from "preact"; import { NavigationHeader, NavigationHeaderHolder, @@ -33,6 +33,11 @@ import { import { useTranslationContext } from "./context/translation.js"; import settingsIcon from "./svg/settings_black_24dp.svg"; import qrIcon from "./svg/qr_code_24px.svg"; +import warningIcon from "./svg/warning_24px.svg"; +import { useAsyncAsHook } from "./hooks/useAsyncAsHook.js"; +import { wxApi } from "./wxApi.js"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { JustInDevMode } from "./components/JustInDevMode.js"; /** * List of pages used by the wallet @@ -102,6 +107,7 @@ export const Pages = { backupProviderAdd: "/backup/provider/add", qr: "/qr", + notifications: "/notifications", settings: "/settings", settingsExchangeAdd: pageDefinition<{ currency?: string }>( "/settings/exchange/add/:currency?", @@ -127,7 +133,21 @@ export const Pages = { ), }; -export function PopupNavBar({ path = "" }: { path?: string }): VNode { +export function PopupNavBar({ + path = "", +}: { + path?: string; +}): // api: typeof wxApi, +VNode { + 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; + const { i18n } = useTranslationContext(); return ( @@ -141,6 +161,17 @@ export function PopupNavBar({ path = "" }: { path?: string }): VNode { Backup
+ {attentionCount > 0 ? ( + + + + ) : ( + + )} Backup - - Dev + + Notifications + + + Dev + + +
-- cgit v1.2.3