fix: neutral signed-out frame, visitor page polish and DESIGN.md update

Rest of the final-review fixes (the previous commit only removed the
duplicate breadcrumb test file, which moved into Breadcrumbs.test.tsx):
the signed-out frame drops the giraffe coat and 16px corners, the
loading icon spins, error headings fall back to the load-failed text,
invite registered and checked-in states are covered, the pinned-column
test renders a table, DESIGN.md describes the shipped look, and the
spec notes the pinned-column divider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-01 23:44:36 +08:00
1 parent 1458ea4aab
commit 6fda854df0
16 files changed
+98 -49

No files matched your search

@@ -36,13 +36,14 @@ The admin header SHALL NOT repeat the page title. On a page reached directly fro
### 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.
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
@@ -54,3 +54,4 @@ Verify for every task: `cd solvway-admin-portal && npx vitest run; echo VITEST=$
- Reset password (throwaway CV staff user, reverted afterwards): same frame as login at 1280 and 360 px, and the policy error is shown.
- My QR (same user, temporarily on the LC Live Check team, then removed and disabled): card layout at 360, 700, 1024 and 1280 px. At 1280 px a button overflowed the card, so the QR now stacks above the buttons (fix found in this check).
- After the whole-branch review: the giraffe-spot coat and 16px corners were removed from the signed-out frame (DESIGN.md forbids them); login checked again at 1280 and 360 px. DESIGN.md updated to the shipped look. Full verify: vitest 1585 passed (exit 0), tsc 0, lint 0 errors.
+10 -4
View File
@@ -177,10 +177,16 @@ Slate neutrals with a single blue voice, plus muted semantic and chart tones tha
An app shell: a sticky 240px white sidebar (collapsible to a 76px icon rail on desktop, a left sheet below the lg breakpoint) beside a column holding a sticky 56px white header and the main area. The sidebar's top block is header-high so its bottom hairline continues the header's. Main content sits on the slate ground with 16px padding, centred up to 1600px.
Page anatomy: breadcrumb in the header, page header (title, optional meta line, actions right-aligned and wrapping), then filter row, then the content card. Rhythm is a 4px base: 8px between related controls, 16px between blocks and around the page, 24px inside cards. KPI tiles sit in one row of equal columns. Tables scroll horizontally inside their card with a soft shadow on whichever edge has more content. The page reserves the scrollbar gutter so overlays never shift the layout.
Page anatomy: on a sub-page the header shows its parent page as a link back (a page reached from the sidebar shows none, since its title already names it), then the page header (title, optional meta line, actions right-aligned and wrapping), then filter row, then the content card. Rhythm is a 4px base: 8px between related controls, 16px between blocks and around the page, 24px inside cards. KPI tiles sit in one row of equal columns. Tables scroll horizontally inside their card with a 20px shadow at 18% ink on whichever edge has more content; it fades out at that end of the scroll. A data table's pinned first column covers the left shadow, so it carries a 1px hairline on its right edge instead. The page reserves the scrollbar gutter so overlays never shift the layout.
The footer credit "Powered by Containerverse Sdn. Bhd." sits at the foot of the sidebar on desktop and under the content on mobile, in 12px muted text.
**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.
**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.
## Elevation & Depth
Flat surfaces separated by hairlines, with a whisper of shadow that only says "this lifts slightly". Cards carry the card shadow; controls carry a barely-there shadow; floating layers (menus, popovers, toasts, dialogs) step up. In dark mode the card shadow becomes a single dark drop and hairlines do the work.
@@ -231,8 +237,8 @@ Quiet, compact, unmistakable.
- Live inside a card or an 8px framed container. Header row in slate tint, 40px tall, 12px semibold uppercase muted labels with sort chevrons; cells 14px with 8px padding; rows separated by hairlines, hovering at 50% slate tint. The pager below reads "1-7 of 7" left and outline Previous / Next right.
### Navigation
- **Sidebar:** white, right hairline. Items are 44px tall, 8px radius, 20px outline icon plus 14px medium label. Idle: muted slate, hover slate tint with ink. Active: blue tint with deep blue ink, `aria-current="page"`. Groups expand with a rotating chevron and indent children behind a left hairline. The collapsed rail shows icons only, with groups opening as a side popover.
- **Header:** white, bottom hairline, 56px; breadcrumb left; company picker (a styled select), locale switcher, theme toggle and user menu (blue avatar initial) right.
- **Sidebar:** white, right hairline. Items are 44px tall, 8px radius, 20px outline icon plus 14px medium label. Idle: muted slate, hover slate tint with ink. Active: blue tint with deep blue ink, `aria-current="page"`. Groups expand with a rotating chevron and indent children behind a left hairline. The collapsed rail shows icons only, with groups opening as a side popover. Admin pages (Users, Roles, Emails, Login security, Audit log, Companies) sit below a hairline divider and a 12px semibold muted "Administration" label; the rail keeps the divider only, and a section with nothing to open is not drawn.
- **Header:** white, bottom hairline, 56px; the link back to the parent page left (sub-pages only); company picker (a styled select), locale switcher, theme toggle and user menu (blue avatar initial) right.
### Data States
- Empty: centred muted icon, 14px muted message and a corrective action. Error: a 40% red-bordered panel on 5% red with an alert icon and an outline Retry. Loading: skeleton rows in a bordered surface.
@@ -253,4 +259,4 @@ Quiet, compact, unmistakable.
- **Don't** add a second typeface or a display face; Inter carries everything.
- **Don't** use semantic or chart tones to mark something clickable.
- **Don't** add shadows beyond the four steps, or let a shadow stand in for a hairline.
- **Don't** apply this system to the booth (My QR), visitor pages (/r, /i, /c) or login screens piecemeal; they move onto it in their own follow-up change.
- **Don't** brand the visitor pages per company (logo or colour) without an owner decision; they stay on the neutral Co-Lite tokens.
@@ -44,6 +44,12 @@ describe("/c visitor card", () => {
expect(h1s().map((h) => h.textContent)).toEqual(["Expo 2026"]);
});
it("loading icon spins", () => {
mocks.getCheckin.mockReturnValue(new Promise(() => {}));
render(<CheckinPage />);
expect(screen.getByRole("status").querySelector("svg")).toHaveClass("motion-safe:animate-spin");
});
it("welcome shows an icon and heading under the event header", async () => {
const user = userEvent.setup();
render(<CheckinPage />);
+4 -4
View File
@@ -59,12 +59,12 @@ export default function CheckinPage() {
}
const open = state?.state === "OPEN" ? state : null;
const alone = (icon: typeof Clock, heading: string, role: "status" | "alert", tone?: "error") => (
<VisitorCard><VisitorState h1 icon={icon} heading={heading} role={role} tone={tone} /></VisitorCard>
const alone = (icon: typeof Clock, heading: string, role: "status" | "alert", tone?: "error", iconClassName?: string) => (
<VisitorCard><VisitorState h1 icon={icon} heading={heading} role={role} tone={tone} iconClassName={iconClassName} /></VisitorCard>
);
if (phase === "loading") return alone(Loader2, t("UiLoading"), "status");
if (phase === "loading") return alone(Loader2, t("UiLoading"), "status", undefined, "motion-safe:animate-spin");
if (phase === "inactive") return alone(AlertCircle, t("RegInactive"), "alert");
if (phase === "error" || !state) return alone(AlertCircle, error ?? "", "alert", "error");
if (phase === "error" || !state) return alone(AlertCircle, error ?? t("RegLoadFailed"), "alert", "error");
if (!open) return alone(Clock, state.state === "NOT_YET" ? t("ChkNotYet", { date: state.startDate }) : t("ChkEnded"), "status");
let body;
@@ -13,16 +13,13 @@ const PANEL_POINTS = [
] 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
// 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 (
<div className="grid min-h-svh bg-background lg:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]">
<aside className="relative isolate hidden flex-col justify-between gap-10 overflow-hidden bg-accent p-12 text-accent-foreground lg:flex">
{/* Light accent ground with the giraffe-spot coat at 14%. In dark mode the coat and the chips
switch to --accent-foreground so they stay legible on the dark accent. */}
<span aria-hidden="true" className="giraffe-spots absolute inset-0 -z-10 opacity-[0.14] [--giraffe-patch:var(--primary)] dark:[--giraffe-patch:var(--accent-foreground)]" />
<div className="flex items-center gap-4">
<span className="rounded-full bg-primary px-3 py-1 text-sm font-semibold text-primary-foreground dark:bg-accent-foreground dark:text-accent">
{t("BackOfficeLabel")}
@@ -50,9 +47,8 @@ export default function AuthFrame({ children }: { children: ReactNode }) {
<main className="flex flex-col items-center justify-center gap-8 p-6 sm:p-10">
<div className="w-full max-w-sm space-y-8">
{/* Below lg a short brand band stands in for the panel: same accent ground and giraffe-spot coat. */}
<div className="relative isolate flex items-center gap-3 overflow-hidden rounded-2xl bg-accent p-4 lg:hidden">
<span aria-hidden="true" className="giraffe-spots absolute inset-0 -z-10 opacity-[0.14] [--giraffe-patch:var(--primary)] dark:[--giraffe-patch:var(--accent-foreground)]" />
{/* Below lg a short brand band stands in for the panel: same accent ground. */}
<div className="relative isolate flex items-center gap-3 overflow-hidden rounded-lg bg-accent p-4 lg:hidden">
<span className="rounded-full bg-primary px-3 py-1 text-xs font-semibold text-primary-foreground dark:bg-accent-foreground dark:text-accent">
{t("BackOfficeLabel")}
</span>
@@ -115,3 +115,27 @@ describe("Breadcrumbs pick the most specific match", () => {
expect(list.querySelectorAll("li li")).toHaveLength(0);
});
});
describe("Breadcrumbs trail without repeats", () => {
const EVENT_LINKS: SidebarLink[] = [
{ name: "Event", url: "", children: [{ name: "Events", url: "/events", children: [] }] },
];
it("shows no trail on the Events list", () => {
state.links = EVENT_LINKS;
state.pathname = "/events";
const { container } = render(<Breadcrumbs />);
expect(container).toBeEmptyDOMElement();
});
it("shows Events as a link to the list on the new event page", () => {
state.links = EVENT_LINKS;
state.pathname = "/events/new";
render(<Breadcrumbs />);
expect(screen.getByRole("link", { name: "Events" })).toHaveAttribute("href", "/events");
});
});
@@ -8,7 +8,7 @@ type EventHeader = Pick<RegistrationInfo, "companyName" | "eventName" | "startDa
// The public visitor page frame: one card on the page ground, event header first, PoweredBy under it.
export function VisitorCard({ event, title, children }: { event?: EventHeader; title?: string; children?: ReactNode }) {
return (
<div className="flex min-h-screen flex-col items-center bg-background px-4 py-8">
<div className="flex min-h-svh flex-col items-center bg-background px-4 py-8">
<main className="w-full max-w-md space-y-6 rounded-lg border bg-card p-6 shadow-card">
{event && (
<header className="space-y-2">
@@ -40,15 +40,16 @@ interface StateProps {
tone?: "default" | "error";
/** The heading is the page's h1: for states shown without the card's event header. */
h1?: boolean;
iconClassName?: string;
}
// A message inside the card (thanks, inactive, closed). h2 under the event header's h1; h1 when the card has no event header.
export function VisitorState({ icon: Icon, heading, text, action, role, tone = "default", h1 }: StateProps) {
export function VisitorState({ icon: Icon, heading, text, action, role, tone = "default", h1, iconClassName }: StateProps) {
const Heading = h1 ? "h1" : "h2";
return (
<div role={role} className="flex flex-col items-center gap-3 text-center">
<span className={`flex size-12 items-center justify-center rounded-full ${tone === "error" ? "bg-destructive/10 text-destructive" : "bg-accent text-accent-foreground"}`}>
<Icon className="size-6" aria-hidden="true" />
<Icon className={`size-6 ${iconClassName ?? ""}`} aria-hidden="true" />
</span>
<Heading className="text-lg font-semibold text-balance">{heading}</Heading>
{text && <p className="text-sm text-muted-foreground">{text}</p>}
@@ -1,15 +1,21 @@
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { render, screen } from "@testing-library/react";
import type { ColumnDef } from "@tanstack/react-table";
import { describe, expect, it } from "vitest";
import { DataTable } from "./data-table";
// refine-visitor-pages-and-shell: the pinned first column hides the left scroll cue, so it carries
// a divider on its right edge that shows where scrolled columns slide under it.
type Row = { id: string; name: string };
const columns: ColumnDef<Row, unknown>[] = [{ accessorKey: "name", header: "Name" }];
describe("pinned first column", () => {
const src = readFileSync(join(__dirname, "data-table.tsx"), "utf8");
it("draws a token-coloured divider on the right edge of pinned head and body cells", () => {
for (const name of ["PINNED_HEAD", "PINNED_CELL"]) {
const value = src.match(new RegExp(`const ${name}\\s*=\\s*\\n?\\s*'([^']*)'`))?.[1] ?? "";
expect(value, name).toContain("shadow-[inset_-1px_0_0_var(--border)]");
}
it("draws a token-coloured divider on the right edge of the pinned head and body cells", () => {
render(
<DataTable<Row> label="t" columns={columns} data={[{ id: "1", name: "Alpha" }]} total={1} page={1} pageSize={20}
onPageChange={() => {}} rowKey={r => r.id} />,
);
const divider = "shadow-[inset_-1px_0_0_var(--border)]";
expect(screen.getByRole("columnheader", { name: "Name" })).toHaveClass(divider);
expect(screen.getByText("Alpha").closest("td")).toHaveClass(divider);
});
});
-15
View File
@@ -75,11 +75,6 @@
--table-head: #F1F5F9;
--table-head-foreground: #475569;
/* Giraffe-spot brand pattern (same artwork as the customer portal's --giraffe-motif): a seamless
tile of coat patches, shape only — used as a mask by .giraffe-spots below. */
--giraffe-tile: 180px;
--giraffe-motif: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="180" height="180" viewBox="0 0 180 180"%3E%3Cpath d="M9.1 -0.2Q15.0 -5.6 23.9 -5.3L37.9 -4.9Q46.8 -4.6 50.4 -1.0L56.1 4.7Q59.7 8.4 56.0 18.6L50.2 34.8Q46.6 45.0 37.4 47.5L23.1 51.3Q13.9 53.7 8.9 47.6L0.9 38.0Q-4.1 31.9 -4.7 26.9L-5.6 18.9Q-6.2 13.8 -0.2 8.4ZM9.1 179.8Q15.0 174.4 23.9 174.7L37.9 175.1Q46.8 175.4 50.4 179.0L56.1 184.7Q59.7 188.4 56.0 198.6L50.2 214.8Q46.6 225.0 37.4 227.5L23.1 231.3Q13.9 233.7 8.9 227.6L0.9 218.0Q-4.1 211.9 -4.7 206.9L-5.6 198.9Q-6.2 193.8 -0.2 188.4ZM230.2 34.8Q226.6 45.0 217.4 47.5L203.1 51.3Q193.9 53.7 188.9 47.6L180.9 38.0Q175.9 31.9 175.3 26.9L174.4 18.9Q173.8 13.8 179.8 8.4L189.1 -0.2Q195.0 -5.6 203.9 -5.3L217.9 -4.9Q226.8 -4.6 230.4 -1.0L236.1 4.7Q239.7 8.4 236.0 18.6ZM230.2 214.8Q226.6 225.0 217.4 227.5L203.1 231.3Q193.9 233.7 188.9 227.6L180.9 218.0Q175.9 211.9 175.3 206.9L174.4 198.9Q173.8 193.8 179.8 188.4L189.1 179.8Q195.0 174.4 203.9 174.7L217.9 175.1Q226.8 175.4 230.4 179.0L236.1 184.7Q239.7 188.4 236.0 198.6ZM12.7 70.7Q15.2 58.5 24.3 56.1L38.6 52.3Q47.8 49.9 55.8 57.4L68.3 69.3Q76.4 76.9 70.4 86.7L61.1 102.2Q55.1 112.1 41.5 109.3L20.1 104.8Q6.4 101.9 8.9 89.8ZM49.1 156.8Q45.9 170.4 37.5 170.1L24.4 169.7Q16.0 169.5 11.5 152.7L4.4 126.3Q-0.2 109.5 1.0 108.7L2.9 107.4Q4.0 106.5 18.2 109.5L40.5 114.2Q54.7 117.1 55.4 118.5L56.5 120.6Q57.2 121.9 54.0 135.5ZM229.1 156.8Q225.9 170.4 217.5 170.1L204.4 169.7Q196.0 169.5 191.5 152.7L184.4 126.3Q179.8 109.5 181.0 108.7L182.9 107.4Q184.0 106.5 198.2 109.5L220.5 114.2Q234.7 117.1 235.4 118.5L236.5 120.6Q237.2 121.9 234.0 135.5ZM59.5 54.1Q51.4 46.4 55.0 36.3L60.7 20.3Q64.4 10.2 74.6 9.7L90.7 9.0Q101.0 8.6 103.9 24.4L108.5 49.3Q111.4 65.2 111.2 65.8L110.9 66.8Q110.6 67.4 102.2 69.2L88.8 72.0Q80.3 73.7 72.2 66.1ZM78.1 126.0Q61.6 119.6 61.0 118.3L59.9 116.3Q59.2 115.0 65.4 104.8L75.0 88.8Q81.1 78.7 89.6 76.9L103.0 74.1Q111.5 72.4 119.4 83.5L131.8 100.9Q139.6 112.1 134.2 120.5L125.7 133.8Q120.3 142.3 103.9 135.9ZM74.3 4.7Q63.6 5.2 60.0 1.5L54.3 -4.2Q50.6 -7.9 53.7 -21.1L58.6 -41.8Q61.6 -55.0 77.6 -48.8L102.8 -39.1Q118.8 -32.9 118.7 -27.7L118.6 -19.5Q118.6 -14.2 113.9 -9.3L106.6 -1.4Q101.9 3.5 91.2 4.0ZM74.3 184.7Q63.6 185.2 60.0 181.5L54.3 175.8Q50.6 172.1 53.7 158.9L58.6 138.2Q61.6 125.0 77.6 131.2L102.8 140.9Q118.8 147.1 118.7 152.3L118.6 160.5Q118.6 165.8 113.9 170.7L106.6 178.6Q101.9 183.5 91.2 184.0ZM155.6 7.5Q168.9 14.4 169.4 19.2L170.3 26.8Q170.8 31.6 155.4 40.0L131.2 53.1Q115.8 61.5 113.0 46.2L108.5 22.1Q105.7 6.8 110.2 2.0L117.1 -5.4Q121.6 -10.1 134.8 -3.3ZM155.6 187.5Q168.9 194.4 169.4 199.2L170.3 206.8Q170.8 211.6 155.4 220.0L131.2 233.1Q115.8 241.5 113.0 226.2L108.5 202.1Q105.7 186.8 110.2 182.0L117.1 174.6Q121.6 169.9 134.8 176.7ZM-56.7 80.4Q-64.7 69.2 -64.5 68.6L-64.2 67.7Q-64.0 67.1 -48.1 58.4L-23.0 44.8Q-7.1 36.1 -2.2 42.0L5.4 51.3Q10.3 57.2 7.8 69.8L3.8 89.7Q1.2 102.4 -0.2 103.4L-2.5 105.0Q-3.9 106.0 -13.0 107.0L-27.1 108.4Q-36.2 109.3 -44.1 98.1ZM123.3 80.4Q115.3 69.2 115.5 68.6L115.8 67.7Q116.0 67.1 131.9 58.4L157.0 44.8Q172.9 36.1 177.8 42.0L185.4 51.3Q190.3 57.2 187.8 69.8L183.8 89.7Q181.2 102.4 179.8 103.4L177.5 105.0Q176.1 106.0 167.0 107.0L152.9 108.4Q143.8 109.3 135.9 98.1ZM-13.6 -68.0Q-4.9 -68.9 -0.4 -52.1L6.7 -25.7Q11.2 -8.9 5.5 -3.7L-3.5 4.5Q-9.2 9.8 -22.4 2.9L-43.2 -7.9Q-56.4 -14.7 -56.4 -20.1L-56.2 -28.5Q-56.2 -33.9 -50.5 -42.8L-41.6 -56.8Q-35.9 -65.7 -27.2 -66.6ZM-13.6 112.0Q-4.9 111.1 -0.4 127.9L6.7 154.3Q11.2 171.1 5.5 176.3L-3.5 184.5Q-9.2 189.8 -22.4 182.9L-43.2 172.1Q-56.4 165.3 -56.4 159.9L-56.2 151.5Q-56.2 146.1 -50.5 137.2L-41.6 123.2Q-35.9 114.3 -27.2 113.4ZM166.4 -68.0Q175.1 -68.9 179.6 -52.1L186.7 -25.7Q191.2 -8.9 185.5 -3.7L176.5 4.5Q170.8 9.8 157.6 2.9L136.8 -7.9Q123.6 -14.7 123.6 -20.1L123.8 -28.5Q123.8 -33.9 129.5 -42.8L138.4 -56.8Q144.1 -65.7 152.8 -66.6ZM166.4 112.0Q175.1 111.1 179.6 127.9L186.7 154.3Q191.2 171.1 185.5 176.3L176.5 184.5Q170.8 189.8 157.6 182.9L136.8 172.1Q123.6 165.3 123.6 159.9L123.8 151.5Q123.8 146.1 129.5 137.2L138.4 123.2Q144.1 114.3 152.8 113.4Z"/%3E%3C/svg%3E');
--sidebar: #FFFFFF;
--sidebar-foreground: #0F172A;
--sidebar-primary: #2563EB;
@@ -190,16 +185,6 @@ h4 {
}
/* every figure, ID and percentage
aligns on tabular numerals. */
/* The giraffe-spot pattern as a field: the element's background is the patch colour, masked to the
coat shape, so whatever is behind shows through the gaps. Recolour with --giraffe-patch, rescale
with --giraffe-size. Decorative only; under text only as a faint wash whose contrast is checked. */
.giraffe-spots {
background-color: var(--giraffe-patch, var(--accent));
-webkit-mask-image: var(--giraffe-motif);
mask-image: var(--giraffe-motif);
-webkit-mask-size: var(--giraffe-size, var(--giraffe-tile)) var(--giraffe-size, var(--giraffe-tile));
mask-size: var(--giraffe-size, var(--giraffe-tile)) var(--giraffe-size, var(--giraffe-tile));
}
.tabular {
@@ -36,7 +36,7 @@ describe("/i visitor card", () => {
expect(document.querySelectorAll("main").length).toBe(1);
});
it("thank you, registered and checked in show an icon and heading under one h1", async () => {
it("thank you shows an icon and heading under one h1", async () => {
const user = userEvent.setup();
render(<InvitePage />);
await user.click(await screen.findByRole("button", { name: "Register" }));
@@ -46,6 +46,24 @@ describe("/i visitor card", () => {
expect(h1s().length).toBe(1);
});
it("loading icon spins", () => {
mocks.getInvite.mockReturnValue(new Promise(() => {}));
render(<InvitePage />);
expect(screen.getByRole("status").querySelector("svg")).toHaveClass("motion-safe:animate-spin");
});
it.each([
["REGISTERED", "You're already registered for Expo 2026."],
["CHECKED_IN", "You're already checked in to Expo 2026."],
])("%s invite shows an icon and heading under one h1", async (state, heading) => {
mocks.getInvite.mockResolvedValue({ ...info, state });
render(<InvitePage />);
const s = await screen.findByRole("status");
expect(s.querySelector("svg")).toBeTruthy();
expect(screen.getByRole("heading", { level: 2 }).textContent).toBe(heading);
expect(h1s().map((h) => h.textContent)).toEqual(["Expo 2026"]);
});
it("check-in day offers the button and welcomes with an icon under one h1", async () => {
const user = userEvent.setup();
mocks.getInvite.mockResolvedValue({ ...info, state: "CHECKIN" });
+2 -2
View File
@@ -49,9 +49,9 @@ export default function InvitePage() {
const event = info?.eventName ?? "";
const done = (text: string) => <VisitorState icon={CheckCircle2} heading={text} role="status" />;
if (phase === "loading") return <VisitorCard><VisitorState h1 icon={Loader2} heading={t("UiLoading")} role="status" /></VisitorCard>;
if (phase === "loading") return <VisitorCard><VisitorState h1 icon={Loader2} iconClassName="motion-safe:animate-spin" heading={t("UiLoading")} role="status" /></VisitorCard>;
if (phase === "inactive") return <VisitorCard><VisitorState h1 icon={AlertCircle} heading={t("InviteInactive")} role="alert" /></VisitorCard>;
if (phase === "error" || !info) return <VisitorCard><VisitorState h1 icon={AlertCircle} heading={error ?? ""} role="alert" tone="error" /></VisitorCard>;
if (phase === "error" || !info) return <VisitorCard><VisitorState h1 icon={AlertCircle} heading={error ?? t("RegLoadFailed")} role="alert" tone="error" /></VisitorCard>;
let body;
if (welcome !== null) body = done(welcome ? t("InviteWelcome", { name: welcome }) : t("InviteWelcomeAnon"));
@@ -42,6 +42,12 @@ describe("/r visitor card", () => {
expect(document.querySelectorAll("main").length).toBe(1);
});
it("loading icon spins", () => {
mocks.getRegistration.mockReturnValue(new Promise(() => {}));
render(<RegisterPage />);
expect(screen.getByRole("status").querySelector("svg")).toHaveClass("motion-safe:animate-spin");
});
it("inactive shows an alert heading as the only h1, no event details", async () => {
mocks.getRegistration.mockRejectedValue(new ApiError("x", 404, { code: "CODE_INACTIVE" }));
render(<RegisterPage />);
+2 -2
View File
@@ -34,9 +34,9 @@ export default function RegisterPage() {
});
}, [token, t]);
if (phase === "loading") return <VisitorCard><VisitorState h1 icon={Loader2} heading={t("UiLoading")} role="status" /></VisitorCard>;
if (phase === "loading") return <VisitorCard><VisitorState h1 icon={Loader2} iconClassName="motion-safe:animate-spin" heading={t("UiLoading")} role="status" /></VisitorCard>;
if (phase === "inactive") return <VisitorCard><VisitorState h1 icon={AlertCircle} heading={t("RegInactive")} role="alert" /></VisitorCard>;
if (!info) return <VisitorCard><VisitorState h1 icon={AlertCircle} heading={loadError ?? ""} role="alert" tone="error" /></VisitorCard>;
if (!info) return <VisitorCard><VisitorState h1 icon={AlertCircle} heading={loadError ?? t("RegLoadFailed")} role="alert" tone="error" /></VisitorCard>;
return (
<VisitorCard event={info}>
{phase === "done" ? (
@@ -11,7 +11,7 @@ describe("ResetPasswordPage frame", () => {
it("uses the login two-column frame", () => {
const { container } = render(<ResetPasswordPage />);
expect(screen.getByText("Everything behind Co-Lite, in one place.")).toBeInTheDocument();
expect(container.querySelector(".giraffe-spots")).not.toBeNull();
expect(container.querySelector(".giraffe-spots")).toBeNull();
expect(screen.getByRole("link", { name: "Containerverse Sdn. Bhd." })).toBeInTheDocument();
expect(screen.getByRole("heading", { name: "Set your password" })).toBeInTheDocument();
});
@@ -20,7 +20,6 @@ const FILES = globSync("app/**/*.tsx", { cwd: ROOT }).filter((f) => !/\.test\.ts
const PROJECT_CLASSES = new Set([
"tabular",
"scrollable",
"giraffe-spots",
"print-handover",
"print-picklist",
"admin-calendar",