Compare commits

..
10 changed files with 119 additions and 49 deletions

No files matched your search

@@ -79,3 +79,63 @@ Every dropdown in the admin portal SHALL open a styled option menu that matches
- **WHEN** an admin focuses a dropdown and presses Enter or Space, then the arrow keys and Enter
- **THEN** the menu opens, moves between options, and chooses one
### Requirement: Visitor Page Look
The public visitor pages (registration, invitation and check-in) SHALL show their content in one card on the page ground. The card SHALL be headed by the company name as a small label, the event name as the main heading, and the event dates and location. The pages SHALL use only the portal's theme tokens and SHALL NOT show a per-company logo or colour. The privacy notice SHALL be shown in full in English and Bahasa Malaysia as smaller, muted text that keeps at least 4.5:1 contrast.
#### Scenario: Visitor opens a registration code
- **WHEN** a visitor opens the registration page of an INS event
- **THEN** the card shows "INS" as a label above the event name, then the event dates and location
- **AND** the full privacy notice appears in both languages above the consent box
#### Scenario: Visitor needs a contact
- **WHEN** a visitor sees the mobile field on the registration form
- **THEN** a hint under it says that a mobile number or an email is required
#### Scenario: Visitor reaches an end state
- **WHEN** a visitor's registration is accepted, or the code is inactive, or check-in has not opened yet
- **THEN** the same card shows an icon and a heading for that state
### Requirement: Header Trail Without Repeats
The admin header SHALL NOT repeat the page title. On a page reached directly from the sidebar it SHALL show no trail. On a page below one, it SHALL show the parent page as a link back.
#### Scenario: Top-level page
- **WHEN** an admin opens the Events list
- **THEN** the header shows no trail text
#### Scenario: Sub-page
- **WHEN** an admin opens the new event page
- **THEN** the header shows "Events" as a link to the Events list
### Requirement: Table Scroll Cue
A table wider than its container SHALL show a fade on each edge where more columns can be scrolled into view. The fade SHALL disappear at that end of the scroll. Where a data table pins its first column, the pinned column covers the left fade and SHALL instead show a divider on its right edge.
#### Scenario: Users list on a phone
- **WHEN** an admin opens the Users list at 360 px wide
- **THEN** a fade shows on the right edge of the table
- **AND** after scrolling to the last column the right fade is gone
- **AND** the pinned username column shows a divider on its right edge
### Requirement: Sidebar Sections
The sidebar SHALL list the work pages first, then an "Administration" section for Users, Roles, Emails, Login security, Audit log and Companies. The section SHALL be marked by a divider and a small muted label, and only the divider SHALL show in the collapsed rail. A section with no item the admin may open SHALL NOT show.
#### Scenario: Super admin sidebar
- **WHEN** a super admin opens the portal
- **THEN** Dashboard, Events, Event leads, Interests and Leads are listed above the "Administration" label
- **AND** Users, Roles, Emails, Login security, Audit log and Companies are listed below it
#### Scenario: Staff without admin pages
- **WHEN** a staff user who can open only Events and Event leads opens the portal
- **THEN** the sidebar shows no "Administration" label
+1 -1
View File
@@ -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>
);
}