From f9f1a1708cd25308f60ab4682b62af5551981039 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Sun, 20 Nov 2022 13:23:13 +0100 Subject: [PATCH] added extension handling --- src/App.tsx | 3 +-- src/components/ExtensionalSignalHandler.tsx | 18 ++++++++++++++++++ src/components/index.ts | 1 + src/routes/Root.tsx | 10 +++++++--- src/server-types.ts | 1 + 5 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 src/components/ExtensionalSignalHandler.tsx diff --git a/src/App.tsx b/src/App.tsx index 4288aa1..2cb9ee6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -65,13 +65,13 @@ const router = createBrowserRouter([ { path: "/", element: , + loader: getServerSettings, children: [ { path: "/", element: , }, { - loader: getServerSettings, path: "/aliases", element: , }, @@ -88,7 +88,6 @@ const router = createBrowserRouter([ element: , }, { - loader: getServerSettings, path: "/reports/:id", element: , }, diff --git a/src/components/ExtensionalSignalHandler.tsx b/src/components/ExtensionalSignalHandler.tsx new file mode 100644 index 0000000..8f7fa45 --- /dev/null +++ b/src/components/ExtensionalSignalHandler.tsx @@ -0,0 +1,18 @@ +import {ReactElement, useContext} from "react" + +import AuthContext from "~/AuthContext/AuthContext" + +export default function ExtensionSignalHandler(): ReactElement { + const {user} = useContext(AuthContext) + const appDomain = import.meta.env.VITE_SERVER_BASE_URL + const instanceData = { + appDomain, + isAuthenticated: Boolean(user), + } + + return ( + + ) +} diff --git a/src/components/index.ts b/src/components/index.ts index 0c8a0e3..0e45169 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -42,5 +42,6 @@ export * from "./ExpandableListItem" export {default as ExpandableListItem} from "./ExpandableListItem" export * from "./ExternalLinkIndication" export {default as ExternalLinkIndication} from "./ExternalLinkIndication" +export {default as ExtensionSignalHandler} from "./ExtensionalSignalHandler" export * as SimplePageBuilder from "./simple-page-builder" diff --git a/src/routes/Root.tsx b/src/routes/Root.tsx index 3603c67..aa4b43b 100644 --- a/src/routes/Root.tsx +++ b/src/routes/Root.tsx @@ -1,12 +1,16 @@ import {Outlet} from "react-router-dom" import React, {ReactElement} from "react" +import {ExtensionSignalHandler} from "~/components" import AppLoadingScreen from "~/AppLoadingScreen/AppLoadingScreen" export default function RootRoute(): ReactElement { return ( - - - + <> + + + + + ) } diff --git a/src/server-types.ts b/src/server-types.ts index 08ae590..2cb8131 100644 --- a/src/server-types.ts +++ b/src/server-types.ts @@ -64,6 +64,7 @@ export interface AuthenticationDetails extends SimpleDetailResponse { export interface ServerSettings { mailDomain: string + appDomain: string randomEmailIdMinLength: number RandomEmailIdChars: string imageProxyEnabled: boolean