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:
@@ -3,12 +3,19 @@
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
BookOpen, Building2, CalendarDays, ChevronRight, FileText, Gift, HandHeart, Home, Mail, MapPin, Mic, Plus, ShieldCheck, Users, type LucideIcon,
|
||||
} from "lucide-react";
|
||||
import { api } from "@/admin/api";
|
||||
import { Btn, Field, inputClass, Loading, Notice, Panel, Title, useAction, useAdmin } from "@/admin/ui";
|
||||
|
||||
type PageRow = { id: string; kind: string; slug: string; title: string; inNav: boolean; path: string };
|
||||
|
||||
const KINDS: Record<string, string> = { home: "Home", visit: "Plan your visit", about: "About", leadership: "Leadership", ministries: "Ministries", events: "Events", messages: "Messages", give: "Give", contact: "Contact", terms: "Terms", safeguarding: "Safeguarding", custom: "Your own page" };
|
||||
const KINDS: Record<string, [string, LucideIcon]> = {
|
||||
home: ["Home", Home], visit: ["Plan your visit", MapPin], about: ["About", Building2], leadership: ["Leadership", Users], ministries: ["Ministries", HandHeart],
|
||||
events: ["Events", CalendarDays], messages: ["Messages", Mic], give: ["Give", Gift], contact: ["Contact", Mail], terms: ["Terms", BookOpen],
|
||||
safeguarding: ["Safeguarding", ShieldCheck], custom: ["Your own page", FileText],
|
||||
};
|
||||
|
||||
/** Pages (§6): the fixed ones and the church's own, built from blocks. */
|
||||
export default function Pages() {
|
||||
@@ -24,22 +31,29 @@ export default function Pages() {
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Title sub="Each page is a draft until you publish.">Pages</Title>
|
||||
<Title icon={FileText} sub="Open a page to change what it says, with a live preview beside it. Each change is a draft until you publish.">Pages</Title>
|
||||
<div className="grid gap-6 lg:grid-cols-[2fr_1fr]">
|
||||
<Panel>
|
||||
<ul className="divide-y divide-gray-200">
|
||||
{data.map((p) => (
|
||||
<li key={p.id} className="flex items-center justify-between gap-3 py-3">
|
||||
<div>
|
||||
<Link href={`/admin/pages/${p.id}`} className="font-medium underline-offset-4 hover:underline">{p.title}</Link>
|
||||
<p className="text-xs text-gray-500">{KINDS[p.kind] ?? p.kind} · {p.path}{!p.inNav && p.kind !== "home" && " · not in the menu"}</p>
|
||||
</div>
|
||||
<Link href={`/admin/pages/${p.id}`} className="text-sm font-semibold text-brand-text">Edit</Link>
|
||||
</li>
|
||||
))}
|
||||
<Panel className="!p-2">
|
||||
<ul className="divide-y divide-gray-100">
|
||||
{data.map((p) => {
|
||||
const [kind, Icon] = KINDS[p.kind] ?? [p.kind, FileText];
|
||||
return (
|
||||
<li key={p.id}>
|
||||
<Link href={`/admin/pages/${p.id}`} className="group flex items-center gap-3 rounded-lg px-3 py-3 hover:bg-gray-50">
|
||||
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-brand/10 text-brand-text" aria-hidden><Icon className="h-[18px] w-[18px]" /></span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block font-medium text-gray-900">{p.title}</span>
|
||||
<span className="block truncate text-xs text-gray-500">{kind} · {p.path}</span>
|
||||
</span>
|
||||
{p.kind !== "home" && !p.inNav && <span className="hidden rounded-full bg-gray-100 px-2 py-0.5 text-xs text-gray-600 sm:inline">Not in the menu</span>}
|
||||
<ChevronRight className="h-4 w-4 shrink-0 text-gray-300 group-hover:text-gray-500" aria-hidden />
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Panel>
|
||||
<Panel title="Add a page">
|
||||
<Panel title="Add a page" icon={Plus} sub="Your own page, built from blocks." className="self-start">
|
||||
<div className="space-y-3">
|
||||
<Field label="Title" error={fields.title}><input className={inputClass} value={title} maxLength={120} onChange={(e) => { setTitle(e.target.value); setSlug(e.target.value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")); }} /></Field>
|
||||
<Field label="Address" hint={`Your site/${slug || "…"}`} error={fields.slug}><input className={inputClass} value={slug} maxLength={80} onChange={(e) => setSlug(e.target.value)} /></Field>
|
||||
|
||||
Reference in New Issue
Block a user