keycloak-theme/src/account/KcApp.tsx

40 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-06-06 01:44:57 +02:00
import { Suspense, lazy } from "react";
2024-06-08 09:03:17 +02:00
import type { ClassKey } from "keycloakify/account";
2024-06-06 05:26:06 +02:00
import type { KcContext } from "./KcContext";
2024-06-06 01:44:57 +02:00
import { useI18n } from "./i18n";
2024-06-06 05:26:06 +02:00
import Template from "keycloakify/account/Template";
2024-06-06 01:44:57 +02:00
const Fallback = lazy(() => import("keycloakify/account/Fallback"));
2024-06-06 05:26:06 +02:00
2024-06-08 09:03:17 +02:00
const classes = {} satisfies { [key in ClassKey]?: string };
2024-06-06 01:44:57 +02:00
export default function KcApp(props: { kcContext: KcContext }) {
const { kcContext } = props;
const i18n = useI18n({ kcContext });
if (i18n === null) {
return null;
}
return (
<Suspense>
{(() => {
switch (kcContext.pageId) {
default:
2024-06-06 05:26:06 +02:00
return (
<Fallback
{...{
kcContext,
i18n,
classes,
Template
}}
doUseDefaultCss={true}
/>
);
2024-06-06 01:44:57 +02:00
}
})()}
</Suspense>
);
}