"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 (

Get your site ready to publish

{done} of {steps.length} done
{next?.href && ( Next: {next.label} )}
{!folded && (
    {steps.map((s, i) => { const isNext = s === next; const here = !!s.href && (path === s.href || path.startsWith(`${s.href}/`)); const body = ( <> {s.done ? : i + 1} {s.label} {s.done ? "(done)" : isNext ? "(next)" : "(to do)"} ); return (
  1. {s.href ? ( {body} ) : {body}} {i < steps.length - 1 && }
  2. ); })}
)}
); }