Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f96548d92 |
No files matched your search
@@ -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.
|
||||
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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(<ForgotPasswordPage />);
|
||||
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");
|
||||
});
|
||||
});
|
||||
@@ -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 (
|
||||
<div className="flex min-h-svh flex-col items-center justify-center gap-4 bg-background p-4">
|
||||
<Card className="w-full max-w-sm">
|
||||
<CardHeader className="gap-2">
|
||||
<CardTitle className="text-lg">{t("ForgotTitle")}</CardTitle>
|
||||
<CardDescription>{t("ForgotIntro")}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
{sent ? (
|
||||
<p role="status" className="text-sm">{t("ForgotSent")}</p>
|
||||
) : (
|
||||
<>
|
||||
{required && <ErrorState message={t("ForgotRequired")} />}
|
||||
<form onSubmit={handleSubmit} className="space-y-4" noValidate>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="company">{t("Company")}</Label>
|
||||
<Input id="company" autoComplete="organization" placeholder={t("CompanyBlankForSuper")} value={company}
|
||||
onChange={(e) => setCompany(e.target.value)} disabled={submitting} />
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="username">{t("Username")}</Label>
|
||||
<Input id="username" autoComplete="username" required value={username}
|
||||
onChange={(e) => setUsername(e.target.value)} disabled={submitting} />
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="email">{t("Email")}</Label>
|
||||
<Input id="email" type="email" autoComplete="email" required value={email}
|
||||
onChange={(e) => setEmail(e.target.value)} disabled={submitting} />
|
||||
</div>
|
||||
<Button type="submit" className="w-full" disabled={submitting}>
|
||||
{submitting && <Loader2 aria-hidden="true" className="size-4 animate-spin" />}
|
||||
{t("ForgotSubmit")}
|
||||
</Button>
|
||||
</form>
|
||||
</>
|
||||
)}
|
||||
<Link href="/login" className="block text-sm text-muted-foreground underline-offset-4 hover:underline">
|
||||
{t("ForgotBack")}
|
||||
</Link>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<div className="text-center">
|
||||
<PoweredBy />
|
||||
<AuthFrame>
|
||||
<div className="space-y-2">
|
||||
<h1 className="font-heading text-3xl font-semibold tracking-tight">{t("ForgotTitle")}</h1>
|
||||
<p className="text-muted-foreground">{t("ForgotIntro")}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-5">
|
||||
{sent ? (
|
||||
<p role="status" className="text-sm">{t("ForgotSent")}</p>
|
||||
) : (
|
||||
<>
|
||||
{required && <ErrorState message={t("ForgotRequired")} />}
|
||||
<form onSubmit={handleSubmit} className="space-y-5" noValidate>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="company">{t("Company")}</Label>
|
||||
<Input id="company" autoComplete="organization" placeholder={t("CompanyBlankForSuper")} value={company}
|
||||
onChange={(e) => setCompany(e.target.value)} disabled={submitting} className="h-11 bg-card" />
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="username">{t("Username")}</Label>
|
||||
<Input id="username" autoComplete="username" required value={username}
|
||||
onChange={(e) => setUsername(e.target.value)} disabled={submitting} className="h-11 bg-card" />
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="email">{t("Email")}</Label>
|
||||
<Input id="email" type="email" autoComplete="email" required value={email}
|
||||
onChange={(e) => setEmail(e.target.value)} disabled={submitting} className="h-11 bg-card" />
|
||||
</div>
|
||||
<Button type="submit" className="h-11 w-full text-base shadow-md" disabled={submitting}>
|
||||
{submitting && <Loader2 aria-hidden="true" className="size-4 animate-spin" />}
|
||||
{t("ForgotSubmit")}
|
||||
</Button>
|
||||
</form>
|
||||
</>
|
||||
)}
|
||||
<Link href="/login" className="block text-sm text-muted-foreground underline-offset-4 hover:underline">
|
||||
{t("ForgotBack")}
|
||||
</Link>
|
||||
</div>
|
||||
</AuthFrame>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user