From 1f96548d92398c47a84a40e0a76315e486a21f91 Mon Sep 17 00:00:00 2001 From: ngqile Date: Tue, 1 Dec 2026 23:53:11 +0800 Subject: [PATCH] fix: forgot password shares the sign-in frame Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM --- solvway-admin-portal/DESIGN.md | 2 +- .../app/components/app/AuthFrame.tsx | 6 +- .../app/forgot-password/page.frame.test.tsx | 16 ++++ .../app/forgot-password/page.tsx | 84 +++++++++---------- 4 files changed, 59 insertions(+), 49 deletions(-) create mode 100644 solvway-admin-portal/app/forgot-password/page.frame.test.tsx diff --git a/solvway-admin-portal/DESIGN.md b/solvway-admin-portal/DESIGN.md index ee405c5..3b480b4 100644 --- a/solvway-admin-portal/DESIGN.md +++ b/solvway-admin-portal/DESIGN.md @@ -183,7 +183,7 @@ The footer credit "Powered by Containerverse Sdn. Bhd." sits at the foot of the **Public visitor pages** (`/r`, `/i`, `/c`) have no shell. One white card sits on the slate ground, full width with a 16px gutter on phones and at most 448px wide, with the footer credit under it. The card opens with the event header: the company name as a 12px semibold uppercase label in Action Blue, the event name as the 24px h1, then dates and location on their own muted lines with 16px icons. The privacy notice is fine print: 12px muted text on a slate-tint panel, both languages in full. Every end state (loading, thank you, welcome, not yet, inactive) is a centred 40px round icon (blue tint, or 10% red for errors) over a balanced semibold heading. The look is neutral: no company logo or colour. -**Signed-out pages** (login, reset password) share one frame: from the lg breakpoint a blue-tint panel on the left with the "Back office" pill, a headline and three feature lines, and the form column on the ground at right; below lg the panel folds into a short band above the form. +**Signed-out pages** (login, forgot password, reset password) share one frame: from the lg breakpoint a blue-tint panel on the left with the "Back office" pill, a headline and three feature lines, and the form column on the ground at right; below lg the panel folds into a short band above the form. **My QR codes** shows one card per code in a grid (one column on phones, two from 768px, three from 1280px): the event name as the card title, dates and location under it, the warning pill in the header when switched off, then the QR above its link and a wrapping row of outline buttons. diff --git a/solvway-admin-portal/app/components/app/AuthFrame.tsx b/solvway-admin-portal/app/components/app/AuthFrame.tsx index 54d2302..64f8daa 100644 --- a/solvway-admin-portal/app/components/app/AuthFrame.tsx +++ b/solvway-admin-portal/app/components/app/AuthFrame.tsx @@ -12,9 +12,9 @@ const PANEL_POINTS = [ { icon: ListChecks, code: "BackOfficePanelFollowUps" }, ] as const; -// Two-column frame shared by the signed-out pages (login, forced password change): an accent panel -// on the left from lg, the page's own content on the right. Below lg the -// panel folds into a compact brand row above the content. +// Two-column frame shared by the signed-out pages (login, forgot password, forced password +// change): an accent panel on the left from lg, the page's own content on the right. Below lg +// the panel folds into a compact brand row above the content. export default function AuthFrame({ children }: { children: ReactNode }) { const t = useT(); return ( diff --git a/solvway-admin-portal/app/forgot-password/page.frame.test.tsx b/solvway-admin-portal/app/forgot-password/page.frame.test.tsx new file mode 100644 index 0000000..14ebb0d --- /dev/null +++ b/solvway-admin-portal/app/forgot-password/page.frame.test.tsx @@ -0,0 +1,16 @@ +import { render, screen } from "@testing-library/react"; +import { describe, it, expect, vi } from "vitest"; + +vi.mock("@/app/lib/clientApi", () => ({ apiPost: vi.fn() })); + +import ForgotPasswordPage from "./page"; + +// Every signed-out page shares the login frame (DESIGN.md, Layout). +describe("ForgotPasswordPage frame", () => { + it("uses the login two-column frame with its title as the page heading", () => { + render(); + expect(screen.getByText("Everything behind Co-Lite, in one place.")).toBeInTheDocument(); + expect(screen.getAllByRole("link", { name: "Containerverse Sdn. Bhd." })).toHaveLength(1); + expect(screen.getByRole("heading", { level: 1 }).textContent).toBe("Forgot password"); + }); +}); diff --git a/solvway-admin-portal/app/forgot-password/page.tsx b/solvway-admin-portal/app/forgot-password/page.tsx index 8b711d7..ad2524e 100644 --- a/solvway-admin-portal/app/forgot-password/page.tsx +++ b/solvway-admin-portal/app/forgot-password/page.tsx @@ -4,13 +4,12 @@ import { useState } from "react"; import Link from "next/link"; import { Loader2 } from "lucide-react"; import { Button } from "@/app/components/ui/button"; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/app/components/ui/card"; import { Input } from "@/app/components/ui/input"; import { Label } from "@/app/components/ui/label"; import { ErrorState } from "@/app/components/ui/states"; import { apiPost } from "@/app/lib/clientApi"; import { useT } from "@/app/lib/i18n/MessagesProvider"; -import PoweredBy from "@/app/components/app/PoweredBy"; +import AuthFrame from "@/app/components/app/AuthFrame"; // Public "email me a temporary password" form. Whatever happens (match, no match, server or network // failure) the visitor sees the same message, so the page never reveals whether an account exists. @@ -41,49 +40,44 @@ export default function ForgotPasswordPage() { } return ( -
- - - {t("ForgotTitle")} - {t("ForgotIntro")} - - - {sent ? ( -

{t("ForgotSent")}

- ) : ( - <> - {required && } -
-
- - setCompany(e.target.value)} disabled={submitting} /> -
-
- - setUsername(e.target.value)} disabled={submitting} /> -
-
- - setEmail(e.target.value)} disabled={submitting} /> -
- -
- - )} - - {t("ForgotBack")} - -
-
-
- + +
+

{t("ForgotTitle")}

+

{t("ForgotIntro")}

-
+
+ {sent ? ( +

{t("ForgotSent")}

+ ) : ( + <> + {required && } +
+
+ + setCompany(e.target.value)} disabled={submitting} className="h-11 bg-card" /> +
+
+ + setUsername(e.target.value)} disabled={submitting} className="h-11 bg-card" /> +
+
+ + setEmail(e.target.value)} disabled={submitting} className="h-11 bg-card" /> +
+ +
+ + )} + + {t("ForgotBack")} + +
+ ); }