diff --git a/docs/config.md b/docs/config.md index 01f75ac..67e05c3 100644 --- a/docs/config.md +++ b/docs/config.md @@ -35,7 +35,7 @@ In this case, you could provide the configuration in the `/.well-known/matrix/cl * `menu` - add custom menu items to the main menu (sidebar) by providing a `menu` array in the config. Each `menu` item can contain the following fields: * `label` (required): The text to display in the menu. - * `icon` (optional): The icon to display next to the label, one of the [../src/components/icons.ts] icons, otherwise a default icon will be used. + * `icon` (optional): The icon to display next to the label, one of the [src/utils/icons.ts](../src/utils/icons.ts) icons, otherwise a default icon will be used. * `url` (required): The URL to navigate to when the menu item is clicked. [More details](custom-menu.md) diff --git a/docs/custom-menu.md b/docs/custom-menu.md index 6422ba3..cb1ca14 100644 --- a/docs/custom-menu.md +++ b/docs/custom-menu.md @@ -10,7 +10,7 @@ The examples below contain the configuration settings to add a link to the [Syna Each `menu` item can contain the following fields: * `label` (required): The text to display in the menu. -* `icon` (optional): The icon to display next to the label, one of the [../src/components/icons.ts] icons, otherwise a +* `icon` (optional): The icon to display next to the label, one of the [src/utils/icons.ts](../src/utils/icons.ts) icons, otherwise a default icon will be used. * `url` (required): The URL to navigate to when the menu item is clicked. diff --git a/src/App.tsx b/src/App.tsx index 3c4162c..d1d6468 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,10 +2,11 @@ import { merge } from "lodash"; import polyglotI18nProvider from "ra-i18n-polyglot"; import { Admin, CustomRoutes, Resource, resolveBrowserLocale } from "react-admin"; +import { createContext, useContext } from "react"; import { Route } from "react-router-dom"; -import { AdminLayout } from "./components/AdminLayout"; -import { ImportFeature } from "./components/ImportFeature"; +import AdminLayout from "./components/AdminLayout"; +import UserImport from "./components/UserImport"; import germanMessages from "./i18n/de"; import englishMessages from "./i18n/en"; import frenchMessages from "./i18n/fr"; @@ -23,6 +24,7 @@ import users from "./resources/users"; import authProvider from "./synapse/authProvider"; import dataProvider from "./synapse/dataProvider"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { Config } from "./utils/config"; // TODO: Can we use lazy loading together with browser locale? const messages = { @@ -49,7 +51,7 @@ const i18nProvider = polyglotI18nProvider( const queryClient = new QueryClient(); -const App = () => ( +export const App = () => ( ( i18nProvider={i18nProvider} > - } /> + } /> @@ -84,4 +86,8 @@ const App = () => ( ); +export const AppContext = createContext({}); + +export const useAppContext = () => useContext(AppContext) as Config; + export default App; diff --git a/src/AppContext.tsx b/src/AppContext.tsx deleted file mode 100644 index 72b8bc3..0000000 --- a/src/AppContext.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { createContext, useContext } from "react"; -import { Config } from "./components/config"; - -export const AppContext = createContext({}); - -export const useAppContext = () => useContext(AppContext) as Config; diff --git a/src/components/AdminLayout.tsx b/src/components/AdminLayout.tsx index dd1cc93..8d134fa 100644 --- a/src/components/AdminLayout.tsx +++ b/src/components/AdminLayout.tsx @@ -1,8 +1,8 @@ import { CheckForApplicationUpdate, AppBar, TitlePortal, InspectorButton, Confirm, Layout, Logout, Menu, useLogout, UserMenu } from "react-admin"; import { LoginMethod } from "../pages/LoginPage"; import { useEffect, useState, Suspense } from "react"; -import { Icons, DefaultIcon } from "./icons"; -import { MenuItem, GetConfig, ClearConfig } from "./config"; +import { Icons, DefaultIcon } from "../utils/icons"; +import { MenuItem, GetConfig, ClearConfig } from "../utils/config"; import Footer from "./Footer"; const AdminUserMenu = () => { @@ -96,3 +96,5 @@ export const AdminLayout = ({ children }) => {