From 014f7cdb234e28b27c416553821d92ddaf4a5811 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 25 Jul 2024 17:53:02 +0200 Subject: [PATCH] Make the account theme initialized by a cli command --- src/account/KcContext.ts | 12 ----------- src/account/KcPage.tsx | 33 ----------------------------- src/account/KcPageStory.tsx | 42 ------------------------------------- src/account/i18n.ts | 5 ----- vite.config.ts | 4 +++- 5 files changed, 3 insertions(+), 93 deletions(-) delete mode 100644 src/account/KcContext.ts delete mode 100644 src/account/KcPage.tsx delete mode 100644 src/account/KcPageStory.tsx delete mode 100644 src/account/i18n.ts diff --git a/src/account/KcContext.ts b/src/account/KcContext.ts deleted file mode 100644 index a043f25..0000000 --- a/src/account/KcContext.ts +++ /dev/null @@ -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 & {}; -}; - -export type KcContextExtensionPerPage = {}; - -export type KcContext = ExtendKcContext; diff --git a/src/account/KcPage.tsx b/src/account/KcPage.tsx deleted file mode 100644 index f743327..0000000 --- a/src/account/KcPage.tsx +++ /dev/null @@ -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 ( - - {(() => { - switch (kcContext.pageId) { - default: - return ( - - ); - } - })()} - - ); -} - -const classes = {} satisfies { [key in ClassKey]?: string }; diff --git a/src/account/KcPageStory.tsx b/src/account/KcPageStory.tsx deleted file mode 100644 index f9656b2..0000000 --- a/src/account/KcPageStory.tsx +++ /dev/null @@ -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(params: { - pageId: PageId; -}) { - const { pageId } = params; - - function KcPageStory(props: { - kcContext?: DeepPartial>; - }) { - const { kcContext: overrides } = props; - - const kcContextMock = getKcContextMock({ - pageId, - overrides - }); - - return ; - } - - return { KcPageStory }; -} diff --git a/src/account/i18n.ts b/src/account/i18n.ts deleted file mode 100644 index c4ad70c..0000000 --- a/src/account/i18n.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createUseI18n } from "keycloakify/account"; - -export const { useI18n, ofTypeI18n } = createUseI18n({}); - -export type I18n = typeof ofTypeI18n; diff --git a/vite.config.ts b/vite.config.ts index 5b465e7..cb8365c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,5 +4,7 @@ import { keycloakify } from "keycloakify/vite-plugin"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react(), keycloakify({})] + plugins: [react(), keycloakify({ + accountThemeImplementation: "none" + })] });