diff options
Diffstat (limited to 'packages/demobank-ui/src/pages/ProfileNavigation.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/ProfileNavigation.tsx | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/packages/demobank-ui/src/pages/ProfileNavigation.tsx b/packages/demobank-ui/src/pages/ProfileNavigation.tsx index 607487c9d..94669584a 100644 --- a/packages/demobank-ui/src/pages/ProfileNavigation.tsx +++ b/packages/demobank-ui/src/pages/ProfileNavigation.tsx @@ -15,16 +15,24 @@ */ import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { VNode, h } from "preact"; -import { privatePages } from "../Routing.js"; import { useBankCoreApiContext } from "../context/config.js"; import { useBackendState } from "../hooks/backend.js"; import { assertUnreachable } from "@gnu-taler/taler-util"; import { useNavigationContext } from "../context/navigation.js"; +import { RouteDefinition } from "../route.js"; export function ProfileNavigation({ current, + routeMyAccountCashout, + routeMyAccountDelete, + routeMyAccountDetails, + routeMyAccountPassword, }: { - current: "details" | "delete" | "credentials" | "cashouts"; + current: "details" | "delete" | "credentials" | "cashouts", + routeMyAccountDetails: RouteDefinition<Record<string, never>>; + routeMyAccountDelete: RouteDefinition<Record<string, never>>; + routeMyAccountPassword: RouteDefinition<Record<string, never>>; + routeMyAccountCashout: RouteDefinition<Record<string, never>>; }): VNode { const { i18n } = useTranslationContext(); const { config } = useBankCoreApiContext(); @@ -48,19 +56,19 @@ export function ProfileNavigation({ const op = e.currentTarget.value as typeof current; switch (op) { case "details": { - navigateTo(privatePages.myAccountDetails.url({})); + navigateTo(routeMyAccountDetails.url({})); return; } case "delete": { - navigateTo(privatePages.myAccountDelete.url({})); + navigateTo(routeMyAccountDelete.url({})); return; } case "credentials": { - navigateTo(privatePages.myAccountPassword.url({})); + navigateTo(routeMyAccountPassword.url({})); return; } case "cashouts": { - navigateTo(privatePages.myAccountCashouts.url({})); + navigateTo(routeMyAccountCashout.url({})); return; } default: @@ -92,7 +100,7 @@ export function ProfileNavigation({ aria-label="Tabs" > <a - href={privatePages.myAccountDetails.url({})} + href={routeMyAccountDetails.url({})} data-selected={current == "details"} class="rounded-l-lg text-gray-500 hover:text-gray-700 data-[selected=true]:text-gray-900 group relative min-w-0 flex-1 overflow-hidden bg-white py-4 px-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10" > @@ -107,7 +115,7 @@ export function ProfileNavigation({ </a> {!config.allow_deletions ? undefined : ( <a - href={privatePages.myAccountDelete.url({})} + href={routeMyAccountDelete.url({})} data-selected={current == "delete"} aria-current="page" class=" text-gray-500 hover:text-gray-700 data-[selected=true]:text-gray-900 group relative min-w-0 flex-1 overflow-hidden bg-white py-4 px-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10" @@ -123,7 +131,7 @@ export function ProfileNavigation({ </a> )} <a - href={privatePages.myAccountPassword.url({})} + href={routeMyAccountPassword.url({})} data-selected={current == "credentials"} aria-current="page" class=" text-gray-500 hover:text-gray-700 data-[selected=true]:text-gray-900 group relative min-w-0 flex-1 overflow-hidden bg-white py-4 px-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10" @@ -139,7 +147,7 @@ export function ProfileNavigation({ </a> {config.allow_conversion && nonAdminUser ? ( <a - href={privatePages.myAccountCashouts.url({})} + href={routeMyAccountCashout.url({})} data-selected={current == "cashouts"} class="rounded-r-lg text-gray-500 hover:text-gray-700 data-[selected=true]:text-gray-900 group relative min-w-0 flex-1 overflow-hidden bg-white py-4 px-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10" > |