From 72b429321553841ac1ff48cf974bfc65da01bb06 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 19 Dec 2022 12:23:39 -0300 Subject: pretty --- .../merchant-backoffice-ui/src/Application.tsx | 168 ++++++++++++--------- 1 file changed, 99 insertions(+), 69 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/Application.tsx') diff --git a/packages/merchant-backoffice-ui/src/Application.tsx b/packages/merchant-backoffice-ui/src/Application.tsx index 4aa0f7891..0b92375c1 100644 --- a/packages/merchant-backoffice-ui/src/Application.tsx +++ b/packages/merchant-backoffice-ui/src/Application.tsx @@ -15,95 +15,125 @@ */ /** -* -* @author Sebastian Javier Marchano (sebasjm) -*/ + * + * @author Sebastian Javier Marchano (sebasjm) + */ -import { h, VNode } from 'preact'; -import { route } from 'preact-router'; +import { h, VNode } from "preact"; +import { route } from "preact-router"; import { useMemo } from "preact/hooks"; import { ApplicationReadyRoutes } from "./ApplicationReadyRoutes.js"; import { Loading } from "./components/exception/loading.js"; -import { NotificationCard, NotYetReadyAppMenu } from "./components/menu/index.js"; -import { BackendContextProvider, useBackendContext } from './context/backend.js'; -import { ConfigContextProvider } from './context/config.js'; -import { TranslationProvider } from './context/translation.js'; +import { + NotificationCard, + NotYetReadyAppMenu, +} from "./components/menu/index.js"; +import { + BackendContextProvider, + useBackendContext, +} from "./context/backend.js"; +import { ConfigContextProvider } from "./context/config.js"; +import { TranslationProvider } from "./context/translation.js"; import { useBackendConfig } from "./hooks/backend.js"; -import { useTranslator } from './i18n/index.js'; -import LoginPage from './paths/login/index.js'; +import { useTranslator } from "./i18n/index.js"; +import LoginPage from "./paths/login/index.js"; export function Application(): VNode { return ( // - - - - - + + + + + // ); } function ApplicationStatusRoutes(): VNode { - const { updateLoginStatus, triedToLog } = useBackendContext() + const { updateLoginStatus, triedToLog } = useBackendContext(); const result = useBackendConfig(); - const i18n = useTranslator() + const i18n = useTranslator(); const updateLoginInfoAndGoToRoot = (url: string, token?: string) => { - updateLoginStatus(url, token) - route('/') - } + updateLoginStatus(url, token); + route("/"); + }; - const { currency, version } = result.ok ? result.data : { currency: 'unknown', version: 'unknown' } - const ctx = useMemo(() => ({ currency, version }), [currency, version]) + const { currency, version } = result.ok + ? result.data + : { currency: "unknown", version: "unknown" }; + const ctx = useMemo(() => ({ currency, version }), [currency, version]); if (!triedToLog) { - return
- - -
+ return ( +
+ + +
+ ); } - if (result.clientError && result.isUnauthorized) return
- - -
- - if (result.clientError && result.isNotfound) return
- - - -
- - if (result.serverError) return
- - - -
- - if (result.loading) return - - if (!result.ok) return
- - - -
- - return
- - - -
+ if (result.clientError && result.isUnauthorized) + return ( +
+ + +
+ ); + + if (result.clientError && result.isNotfound) + return ( +
+ + + +
+ ); + + if (result.serverError) + return ( +
+ + + +
+ ); + + if (result.loading) return ; + + if (!result.ok) + return ( +
+ + + +
+ ); + + return ( +
+ + + +
+ ); } -- cgit v1.2.3