diff options
author | 2024-07-25 20:29:06 +0200 | |
---|---|---|
committer | 2024-07-25 20:29:06 +0200 | |
commit | f32b4ecae051161cb8b033c6821179a55d4009b7 (patch) | |
tree | 7ff645aa72c5e132c874b34a3608ec88d90741ec | |
parent | Update keycloakify (diff) | |
parent | Add instructions on how to initialize the account theme (diff) |
Merge pull request #24 from keycloakify/with_account_nitialization
With account nitialization
-rw-r--r-- | README.md | 12 | ||||
-rwxr-xr-x | package.json | 2 | ||||
-rw-r--r-- | src/account/KcContext.ts | 12 | ||||
-rw-r--r-- | src/account/KcPage.tsx | 33 | ||||
-rw-r--r-- | src/account/KcPageStory.tsx | 42 | ||||
-rw-r--r-- | src/account/i18n.ts | 5 | ||||
-rw-r--r-- | vite.config.ts | 4 | ||||
-rw-r--r-- | yarn.lock | 8 |
8 files changed, 20 insertions, 98 deletions
@@ -37,6 +37,18 @@ npm run build-keycloak-theme Note that by default Keycloakify generates multiple .jar files for different versions of Keycloak. You can customize this behavior, see documentation [here](https://docs.keycloakify.dev/v/v10/targetting-specific-keycloak-versions). +# Initializing the account theme + +```bash +npx keycloakify initialize-account-theme +``` + +# Initializing the email theme + +```bash +npx keycloakify initialize-email-theme +``` + # GitHub Actions The starter comes with a generic GitHub Actions workflow that builds the theme and publishes diff --git a/package.json b/package.json index 510126c..b267ce1 100755 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "license": "MIT", "keywords": [], "dependencies": { - "keycloakify": "10.0.0-rc.117", + "keycloakify": "10.0.0-rc.119", "react": "^18.2.0", "react-dom": "^18.2.0" }, 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<KcEnvName, string> & {}; -}; - -export type KcContextExtensionPerPage = {}; - -export type KcContext = ExtendKcContext<KcContextExtension, KcContextExtensionPerPage>; 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 ( - <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 }; 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<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 }; -} 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" + })] }); @@ -4015,10 +4015,10 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" - version "10.0.0-rc.117" - resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-10.0.0-rc.117.tgz#f72454dedcd5a4a5f49c50af3d9284fceadcd345" - integrity sha512-YopVW4sLLIz/9Iia/Hfvt1ZI4DpPPg724IN2LP9pKGU1UDsjU/zFyF9J6Aqv/gXUua+Kz2oNcD0bNiig1DmalA== + version "10.0.0-rc.119" + resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-10.0.0-rc.119.tgz#511a2ae2c2e8ae9116de27e2ff51424beea8807c" + integrity sha512-PCTgJEg+hMcFdR0tfxG1eXGbCeLRNRVmzGqb3O8Wg/NGgcP5Snt8WLzIDhIaKiLpXJq8NuKam2VZxOWT+UEbfA== dependencies: tsafe "^1.6.6" |