diff --git a/solvway-admin-portal/app/components/app/AuthFrame.tsx b/solvway-admin-portal/app/components/app/AuthFrame.tsx new file mode 100644 index 0000000..048644b --- /dev/null +++ b/solvway-admin-portal/app/components/app/AuthFrame.tsx @@ -0,0 +1,67 @@ +"use client"; + +import type { ReactNode } from "react"; +import { CalendarDays, ListChecks, UserPlus } from "lucide-react"; +import { useT } from "@/app/lib/i18n/MessagesProvider"; +import PoweredBy from "@/app/components/app/PoweredBy"; + +/** What the back office is for, on the brand panel. */ +const PANEL_POINTS = [ + { icon: CalendarDays, code: "BackOfficePanelEvents" }, + { icon: UserPlus, code: "BackOfficePanelLeads" }, + { icon: ListChecks, code: "BackOfficePanelFollowUps" }, +] as const; + +// Two-column frame shared by the signed-out pages (login, forced password change): an accent panel +// with the giraffe-spot coat 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 ( +
+ + +
+
+ {/* Below lg a short brand band stands in for the panel: same accent ground and giraffe-spot coat. */} +
+
+ + {children} +
+ +
+
+ ); +} diff --git a/solvway-admin-portal/app/login/page.tsx b/solvway-admin-portal/app/login/page.tsx index 235e885..6ade404 100644 --- a/solvway-admin-portal/app/login/page.tsx +++ b/solvway-admin-portal/app/login/page.tsx @@ -1,7 +1,7 @@ "use client"; import { useState, useSyncExternalStore } from "react"; -import { CalendarDays, Eye, EyeOff, ListChecks, Loader2, UserPlus } from "lucide-react"; +import { Eye, EyeOff, Loader2 } from "lucide-react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { Button } from "@/app/components/ui/button"; @@ -11,20 +11,13 @@ import { ErrorState } from "@/app/components/ui/states"; import { ApiError, apiPost } from "@/app/lib/clientApi"; import { useAdminAuth } from "@/app/lib/AdminAuthContext"; import { useT } from "@/app/lib/i18n/MessagesProvider"; -import PoweredBy from "@/app/components/app/PoweredBy"; +import AuthFrame from "@/app/components/app/AuthFrame"; import { signedInElsewhere } from "@/app/lib/signedInElsewhere"; import { safeReturnTo } from "@/app/lib/returnTo"; /** The marker is read once per render; nothing in the page changes it. */ const noSubscription = () => () => {}; -/** What the back office is for, on the brand panel. */ -const PANEL_POINTS = [ - { icon: CalendarDays, code: "BackOfficePanelEvents" }, - { icon: UserPlus, code: "BackOfficePanelLeads" }, - { icon: ListChecks, code: "BackOfficePanelFollowUps" }, -] as const; - // Ported from src/legacy-pages/login/LoginPage.tsx. The hardcoded // services/auth.ts credential check and localStorage session are gone (spec: // "The hardcoded SPA auth is gone"); submit now calls the same-origin @@ -74,127 +67,80 @@ export default function LoginPage() { } return ( - // Brand split (feedback 2026-10-23, "make it impactful"): a brand-gold panel with the brown giraffe - // coat and the logo on the left from lg, the form on the cream page on the right. Below lg the - // panel folds into a compact brand row above the form. -
- - -
-
- {/* Below lg a short brand band stands in for the panel: same brown, coat and logo. */} -
-
-
+ + + {t("ForgotLink")} + + + + + ); } diff --git a/solvway-admin-portal/app/reset-password/page.frame.test.tsx b/solvway-admin-portal/app/reset-password/page.frame.test.tsx new file mode 100644 index 0000000..c1bc196 --- /dev/null +++ b/solvway-admin-portal/app/reset-password/page.frame.test.tsx @@ -0,0 +1,18 @@ +import { render, screen } from "@testing-library/react"; +import { describe, it, expect, vi } from "vitest"; + +vi.mock("next/navigation", () => ({ useRouter: () => ({ push: vi.fn() }) })); +vi.mock("@/app/lib/clientApi", () => ({ apiPost: vi.fn(), ApiError: class ApiError extends Error {} })); +vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: () => ({ refresh: vi.fn() }) })); + +import ResetPasswordPage from "./page"; + +describe("ResetPasswordPage frame", () => { + it("uses the login two-column frame", () => { + const { container } = render(); + expect(screen.getByText("Everything behind Co-Lite, in one place.")).toBeInTheDocument(); + expect(container.querySelector(".giraffe-spots")).not.toBeNull(); + expect(screen.getByRole("link", { name: "Containerverse Sdn. Bhd." })).toBeInTheDocument(); + expect(screen.getByRole("heading", { name: "Set your password" })).toBeInTheDocument(); + }); +}); diff --git a/solvway-admin-portal/app/reset-password/page.tsx b/solvway-admin-portal/app/reset-password/page.tsx index 74a4999..a369c07 100644 --- a/solvway-admin-portal/app/reset-password/page.tsx +++ b/solvway-admin-portal/app/reset-password/page.tsx @@ -4,14 +4,13 @@ import { useState } from "react"; import { Loader2 } from "lucide-react"; import { useRouter } from "next/navigation"; 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 { useAdminAuth } from "@/app/lib/AdminAuthContext"; import { useT } from "@/app/lib/i18n/MessagesProvider"; -import PoweredBy from "@/app/components/app/PoweredBy"; +import AuthFrame from "@/app/components/app/AuthFrame"; // First sign-in: login answered resetPasswordRequired (the account is still on the temporary // password an admin set), so the user must choose their own before reaching the portal. @@ -48,49 +47,44 @@ export default function ResetPasswordPage() { } return ( -
- - - {t("ResetTitle")} - {t("ResetChooseIntro")} - - - {error && } -
-
- - setNewPassword(e.target.value)} - disabled={submitting} - aria-describedby="newPasswordRules" - /> -

{t("AdminPasswordHint")}

-
-
- - setConfirmPassword(e.target.value)} - disabled={submitting} - /> -
- -
-
-
-
- + +
+

{t("ResetTitle")}

+

{t("ResetChooseIntro")}

-
+ {error && } +
+
+ + setNewPassword(e.target.value)} + disabled={submitting} + aria-describedby="newPasswordRules" + className="h-11 bg-card" + /> +

{t("AdminPasswordHint")}

+
+
+ + setConfirmPassword(e.target.value)} + disabled={submitting} + className="h-11 bg-card" + /> +
+ +
+ ); }