Church details saved through Accounts' church.update (live at once). Settings: Search Console and Bing codes, Coming soon line, menu order. Audit log and recent edits. A made share image, Event / VideoObject / PodcastEpisode / BreadcrumbList structured data, permanent redirects from old page addresses. Saves refused when someone else saved in between; Ministry leaders' events; templates previewed with the church's own content before choosing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
2.9 KiB
TypeScript
57 lines
2.9 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { StorageMeter, type Storage } from "@/admin/media";
|
|
import { Loading, Notice, Panel, Title, useAdmin, when } from "@/admin/ui";
|
|
|
|
type Overview = {
|
|
pending: number;
|
|
lastPublished: { number: number; at: string } | null;
|
|
storage: Storage;
|
|
colourNotes: string[];
|
|
checklist: { key: string; label: string; done: boolean; href: string | null }[];
|
|
recent: { at: string; who: string; action: string; detail: string | null }[];
|
|
};
|
|
|
|
/** The dashboard (§10): the setup checklist, what's waiting to be published, storage. */
|
|
export default function Dashboard() {
|
|
const { data, error } = useAdmin<Overview>("/overview");
|
|
if (!data) return <Loading error={error} />;
|
|
return (
|
|
<>
|
|
<Title sub={data.lastPublished ? `Last published ${when(data.lastPublished.at)} (version ${data.lastPublished.number}).` : "Your site shows Coming soon until you publish it."}>Dashboard</Title>
|
|
<div className="grid gap-6 lg:grid-cols-2">
|
|
<Panel title="Getting your site ready">
|
|
<ol className="space-y-3">
|
|
{data.checklist.map((c) => (
|
|
<li key={c.key} className="flex items-start gap-3">
|
|
<span aria-hidden="true" className={c.done ? "text-green-700" : "text-gray-400"}>{c.done ? "✓" : "○"}</span>
|
|
<span className={c.done ? "text-gray-500 line-through" : ""}>{c.href ? <Link href={c.href} className="underline-offset-4 hover:underline">{c.label}</Link> : c.label}</span>
|
|
<span className="sr-only">{c.done ? "(done)" : "(to do)"}</span>
|
|
</li>
|
|
))}
|
|
</ol>
|
|
</Panel>
|
|
<div className="space-y-6">
|
|
<Panel title="Waiting to be published">
|
|
{data.pending ? (
|
|
<p>{data.pending} {data.pending === 1 ? "change" : "changes"}. <Link href="/admin/publish" className="font-semibold text-brand-text underline-offset-4 hover:underline">Review and publish</Link></p>
|
|
) : <p className="text-gray-600">Nothing: the site shows everything you've done.</p>}
|
|
</Panel>
|
|
<Panel title="Recent edits">
|
|
{data.recent.length === 0 ? <p className="text-gray-600">None yet.</p> : (
|
|
<ul className="space-y-2 text-sm">
|
|
{data.recent.map((e, i) => <li key={i}><span className="font-medium">{e.who}</span> {e.action.charAt(0).toLowerCase() + e.action.slice(1)}{e.detail && <>: {e.detail}</>} <span className="text-gray-500">({when(e.at)})</span></li>)}
|
|
</ul>
|
|
)}
|
|
</Panel>
|
|
<Panel title="Storage"><StorageMeter s={data.storage} /></Panel>
|
|
{data.colourNotes.length > 0 && (
|
|
<Notice tone="info"><p className="font-semibold">About your colours</p><ul className="mt-1 list-disc pl-5">{data.colourNotes.map((n) => <li key={n}>{n}</li>)}</ul></Notice>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|