Files
co-lite/solvway-admin-portal/app/components/app/AuthFrame.tsx
T
ngqileandClaude Opus 5.5 ee517753aa feat(portal): language picker on the sign-in page
The spec lists the picker before sign-in, and staff who work in Chinese
need it there. Also makes the Chinese for "Switch off" differ from the
dialog's Close button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-02 13:41:22 +08:00

66 lines
3.0 KiB
TypeScript

"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, 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.
/** `corner` sits top right of the content column (the sign-in page puts the language picker there). */
export default function AuthFrame({ children, corner }: { children: ReactNode; corner?: 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">
<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")}
</span>
</div>
<div className="max-w-md space-y-8">
<p className="font-heading text-4xl leading-tight font-semibold tracking-tight text-balance">
{t("BackOfficePanelTitle")}
</p>
<ul className="space-y-4">
{PANEL_POINTS.map(({ icon: PointIcon, code }) => (
<li key={code} className="flex items-center gap-3 text-base font-medium">
<span className="flex size-10 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground dark:bg-accent-foreground dark:text-accent">
<PointIcon aria-hidden="true" className="size-5" />
</span>
{t(code)}
</li>
))}
</ul>
</div>
<span aria-hidden="true" />
</aside>
<main className="relative flex flex-col items-center justify-center gap-8 p-6 sm:p-10">
{corner && <div className="absolute top-4 right-4">{corner}</div>}
<div className="w-full max-w-sm space-y-8">
{/* 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>
</div>
{children}
</div>
<PoweredBy />
</main>
</div>
);
}