diff options
Diffstat (limited to 'packages/demobank-ui/src/pages/BankFrame.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/BankFrame.tsx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/packages/demobank-ui/src/pages/BankFrame.tsx b/packages/demobank-ui/src/pages/BankFrame.tsx index d6ab882f1..f16e0e9bf 100644 --- a/packages/demobank-ui/src/pages/BankFrame.tsx +++ b/packages/demobank-ui/src/pages/BankFrame.tsx @@ -26,7 +26,6 @@ import { } from "@gnu-taler/web-util/browser"; import { ComponentChildren, VNode, h } from "preact"; import { useEffect, useErrorBoundary } from "preact/hooks"; -import { privatePages } from "../Routing.js"; import { useBankCoreApiContext } from "../context/config.js"; import { useSettingsContext } from "../context/settings.js"; import { useAccountDetails } from "../hooks/access.js"; @@ -38,6 +37,7 @@ import { usePreferences, } from "../hooks/preferences.js"; import { RenderAmount } from "./PaytoWireTransferForm.js"; +import { RouteDefinition } from "../route.js"; const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined; const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : undefined; @@ -45,8 +45,10 @@ const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : undefined; export function BankFrame({ children, account, + routeAccountDetails, }: { account?: string; + routeAccountDetails?: RouteDefinition<Record<string, never>>; children: ComponentChildren; }): VNode { const { i18n } = useTranslationContext(); @@ -86,9 +88,9 @@ export function BankFrame({ backend.state.status !== "loggedIn" ? undefined : () => { - backend.logOut(); - resetBankState(); - } + backend.logOut(); + resetBankState(); + } } sites={ !settings.topNavSites ? [] : Object.entries(settings.topNavSites) @@ -143,12 +145,12 @@ export function BankFrame({ <GlobalNotificationsBanner /> <main class="-mt-32 flex-1"> - {account && ( + {account && routeAccountDetails && ( <header class="py-5 bg-indigo-600 "> <div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8"> <h1 class=" flex flex-wrap items-center justify-between sm:flex-nowrap"> <span class="text-2xl font-bold tracking-tight text-white"> - <WelcomeAccount account={account} /> + <WelcomeAccount account={account} routeAccountDetails={routeAccountDetails} /> </span> <span class="text-2xl font-bold tracking-tight text-white"> <AccountBalance account={account} /> @@ -174,7 +176,10 @@ export function BankFrame({ ); } -function WelcomeAccount({ account }: { account: string }): VNode { +function WelcomeAccount({ account, routeAccountDetails }: { + account: string, + routeAccountDetails: RouteDefinition<Record<string, never>>; +}): VNode { const { i18n } = useTranslationContext(); const result = useAccountDetails(account); if (!result) { @@ -186,7 +191,7 @@ function WelcomeAccount({ account }: { account: string }): VNode { if (result.type === "fail") { return ( <a - href={privatePages.myAccountDetails.url({})} + href={routeAccountDetails.url({})} class="underline underline-offset-2" > <i18n.Translate>Welcome</i18n.Translate> @@ -195,7 +200,7 @@ function WelcomeAccount({ account }: { account: string }): VNode { } return ( <a - href={privatePages.myAccountDetails.url({})} + href={routeAccountDetails.url({})} class="underline underline-offset-2" > <i18n.Translate> |