Files
co-lite/solvway-admin-portal/app/components/registration/VisitorCard.tsx
T
ngqileandClaude Opus 5.5 6fda854df0 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
2026-12-01 23:44:36 +08:00

60 lines
2.7 KiB
TypeScript

import type { ReactNode } from "react";
import { CalendarDays, MapPin, type LucideIcon } from "lucide-react";
import PoweredBy from "@/app/components/app/PoweredBy";
import type { RegistrationInfo } from "@/app/lib/services/publicRegistration";
type EventHeader = Pick<RegistrationInfo, "companyName" | "eventName" | "startDate" | "endDate" | "location">;
// 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-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">
<p className="text-xs font-semibold tracking-wide text-primary uppercase">{event.companyName}</p>
<h1 className="text-2xl font-semibold">{title ?? event.eventName}</h1>
<p className="flex items-center gap-2 text-sm text-muted-foreground">
<CalendarDays className="size-4 shrink-0" aria-hidden="true" />
<span>{event.startDate} - {event.endDate}</span>
</p>
<p className="flex items-center gap-2 text-sm text-muted-foreground">
<MapPin className="size-4 shrink-0" aria-hidden="true" />
<span>{event.location}</span>
</p>
</header>
)}
{children}
</main>
<div className="mt-4"><PoweredBy /></div>
</div>
);
}
interface StateProps {
icon: LucideIcon;
heading: string;
text?: string;
action?: ReactNode;
role?: "status" | "alert";
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, 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 ${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>}
{action}
</div>
);
}