events 3.9.0, website 1.9.0, accounts 1.10.0: the church's details from Accounts everywhere
- Events: the Accounts profile's name, logo, icon, colours and contact details win over Events' own settings while Accounts is connected (pages, emails, WhatsApp, PDFs); Settings shows them read-only with a link to Accounts. The Accounts logo is copied for PDFs (PNG and JPEG). Fixes Events keeping its old church after a demo scenario load. - Website: a background per homepage section in the church's colours; "More info" instead of "Register" for events without registration; the shared colour field. - Accounts: the shared colour field in Church profile. - @crosscode/ui 0.4.0: ColourField and isHexColour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
AlertTriangle, ArrowRight, Building2, CheckCircle2, ChevronRight, DatabaseBackup, Download, Eye, FileText, KeyRound, Link2, LogIn, Mail, MessageCircle, Play,
|
||||
RefreshCw, ScrollText, Search, ShieldCheck, Timer, UserX, Users,
|
||||
} from "lucide-react";
|
||||
import { Button, Checkbox, Field, Notice } from "@crosscode/ui";
|
||||
import { Button, Checkbox, ColourField, Field, Notice } from "@crosscode/ui";
|
||||
import { ADMIN_GROUPS, ADMIN_NAV, AppShell, PageTitle, ShellLoading, type ShellUser } from "@/components/AppShell";
|
||||
import { NoticeText } from "@/components/NoticeText";
|
||||
import { Card, Heading } from "@/components/Panel";
|
||||
@@ -325,6 +325,8 @@ type ChurchData = { name: string; shortName: string | null; branding: { logoUrl:
|
||||
function Church({ flash }: { flash: Flash }) {
|
||||
const [c, setC] = useState<ChurchData | null>(null);
|
||||
const [fields, setFields] = useState<Record<string, string>>({});
|
||||
// The two colours as typed (ColourField is controlled); the saved ones until changed.
|
||||
const [colours, setColours] = useState<{ primary?: string; accent?: string }>({});
|
||||
useExternalEffect(() => {
|
||||
let alive = true;
|
||||
call<ChurchData>("GET", "/admin/church").then((r) => { if (alive && r.ok) setC(r.data); });
|
||||
@@ -344,14 +346,16 @@ function Church({ flash }: { flash: Flash }) {
|
||||
branding: { ...c.branding, logoUrl: nul(f.get("logoUrl")), colours: { primary: f.get("primary"), accent: nul(f.get("accent")) } },
|
||||
contact: { ...c.contact, email: nul(f.get("email")), phone: nul(f.get("phone")), whatsapp: nul(f.get("whatsapp")) },
|
||||
});
|
||||
if (r.ok) { setC(r.data); setFields({}); flash("success", "Saved. The church's products are told about the change."); } else { setFields(r.error.fields ?? {}); flash("error", r.error.message); }
|
||||
if (r.ok) { setC(r.data); setFields({}); setColours({}); flash("success", "Saved. The church's products are told about the change."); } else { setFields(r.error.fields ?? {}); flash("error", r.error.message); }
|
||||
}}>
|
||||
<Field label="Name" name="name" defaultValue={c.name} required error={fields.name} />
|
||||
<Field label="Short name" name="shortName" defaultValue={c.shortName ?? ""} maxLength={30} hint="For small spaces, like the authenticator app's label." error={fields.shortName} />
|
||||
<Field label="Logo address (https://…)" name="logoUrl" type="url" defaultValue={c.branding.logoUrl ?? ""} error={fields["branding.logoUrl"]} />
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<Field label="Main colour" name="primary" type="color" defaultValue={c.branding.colours.primary} />
|
||||
<Field label="Accent colour" name="accent" type="color" defaultValue={c.branding.colours.accent ?? "#f2a900"} />
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<ColourField label="Main colour" name="primary" value={colours.primary ?? c.branding.colours.primary} onChange={(primary) => setColours((x) => ({ ...x, primary }))}
|
||||
hint="Buttons, links and headings on every site." error={fields["branding.colours.primary"]} />
|
||||
<ColourField label="Accent colour" name="accent" value={colours.accent ?? c.branding.colours.accent ?? "#f2a900"} onChange={(accent) => setColours((x) => ({ ...x, accent }))}
|
||||
hint="Highlights and touches beside the main colour." error={fields["branding.colours.accent"]} />
|
||||
</div>
|
||||
<Field label="Office email" name="email" type="email" defaultValue={c.contact.email ?? ""} error={fields["contact.email"]} />
|
||||
<Field label="Office phone" name="phone" defaultValue={c.contact.phone ?? ""} hint="With the country code, e.g. +27161234567." error={fields["contact.phone"]} />
|
||||
|
||||
Reference in New Issue
Block a user