diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx b/packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx index fe4493bff..4390ef877 100644 --- a/packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx +++ b/packages/merchant-backoffice-ui/src/ApplicationReadyRoutes.tsx @@ -18,23 +18,23 @@ * * @author Sebastian Javier Marchano (sebasjm) */ +import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; +import { createHashHistory } from "history"; import { Fragment, h, VNode } from "preact"; import Router, { Route, route } from "preact-router"; +import { useState } from "preact/hooks"; +import { + NotificationCard, + NotYetReadyAppMenu, +} from "./components/menu/index.js"; import { useBackendContext } from "./context/backend.js"; import { useBackendInstancesTestForAdmin } from "./hooks/backend.js"; import { InstanceRoutes } from "./InstanceRoutes.js"; import LoginPage from "./paths/login/index.js"; import { INSTANCE_ID_LOOKUP } from "./utils/constants.js"; -import { - NotYetReadyAppMenu, - NotificationCard, -} from "./components/menu/index.js"; -import { useTranslator } from "./i18n/index.js"; -import { createHashHistory } from "history"; -import { useState } from "preact/hooks"; export function ApplicationReadyRoutes(): VNode { - const i18n = useTranslator(); + const { i18n } = useTranslationContext(); const { url: backendURL, updateLoginStatus, @@ -54,8 +54,8 @@ export function ApplicationReadyRoutes(): VNode { <NotYetReadyAppMenu title="Login" onLogout={clearTokenAndGoToRoot} /> <NotificationCard notification={{ - message: i18n`Access denied`, - description: i18n`Check your token is valid`, + message: i18n.str`Access denied`, + description: i18n.str`Check your token is valid`, type: "ERROR", }} /> @@ -81,8 +81,8 @@ export function ApplicationReadyRoutes(): VNode { <NotYetReadyAppMenu title="Error" onLogout={clearTokenAndGoToRoot} /> <NotificationCard notification={{ - message: i18n`Couldn't access the server.`, - description: i18n`Could not infer instance id from url ${backendURL}`, + message: i18n.str`Couldn't access the server.`, + description: i18n.str`Could not infer instance id from url ${backendURL}`, type: "ERROR", }} /> @@ -108,7 +108,12 @@ export function ApplicationReadyRoutes(): VNode { ); } -function DefaultMainRoute({ instance, admin, instanceNameByBackendURL }: any) { +function DefaultMainRoute({ + instance, + admin, + instanceNameByBackendURL, + url, //from preact-router +}: any): VNode { const [instanceName, setInstanceName] = useState( instanceNameByBackendURL || instance || "default", ); @@ -116,6 +121,7 @@ function DefaultMainRoute({ instance, admin, instanceNameByBackendURL }: any) { return ( <InstanceRoutes admin={admin} + path={url} id={instanceName} setInstanceName={setInstanceName} /> |