33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { createElement, lazy } from "react";
|
|
import type { PlatformRouteContext, PlatformWebModule } from "@govoplan/core-webui";
|
|
import { adminReadScopes } from "@govoplan/core-webui";
|
|
import { generatedTranslations } from "./i18n/generatedTranslations";
|
|
|
|
const AdminPage = lazy(() => import("./features/admin/AdminPage"));
|
|
|
|
const translations = {
|
|
en: generatedTranslations.en,
|
|
de: generatedTranslations.de
|
|
};
|
|
|
|
function renderAdminRoute({ settings, auth, onAuthChange }: PlatformRouteContext) {
|
|
if (!onAuthChange) {
|
|
throw new Error("i18n:govoplan-access.the_access_admin_route_requires_the_platform_aut.0173a45f");
|
|
}
|
|
return createElement(AdminPage, { settings, auth, onAuthChange });
|
|
}
|
|
|
|
export const accessModule: PlatformWebModule = {
|
|
id: "access",
|
|
label: "i18n:govoplan-access.access.2f81a22d",
|
|
version: "1.0.0",
|
|
translations,
|
|
navItems: [
|
|
{ to: "/admin", label: "i18n:govoplan-access.admin.4e7afebc", iconName: "admin", anyOf: adminReadScopes, order: 900 }],
|
|
|
|
routes: [
|
|
{ path: "/admin", anyOf: adminReadScopes, order: 900, render: renderAdminRoute }]
|
|
|
|
};
|
|
|
|
export default accessModule; |