diff --git a/packages/merchant-backoffice-ui/src/Application.tsx b/packages/merchant-backoffice-ui/src/Application.tsx index 23510c456..f6a81ff8d 100644 --- a/packages/merchant-backoffice-ui/src/Application.tsx +++ b/packages/merchant-backoffice-ui/src/Application.tsx @@ -26,7 +26,7 @@ import { } from "@gnu-taler/web-util/browser"; import { Fragment, h, VNode } from "preact"; import { route } from "preact-router"; -import { useMemo } from "preact/hooks"; +import { useMemo, useState } from "preact/hooks"; import { ApplicationReadyRoutes } from "./ApplicationReadyRoutes.js"; import { Loading } from "./components/exception/loading.js"; import { @@ -42,6 +42,7 @@ import { useBackendConfig } from "./hooks/backend.js"; import { strings } from "./i18n/strings.js"; import LoginPage from "./paths/login/index.js"; import { HttpStatusCode } from "@gnu-taler/taler-util"; +import { Settings } from "./paths/settings/index.js"; export function Application(): VNode { return ( @@ -70,10 +71,19 @@ function ApplicationStatusRoutes(): VNode { : { currency: "unknown", version: "unknown" }; const ctx = useMemo(() => ({ currency, version }), [currency, version]); + const [showSettings, setShowSettings] = useState(false) + + if (showSettings) { + return + setShowSettings(true)} title="UI Settings" /> + + + } + if (!triedToLog) { return ( - + setShowSettings(true)} /> ); @@ -87,7 +97,7 @@ function ApplicationStatusRoutes(): VNode { ) { return ( - + setShowSettings(true)} /> ); @@ -98,7 +108,7 @@ function ApplicationStatusRoutes(): VNode { ) { return ( - + setShowSettings(true)} /> - + setShowSettings(true)} /> - + setShowSettings(true)} /> - + setShowSettings(true)} /> ; + if (showSettings) { + return + setShowSettings(true)} title="UI Settings" onLogout={clearTokenAndGoToRoot} /> + + + } + if (result.loading) return setShowSettings(true)} title="Loading..." />; let admin = true; let instanceNameByBackendURL; @@ -61,7 +69,7 @@ export function ApplicationReadyRoutes(): VNode { ) { return ( - + setShowSettings(true)} title="Login" onLogout={clearTokenAndGoToRoot} /> - + setShowSettings(true)} title="Error" onLogout={clearTokenAndGoToRoot} /> { + route("/settings") + }} path={path} onLogout={clearTokenAndGoToRoot} setInstanceName={setInstanceName} @@ -558,6 +564,7 @@ export function InstanceRoutes({ }} /> + {/** * Example pages */} diff --git a/packages/merchant-backoffice-ui/src/components/exception/login.tsx b/packages/merchant-backoffice-ui/src/components/exception/login.tsx index 984b6fe06..f2f94a7c5 100644 --- a/packages/merchant-backoffice-ui/src/components/exception/login.tsx +++ b/packages/merchant-backoffice-ui/src/components/exception/login.tsx @@ -229,7 +229,7 @@ export function LoginModal({ onConfirm, withMessage }: Props): VNode { ); } -function AsyncButton({onClick, children}:{onClick: () => Promise, children: ComponentChildren}):VNode { +function AsyncButton({ onClick, children }: { onClick: () => Promise, children: ComponentChildren }): VNode { const [running, setRunning] = useState(false) return