Accounts 1.8.0, Website 1.1.0: admins redesigned as Cross Events' dashboard and settings
- Website: an icon sidebar in groups (Your site, Content, Go live, Team), a dashboard with cards and a tile per part of the admin, steps to the first publish across the top of every admin page, and a live preview beside the page editor and Template and style (computer or phone width, folds away, reloads on save). A framed request (Sec-Fetch-Dest: iframe) with an admin session reads the drafts, so no preview cookie is set. /preview/start takes ?to=. The page editor has Content and Page details tabs. - Accounts: /admin is an overview (cards, "Needs you", a tile per section); People moved to /admin/people; the sidebar shows the part you're in, grouped, with a count on Deletion requests; People redesigned, with a confirm before Deactivate; Email and WhatsApp split into two cards. - Both: darker grey labels for contrast; lucide-react in the Website. - e2e: the live preview shows drafts while the site stays live; axe on the page editor. - docs: VERSIONS, changelogs, WHATS-NEW. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
"use client";
|
||||
|
||||
/**
|
||||
* The steps to a first publish, across the top of every admin page until the site is live: each
|
||||
* step is a link, done ones are ticked, and "Next" goes to the first one still to do. It can be
|
||||
* folded to one line (remembered in this browser).
|
||||
*/
|
||||
import Link from "next/link";
|
||||
import { useEffect, useState } from "react";
|
||||
import { ArrowRight, Check, ChevronDown, ChevronUp, Rocket } from "lucide-react";
|
||||
import { cx, type Overview } from "./ui";
|
||||
|
||||
const KEY = "ccw-admin-steps-folded";
|
||||
|
||||
export function SetupSteps({ overview, path }: { overview: Overview; path: string }) {
|
||||
const [folded, setFolded] = useState(false);
|
||||
useEffect(() => {
|
||||
try {
|
||||
// Only the browser knows what was chosen last time.
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setFolded(window.localStorage.getItem(KEY) === "1");
|
||||
} catch {
|
||||
// Storage blocked: the steps show unfolded.
|
||||
}
|
||||
}, []);
|
||||
const fold = (v: boolean) => {
|
||||
setFolded(v);
|
||||
try { window.localStorage.setItem(KEY, v ? "1" : "0"); } catch { /* not kept */ }
|
||||
};
|
||||
|
||||
const steps = overview.checklist;
|
||||
const done = steps.filter((s) => s.done).length;
|
||||
const next = steps.find((s) => !s.done) ?? null;
|
||||
const percent = steps.length ? Math.round((done / steps.length) * 100) : 0;
|
||||
|
||||
return (
|
||||
<section aria-label="Getting your site ready" className="mb-6 rounded-xl border border-brand/20 bg-white shadow-sm">
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-3 p-4">
|
||||
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-on" aria-hidden><Rocket className="h-[18px] w-[18px]" /></span>
|
||||
<div className="min-w-0 flex-1">
|
||||
<h2 className="text-sm font-semibold text-gray-900">Get your site ready to publish</h2>
|
||||
<div className="mt-1 flex items-center gap-2">
|
||||
<div className="h-1.5 w-32 overflow-hidden rounded-full bg-gray-200" role="progressbar" aria-valuenow={done} aria-valuemin={0} aria-valuemax={steps.length} aria-label="Steps done">
|
||||
<div className="h-full rounded-full bg-brand transition-all" style={{ width: `${percent}%` }} />
|
||||
</div>
|
||||
<span className="text-xs text-gray-500">{done} of {steps.length} done</span>
|
||||
</div>
|
||||
</div>
|
||||
{next?.href && (
|
||||
<Link href={next.href} className="order-last inline-flex w-full items-center justify-center gap-1.5 rounded-lg bg-brand px-3 py-2 text-sm font-semibold text-brand-on hover:bg-brand-dark sm:order-none sm:w-auto">
|
||||
<span className="hidden sm:inline">Next:</span> {next.label}<ArrowRight className="h-4 w-4" aria-hidden />
|
||||
</Link>
|
||||
)}
|
||||
<button type="button" onClick={() => fold(!folded)} aria-expanded={!folded} aria-label={folded ? "Show the steps" : "Hide the steps"} title={folded ? "Show the steps" : "Hide the steps"}
|
||||
className="rounded-lg p-2 text-gray-500 hover:bg-gray-100 hover:text-gray-800">
|
||||
{folded ? <ChevronDown className="h-4 w-4" aria-hidden /> : <ChevronUp className="h-4 w-4" aria-hidden />}
|
||||
</button>
|
||||
</div>
|
||||
{!folded && (
|
||||
<ol className="flex gap-2 overflow-x-auto border-t border-gray-100 px-4 py-3">
|
||||
{steps.map((s, i) => {
|
||||
const isNext = s === next;
|
||||
const here = !!s.href && (path === s.href || path.startsWith(`${s.href}/`));
|
||||
const body = (
|
||||
<>
|
||||
<span className={cx("flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-semibold",
|
||||
s.done ? "bg-green-600 text-white" : isNext ? "bg-brand text-brand-on ring-4 ring-brand/15" : "bg-gray-100 text-gray-500")} aria-hidden>
|
||||
{s.done ? <Check className="h-4 w-4" /> : i + 1}
|
||||
</span>
|
||||
<span className={cx("text-sm leading-tight", s.done ? "text-gray-500" : isNext ? "font-semibold text-gray-900" : "text-gray-700", here && "underline decoration-2 underline-offset-4")}>{s.label}</span>
|
||||
<span className="sr-only">{s.done ? "(done)" : isNext ? "(next)" : "(to do)"}</span>
|
||||
</>
|
||||
);
|
||||
return (
|
||||
<li key={s.key} className="flex min-w-[10rem] flex-1 items-center gap-2">
|
||||
{s.href ? (
|
||||
<Link href={s.href} aria-current={here ? "step" : undefined} className="flex flex-1 items-center gap-2 rounded-lg p-1.5 hover:bg-gray-50">{body}</Link>
|
||||
) : <span className="flex flex-1 items-center gap-2 p-1.5">{body}</span>}
|
||||
{i < steps.length - 1 && <span className={cx("hidden h-px w-6 shrink-0 lg:block", s.done ? "bg-green-600" : "bg-gray-200")} aria-hidden />}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user