From eb856596e70b005c9b9188b5dc05f1a36d467c6e Mon Sep 17 00:00:00 2001 From: Damien Le Thiec Date: Mon, 10 Nov 2025 09:28:54 +0100 Subject: [PATCH] feat: add themed Info page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add DSFR-styled Info page (info.ftl) that displays: - Success messages with Alert component - Required actions list when present - Smart navigation links with priority: 1. actionUri (continue flow) 2. pageRedirectUri (redirect to app) 3. client.baseUrl (back to app) 4. url.loginUrl (back to login) - Directional icons (arrow-right for forward, arrow-left for back) - Respects skipLink flag from Keycloak 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/login/KcPage.tsx | 9 +++ src/login/pages/Info.stories.tsx | 107 +++++++++++++++++++++++++++++++ src/login/pages/Info.tsx | 71 ++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 src/login/pages/Info.stories.tsx create mode 100644 src/login/pages/Info.tsx diff --git a/src/login/KcPage.tsx b/src/login/KcPage.tsx index c6b4bc54..e5af7ab4 100644 --- a/src/login/KcPage.tsx +++ b/src/login/KcPage.tsx @@ -13,6 +13,7 @@ const Login = lazy(() => import("./pages/Login")); const Register = lazy(() => import("./pages/Register")); const LoginUpdateProfile = lazy(() => import("./pages/LoginUpdateProfile")); const LoginUpdatePassword = lazy(() => import("./pages/LoginUpdatePassword")); +const Info = lazy(() => import("./pages/Info")); const doMakeUserConfirmPassword = false; @@ -77,6 +78,14 @@ export default function KcPage(props: { kcContext: KcContext }) { doUseDefaultCss={false} /> ); + case "info.ftl": + return ( + + ); default: return ( ; + +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + render: () => ( + + ) +}; + +/** + * WithRequiredActions: + * - Purpose: Tests the info page when certain actions are required from the user. + * - Scenario: Simulates a scenario where the user needs to complete specific actions (e.g., verify email, update password). + * - Key Aspect: Displays a list of required actions that the user must complete. + */ +export const WithRequiredActions: Story = { + render: () => ( + + ) +}; + +/** + * WithActionUri: + * - Purpose: Tests the page with an action URI link. + * - Scenario: Simulates an info page that provides a link to proceed with a specific action. + * - Key Aspect: Displays a "proceed with action" link instead of "back to application". + */ +export const WithActionUri: Story = { + render: () => ( + + ) +}; + +/** + * WithClientBaseUrl: + * - Purpose: Tests the page with only a client base URL available. + * - Scenario: Simulates when no specific redirect URI is provided, falling back to the client's base URL. + * - Key Aspect: Uses the client base URL as the "back to application" link. + */ +export const WithClientBaseUrl: Story = { + render: () => ( + + ) +}; + +/** + * EmailVerificationSuccess: + * - Purpose: Tests a typical email verification success message. + * - Scenario: User clicks on email verification link and sees success message. + * - Key Aspect: Shows success message with redirect to application. + */ +export const EmailVerificationSuccess: Story = { + render: () => ( + + ) +}; diff --git a/src/login/pages/Info.tsx b/src/login/pages/Info.tsx new file mode 100644 index 00000000..1707d421 --- /dev/null +++ b/src/login/pages/Info.tsx @@ -0,0 +1,71 @@ +import { getKcClsx } from "keycloakify/login/lib/kcClsx"; +import type { PageProps } from "keycloakify/login/pages/PageProps"; +import type { KcContext } from "../KcContext"; +import type { I18n } from "../i18n"; +import Alert from "@codegouvfr/react-dsfr/Alert"; +import { fr } from "@codegouvfr/react-dsfr"; + +export default function Info(props: PageProps, I18n>) { + const { kcContext, i18n, doUseDefaultCss, Template, classes } = props; + + const { kcClsx } = getKcClsx({ + doUseDefaultCss, + classes + }); + + const { messageHeader, message, requiredActions, skipLink, pageRedirectUri, actionUri, client, url } = kcContext; + + const { msg, advancedMsg } = i18n; + + return ( + + ); +}