Make the account theme initialized by a cli command
This commit is contained in:
parent
1604dee71c
commit
014f7cdb23
|
@ -1,12 +0,0 @@
|
||||||
/* eslint-disable @typescript-eslint/ban-types */
|
|
||||||
import type { ExtendKcContext } from "keycloakify/account";
|
|
||||||
import type { KcEnvName, ThemeName } from "../kc.gen";
|
|
||||||
|
|
||||||
export type KcContextExtension = {
|
|
||||||
themeName: ThemeName;
|
|
||||||
properties: Record<KcEnvName, string> & {};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type KcContextExtensionPerPage = {};
|
|
||||||
|
|
||||||
export type KcContext = ExtendKcContext<KcContextExtension, KcContextExtensionPerPage>;
|
|
|
@ -1,33 +0,0 @@
|
||||||
import { Suspense } from "react";
|
|
||||||
import type { ClassKey } from "keycloakify/account";
|
|
||||||
import type { KcContext } from "./KcContext";
|
|
||||||
import { useI18n } from "./i18n";
|
|
||||||
import DefaultPage from "keycloakify/account/DefaultPage";
|
|
||||||
import Template from "keycloakify/account/Template";
|
|
||||||
|
|
||||||
export default function KcPage(props: { kcContext: KcContext }) {
|
|
||||||
const { kcContext } = props;
|
|
||||||
|
|
||||||
const { i18n } = useI18n({ kcContext });
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Suspense>
|
|
||||||
{(() => {
|
|
||||||
switch (kcContext.pageId) {
|
|
||||||
default:
|
|
||||||
return (
|
|
||||||
<DefaultPage
|
|
||||||
kcContext={kcContext}
|
|
||||||
i18n={i18n}
|
|
||||||
classes={classes}
|
|
||||||
Template={Template}
|
|
||||||
doUseDefaultCss={true}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
})()}
|
|
||||||
</Suspense>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const classes = {} satisfies { [key in ClassKey]?: string };
|
|
|
@ -1,42 +0,0 @@
|
||||||
import type { DeepPartial } from "keycloakify/tools/DeepPartial";
|
|
||||||
import type { KcContext } from "./KcContext";
|
|
||||||
import { createGetKcContextMock } from "keycloakify/account/KcContext";
|
|
||||||
import type { KcContextExtension, KcContextExtensionPerPage } from "./KcContext";
|
|
||||||
import KcPage from "./KcPage";
|
|
||||||
import { themeNames, kcEnvDefaults } from "../kc.gen";
|
|
||||||
|
|
||||||
const kcContextExtension: KcContextExtension = {
|
|
||||||
themeName: themeNames[0],
|
|
||||||
properties: {
|
|
||||||
...kcEnvDefaults
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const kcContextExtensionPerPage: KcContextExtensionPerPage = {};
|
|
||||||
|
|
||||||
export const { getKcContextMock } = createGetKcContextMock({
|
|
||||||
kcContextExtension,
|
|
||||||
kcContextExtensionPerPage,
|
|
||||||
overrides: {},
|
|
||||||
overridesPerPage: {}
|
|
||||||
});
|
|
||||||
|
|
||||||
export function createKcPageStory<PageId extends KcContext["pageId"]>(params: {
|
|
||||||
pageId: PageId;
|
|
||||||
}) {
|
|
||||||
const { pageId } = params;
|
|
||||||
|
|
||||||
function KcPageStory(props: {
|
|
||||||
kcContext?: DeepPartial<Extract<KcContext, { pageId: PageId }>>;
|
|
||||||
}) {
|
|
||||||
const { kcContext: overrides } = props;
|
|
||||||
|
|
||||||
const kcContextMock = getKcContextMock({
|
|
||||||
pageId,
|
|
||||||
overrides
|
|
||||||
});
|
|
||||||
|
|
||||||
return <KcPage kcContext={kcContextMock} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { KcPageStory };
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
import { createUseI18n } from "keycloakify/account";
|
|
||||||
|
|
||||||
export const { useI18n, ofTypeI18n } = createUseI18n({});
|
|
||||||
|
|
||||||
export type I18n = typeof ofTypeI18n;
|
|
|
@ -4,5 +4,7 @@ import { keycloakify } from "keycloakify/vite-plugin";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react(), keycloakify({})]
|
plugins: [react(), keycloakify({
|
||||||
|
accountThemeImplementation: "none"
|
||||||
|
})]
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue