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:
@@ -1,5 +1,29 @@
|
||||
# Changelog — Church Website
|
||||
|
||||
## [1.9.0] — 2026-12-01
|
||||
|
||||
No migration, no new environment settings. Needs `@crosscode/ui` 0.4.0 (built with the Website).
|
||||
|
||||
### Added
|
||||
|
||||
- **A background for each homepage section** (Template and style → Home page layout), from the
|
||||
church's colours: as the style sets it (the default), white, soft main colour, soft accent
|
||||
colour, main colour, or deep main colour. Stored on the design's home entry (`background`,
|
||||
`SECTION_BACKGROUNDS` in `src/site/variants.ts`), kept through a template switch, checked by
|
||||
`cleanDesign`, and carried to the snapshot's section. On the main colour, text, links and
|
||||
buttons use the palette's on-brand colour; on the deep shade, white. A layout with its own
|
||||
background (`cc-own-bg`: a photo, a band) and the top of the page keep theirs; Section colour's
|
||||
tinted and mixed patterns skip a section that has its own.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Events from Cross Events** say "Register on our Events site" only when they take
|
||||
registrations and are open; contact-only, full or closed ones say "More info on our Events
|
||||
site". The site's events carry the registration's `mode`.
|
||||
- **Church details:** the main and accent colours use the shared colour field (`ColourField`,
|
||||
`@crosscode/ui` 0.4.0): a swatch, the hex code to type or paste, and a preview, as Cross Events'
|
||||
Branding settings.
|
||||
|
||||
## [1.8.0] — 2026-11-30
|
||||
|
||||
No migration, no new environment settings. The backend now uses `@crosscode/demo` (built by
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
What each version changes for the church, in plain language (read by the Hub like Cross Events'
|
||||
WHATS-NEW.md; a section shows once its version is tagged).
|
||||
|
||||
## 1.9.0
|
||||
|
||||
- **Choose a background for each homepage section.** In **Template and style → Home page layout**,
|
||||
each section now has a background in your church's colours: white, a soft wash of your main or
|
||||
accent colour, your main colour, or a deep shade of it. Text and buttons change to stay easy to
|
||||
read. Leave it as it is and the section follows your style's section colour, as before.
|
||||
- **Events say "More info" when there's nothing to register for.** An event from your Events site
|
||||
only says "Register on our Events site" when people can register; events where people just
|
||||
contact the church say "More info on our Events site".
|
||||
- **An easier colour picker** in **Church details**: pick a colour, or type or paste its code
|
||||
(like #1f4e79), and see it straight away.
|
||||
|
||||
## 1.8.0
|
||||
|
||||
- Behind the scenes, Cross Code's demonstration websites can now be loaded as part of a whole demo
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/website-backend",
|
||||
"version": "1.8.0",
|
||||
"version": "1.9.0",
|
||||
"description": "Church Website: the public site's content API, the admin API, publishing and uploads",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Prisma } from '../generated/prisma/client.js';
|
||||
import { ApiError } from '../http.js';
|
||||
import { BLOCK_SCHEMAS, isBlockType, rowFraming, SECTION_SCHEMAS } from '../site/sections.js';
|
||||
import { cleanDesign } from '../site/snapshot.js';
|
||||
import { BUTTONS, IMAGE_TREATMENTS, isVariant, SECTION_COLOURS, SECTION_TYPES, sectionTypeSchema, SPACINGS, switchTemplate, TEMPLATE_HEADERS, type SectionType } from '../site/variants.js';
|
||||
import { BUTTONS, IMAGE_TREATMENTS, isVariant, SECTION_BACKGROUNDS, SECTION_COLOURS, SECTION_TYPES, sectionTypeSchema, SPACINGS, switchTemplate, TEMPLATE_HEADERS, type SectionType } from '../site/variants.js';
|
||||
|
||||
type Who = { id: string; role: string };
|
||||
|
||||
@@ -55,7 +55,7 @@ export async function getDesign(ctx: Ctx) {
|
||||
const designPatch = z.object({
|
||||
template: websiteTemplateSchema.optional(),
|
||||
variants: z.record(z.string(), z.string()).optional(),
|
||||
home: z.array(z.object({ section: sectionTypeSchema, hidden: z.boolean() })).max(SECTION_TYPES.length).optional(),
|
||||
home: z.array(z.object({ section: sectionTypeSchema, hidden: z.boolean(), background: z.enum(SECTION_BACKGROUNDS).optional() })).max(SECTION_TYPES.length).optional(),
|
||||
style: z.object({
|
||||
sectionColour: z.enum(SECTION_COLOURS).optional(),
|
||||
spacing: z.enum(SPACINGS).optional(),
|
||||
|
||||
@@ -26,7 +26,8 @@ export type SiteEvent = {
|
||||
/** An outside link for more information or signing up (the Website's own events). */
|
||||
link: string | null;
|
||||
from: 'website' | 'events' | 'app';
|
||||
registration: { status: string; priceFromCents: number | null } | null;
|
||||
/** From Cross Events: how it's joined (`origin`: register there; `contact`: ask the church; `none`: just come), whether it's open, and from what price. */
|
||||
registration: { mode: string; status: string; priceFromCents: number | null } | null;
|
||||
};
|
||||
|
||||
export type SiteMessage = {
|
||||
@@ -147,7 +148,7 @@ async function liveEvents(ctx: Ctx): Promise<SiteEvent[]> {
|
||||
return [{
|
||||
title: e.title, summary: e.summary ?? null, startsAt: e.startsAt, endsAt: e.endsAt ?? null, allDay: !!e.allDay, location: e.location?.name ?? null,
|
||||
image: e.imageUrl ? { url: e.imageUrl, alt: e.title, width: null, height: null } : null, url: e.origin.url, slug: null, link: null, from: e.origin.product,
|
||||
registration: e.registration ? { status: e.registration.status, priceFromCents: e.registration.priceFrom?.amountCents ?? null } : null,
|
||||
registration: e.registration ? { mode: e.registration.mode, status: e.registration.status, priceFromCents: e.registration.priceFrom?.amountCents ?? null } : null,
|
||||
} satisfies SiteEvent];
|
||||
});
|
||||
return [...own, ...copies].sort((a, b) => a.startsAt.localeCompare(b.startsAt));
|
||||
|
||||
@@ -11,7 +11,7 @@ import { WEBSITE_TEMPLATES, type WebsiteTemplate } from '@crosscode/contracts';
|
||||
import type { Ctx } from '../context.js';
|
||||
import { audit } from '../lib/audit.js';
|
||||
import { parseSectionData } from './sections.js';
|
||||
import { defaultDesign, isVariant, SECTION_TYPES, switchTemplate, type SectionType, type SiteDesign } from './variants.js';
|
||||
import { defaultDesign, isVariant, SECTION_BACKGROUNDS, SECTION_TYPES, switchTemplate, type SectionBackground, type SectionType, type SiteDesign } from './variants.js';
|
||||
|
||||
export const SNAPSHOT_VERSION = 1;
|
||||
|
||||
@@ -34,7 +34,8 @@ export const framed = (img: Image | null, f: unknown): Image | null => {
|
||||
|
||||
type MediaRow = { id: string; filename: string; alt: string; width: number | null; height: number | null; sizes?: unknown };
|
||||
|
||||
export type SnapshotSection = { type: string; variant: string | null; data: Record<string, unknown> };
|
||||
/** `background`: a homepage section's own background (variants.ts SECTION_BACKGROUNDS), when it has one. */
|
||||
export type SnapshotSection = { type: string; variant: string | null; data: Record<string, unknown>; background?: SectionBackground };
|
||||
|
||||
export type SnapshotPage = {
|
||||
kind: string;
|
||||
@@ -87,7 +88,11 @@ export function cleanDesign(saved: { template: string; variants: unknown; home:
|
||||
const v = (saved.variants ?? {}) as Record<string, unknown>;
|
||||
for (const s of SECTION_TYPES) if (typeof v[s] === 'string' && isVariant(s, v[s] as string)) variants[s] = v[s] as string;
|
||||
const home = Array.isArray(saved.home)
|
||||
? (saved.home as { section?: unknown; hidden?: unknown }[]).filter((e) => SECTION_TYPES.includes(e?.section as SectionType)).map((e) => ({ section: e.section as SectionType, hidden: !!e.hidden }))
|
||||
? (saved.home as { section?: unknown; hidden?: unknown; background?: unknown }[]).filter((e) => SECTION_TYPES.includes(e?.section as SectionType)).map((e) => ({
|
||||
section: e.section as SectionType,
|
||||
hidden: !!e.hidden,
|
||||
...((SECTION_BACKGROUNDS as readonly unknown[]).includes(e.background) ? { background: e.background as SectionBackground } : {}),
|
||||
}))
|
||||
: base.home;
|
||||
// Every section listed once: any missing one is added at the end, hidden.
|
||||
for (const s of SECTION_TYPES) if (!home.some((e) => e.section === s)) home.push({ section: s, hidden: true });
|
||||
@@ -176,7 +181,7 @@ export function snapshotFrom(source: Source, media: MediaRow[]): Snapshot {
|
||||
const data = parseSectionData(entry.section, byType.get(entry.section)?.data);
|
||||
if (!data) continue;
|
||||
collect(data);
|
||||
sections.push({ type: entry.section, variant: d.variants[entry.section], data });
|
||||
sections.push({ type: entry.section, variant: d.variants[entry.section], data, ...(entry.background ? { background: entry.background } : {}) });
|
||||
}
|
||||
} else {
|
||||
for (const x of p.sections) {
|
||||
|
||||
@@ -104,8 +104,18 @@ export function headerIsTransparent(template: WebsiteTemplate, header: string, h
|
||||
return template === 'bold' && header === 'transparent' && heroVariant !== null && ['photo', 'video', 'collage'].includes(heroVariant);
|
||||
}
|
||||
|
||||
/** A homepage entry: the section and whether it shows. */
|
||||
export type HomeEntry = { section: SectionType; hidden: boolean };
|
||||
/**
|
||||
* A homepage section's own background: always from the church's colours, so it stays on brand.
|
||||
* Left out, the section follows the site's Section colour (style). `light` is plain white; `tint`
|
||||
* and `accent` are soft washes of the main and accent colours; `brand` is the main colour itself and
|
||||
* `dark` a deep shade of it, both with light text. A layout with its own background (a photo, a
|
||||
* band) keeps it.
|
||||
*/
|
||||
export const SECTION_BACKGROUNDS = ['light', 'tint', 'accent', 'brand', 'dark'] as const;
|
||||
export type SectionBackground = (typeof SECTION_BACKGROUNDS)[number];
|
||||
|
||||
/** A homepage entry: the section, whether it shows, and its own background when it has one. */
|
||||
export type HomeEntry = { section: SectionType; hidden: boolean; background?: SectionBackground };
|
||||
|
||||
const order = (shown: SectionType[], hidden: SectionType[] = []): HomeEntry[] => [
|
||||
...shown.map((section) => ({ section, hidden: false })),
|
||||
@@ -184,7 +194,12 @@ export function switchTemplate(current: SiteDesign, to: WebsiteTemplate): { desi
|
||||
}
|
||||
|
||||
const homeUntouched = sameOrder(current.home, TEMPLATE_HOME_ORDER[from]);
|
||||
const home = homeUntouched ? target.home : current.home.map((e) => ({ ...e }));
|
||||
// The order may move to the new template's; each section keeps the background it was given.
|
||||
const backgrounds = new Map(current.home.flatMap((e) => (e.background ? [[e.section, e.background] as const] : [])));
|
||||
const home = (homeUntouched ? target.home : current.home).map(({ background: _b, ...e }) => {
|
||||
const background = backgrounds.get(e.section);
|
||||
return background ? { ...e, background } : e;
|
||||
});
|
||||
if (homeUntouched && !sameOrder(current.home, target.home)) changes.push({ what: 'home', from: `${from} order`, to: `${to} order` });
|
||||
|
||||
const style = { ...current.style };
|
||||
|
||||
@@ -114,7 +114,7 @@ describe('showing events from Cross Events (Show events from)', () => {
|
||||
if (c.mode === 'published') {
|
||||
assert.equal(c.events[0]!.title, 'Youth camp');
|
||||
assert.equal(c.events[0]!.url, 'https://events.hope.test/events/6c7d');
|
||||
assert.deepEqual(c.events[0]!.registration, { status: 'open', priceFromCents: 45000 });
|
||||
assert.deepEqual(c.events[0]!.registration, { mode: 'origin', status: 'open', priceFromCents: 45000 });
|
||||
}
|
||||
assert.match(String((await db.productLink.findUnique({ where: { installId: EVENTS_ID } }))!.lastSyncError), /1 event\(s\) skipped/);
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
SECTION_TYPES, SECTION_VARIANTS, TEMPLATE_HEADERS, TEMPLATE_HOME_ORDER, TEMPLATE_STYLE, TEMPLATE_VARIANTS,
|
||||
defaultDesign, defaultVariant, headerIsTransparent, isRecommended, isVariant, switchTemplate,
|
||||
} from '../src/site/variants.js';
|
||||
import { cleanDesign } from '../src/site/snapshot.js';
|
||||
|
||||
describe('section variants (WEBSITE-1.0-PLAN §3, decision 16)', () => {
|
||||
it('has the 26 confirmed variant ids', () => {
|
||||
@@ -101,3 +102,20 @@ describe('switching template', () => {
|
||||
assert.deepEqual(switchTemplate(there, 'heritage').design, defaultDesign('heritage'));
|
||||
});
|
||||
});
|
||||
|
||||
describe("a section's own background", () => {
|
||||
it('stays with its section through a template switch, whether the order moves or not', () => {
|
||||
const start = defaultDesign('heritage');
|
||||
start.home = start.home.map((e) => (e.section === 'events' ? { ...e, background: 'brand' as const } : e));
|
||||
const moved = switchTemplate(start, 'bold').design;
|
||||
assert.equal(moved.home.find((e) => e.section === 'events')?.background, 'brand');
|
||||
assert.deepEqual(moved.home.map((e) => e.section), defaultDesign('bold').home.map((e) => e.section));
|
||||
assert.equal(moved.home.filter((e) => e.background).length, 1);
|
||||
});
|
||||
|
||||
it('is kept by cleanDesign only when it is one of the church-colour choices', () => {
|
||||
const d = cleanDesign({ template: 'clean', variants: {}, home: [{ section: 'welcome', hidden: false, background: 'tint' }, { section: 'events', hidden: false, background: 'hot-pink' }], style: {} });
|
||||
assert.equal(d.home.find((e) => e.section === 'welcome')?.background, 'tint');
|
||||
assert.equal('background' in d.home.find((e) => e.section === 'events')!, false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/website-frontend",
|
||||
"version": "1.8.0",
|
||||
"version": "1.9.0",
|
||||
"private": true,
|
||||
"description": "Church Website: the church's public site in its template, and the admin",
|
||||
"scripts": {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
import { useState } from "react";
|
||||
import type { Church } from "@crosscode/contracts";
|
||||
import { ColourField } from "@crosscode/ui";
|
||||
import { api, canEdit } from "@/admin/api";
|
||||
import { ImagePicker } from "@/admin/media";
|
||||
import { Btn, Field, inputClass, Loading, Notice, Panel, Title, useAction, useAdmin } from "@/admin/ui";
|
||||
@@ -55,8 +56,10 @@ export default function ChurchDetails() {
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<Field label="Church name" error={err("name")}><input className={inputClass} value={c.name} maxLength={200} onChange={(e) => set({ name: e.target.value })} /></Field>
|
||||
<Field label="Short name" hint="For tight spaces." error={err("shortName")}><input className={inputClass} value={c.shortName ?? ""} maxLength={30} onChange={(e) => set({ shortName: e.target.value || null })} /></Field>
|
||||
<Field label="Main colour" error={err("branding.colours.primary")}><input type="color" className="h-10 w-20" value={c.branding.colours.primary} onChange={(e) => set({ branding: { ...c.branding, colours: { ...c.branding.colours, primary: e.target.value } } })} /></Field>
|
||||
<Field label="Accent colour"><input type="color" className="h-10 w-20" value={c.branding.colours.accent ?? "#999999"} onChange={(e) => set({ branding: { ...c.branding, colours: { ...c.branding.colours, accent: e.target.value } } })} /></Field>
|
||||
<ColourField label="Main colour" hint="Buttons, links and headings on every site." error={err("branding.colours.primary")} disabled={!editor}
|
||||
value={c.branding.colours.primary} onChange={(primary) => set({ branding: { ...c.branding, colours: { ...c.branding.colours, primary } } })} />
|
||||
<ColourField label="Accent colour" hint="Highlights and touches beside the main colour." error={err("branding.colours.accent")} disabled={!editor}
|
||||
value={c.branding.colours.accent ?? "#999999"} onChange={(accent) => set({ branding: { ...c.branding, colours: { ...c.branding.colours, accent } } })} />
|
||||
<Field label="Fonts" hint="Shared by all your sites. Your template suggests some.">
|
||||
<select className={inputClass} value={c.branding.style?.fontPairing ?? ""} onChange={(e) => set({ branding: { ...c.branding, style: { fontPairing: (e.target.value || null) as never, corners: c.branding.style?.corners ?? null } } })}>
|
||||
{PAIRINGS.map(([v, l]) => <option key={v} value={v}>{l}</option>)}
|
||||
|
||||
@@ -12,7 +12,18 @@ import { api } from "@/admin/api";
|
||||
import { WithPreview } from "@/admin/LivePreview";
|
||||
import { Btn, cx, Field, inputClass, Loading, Notice, Panel, Tabs, Title, useAction, useAdmin } from "@/admin/ui";
|
||||
|
||||
type Design = { template: string; variants: Record<string, string>; home: { section: string; hidden: boolean }[]; style: Record<string, string> };
|
||||
type HomeEntry = { section: string; hidden: boolean; background?: string };
|
||||
type Design = { template: string; variants: Record<string, string>; home: HomeEntry[]; style: Record<string, string> };
|
||||
|
||||
/** A section's own background (backend variants.ts SECTION_BACKGROUNDS), each from the church's colours; "" follows Style → Section colour. */
|
||||
const BACKGROUNDS: { id: string; name: string; swatch: string }[] = [
|
||||
{ id: "", name: "As the style sets it", swatch: "repeating-linear-gradient(45deg, #fff 0 4px, rgb(var(--brand-tint)) 4px 8px)" },
|
||||
{ id: "light", name: "White", swatch: "#fff" },
|
||||
{ id: "tint", name: "Soft main colour", swatch: "rgb(var(--brand-tint))" },
|
||||
{ id: "accent", name: "Soft accent colour", swatch: "linear-gradient(rgb(var(--accent) / 0.12), rgb(var(--accent) / 0.12)), #fff" },
|
||||
{ id: "brand", name: "Main colour", swatch: "rgb(var(--brand))" },
|
||||
{ id: "dark", name: "Deep main colour", swatch: "linear-gradient(rgb(0 0 0 / 0.35), rgb(0 0 0 / 0.35)), rgb(var(--brand-dark))" },
|
||||
];
|
||||
type Options = { variants: Record<string, Record<string, string[]>>; headers: Record<string, string[]> };
|
||||
|
||||
const TEMPLATES = [
|
||||
@@ -94,7 +105,7 @@ export default function TemplatePage() {
|
||||
)}
|
||||
|
||||
{tab === "home" && (
|
||||
<Panel title="Home page: sections and layouts" icon={ListOrdered} sub={<>Every layout works in every template; the first ones listed suit {TEMPLATES.find((t) => t.id === design.template)?.name} best. What each section says is on the home page, under Pages.</>}>
|
||||
<Panel title="Home page: sections and layouts" icon={ListOrdered} sub={<>Every layout works in every template; the first ones listed suit {TEMPLATES.find((t) => t.id === design.template)?.name} best. Each section can have its own background in your church's colours (a layout with a photo or band keeps its own). What each section says is on the home page, under Pages.</>}>
|
||||
<ul className="divide-y divide-gray-100">
|
||||
{design.home.map((e, i) => {
|
||||
const recommended = options.variants[design.template]?.[e.section] ?? [];
|
||||
@@ -107,6 +118,16 @@ export default function TemplatePage() {
|
||||
onChange={(ev) => save({ variants: { [e.section]: ev.target.value } })}>
|
||||
{ordered.map((v) => <option key={v} value={v}>{VARIANT_NAMES[v]}{recommended.includes(v) ? " (suits this template)" : ""}</option>)}
|
||||
</select>
|
||||
{/* The top of the page draws its own background (photo, colour or plain). */}
|
||||
{e.section !== "hero" && (
|
||||
<span className="flex items-center gap-2">
|
||||
<span className="h-6 w-6 shrink-0 rounded border border-gray-300" style={{ background: BACKGROUNDS.find((b) => b.id === (e.background ?? ""))?.swatch }} aria-hidden />
|
||||
<select aria-label={`${SECTIONS[e.section]} background`} title="Background" className={`${inputClass} w-48`} value={e.background ?? ""} disabled={busy}
|
||||
onChange={(ev) => save({ home: design.home.map(({ background: _b, ...x }) => (x.section === e.section ? (ev.target.value ? { ...x, background: ev.target.value } : x) : { ...x, ...(_b ? { background: _b } : {}) })) })}>
|
||||
{BACKGROUNDS.map((b) => <option key={b.id} value={b.id}>{b.id ? b.name : `Background: ${b.name.toLowerCase()}`}</option>)}
|
||||
</select>
|
||||
</span>
|
||||
)}
|
||||
<label className="flex items-center gap-2 text-sm">
|
||||
<input type="checkbox" checked={!e.hidden} disabled={busy} onChange={(ev) => save({ home: design.home.map((x) => (x.section === e.section ? { ...x, hidden: !ev.target.checked } : x)) })} />
|
||||
Show
|
||||
|
||||
@@ -59,18 +59,18 @@ h1, h2, h3 {
|
||||
* Section colour: tinted alternates the church colour as a soft background; mixed adds dark bands.
|
||||
* Never on a section that sets its own background (cc-own-bg: a banner, a photo, a dark band).
|
||||
*/
|
||||
[data-section-colour="tinted"] .cc-section:not(.cc-own-bg):nth-of-type(even) { background: rgb(var(--brand-tint)); }
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):nth-of-type(3n) { background: rgb(var(--brand-dark)); color: rgb(var(--on-brand)); }
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):nth-of-type(3n) .cc-card { background: rgb(255 255 255 / 0.06); border-color: rgb(255 255 255 / 0.2); color: inherit; }
|
||||
[data-section-colour="tinted"] .cc-section:not(.cc-own-bg):not([data-bg]):nth-of-type(even) { background: rgb(var(--brand-tint)); }
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):not([data-bg]):nth-of-type(3n) { background: rgb(var(--brand-dark)); color: rgb(var(--on-brand)); }
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):not([data-bg]):nth-of-type(3n) .cc-card { background: rgb(255 255 255 / 0.06); border-color: rgb(255 255 255 / 0.2); color: inherit; }
|
||||
|
||||
/* Text on a dark background (Bold's cards and bands, a dark section): light, and still AA. */
|
||||
.cc-dark .cc-muted, [data-template="bold"] .cc-card .cc-muted,
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):nth-of-type(3n) .cc-muted { color: rgb(255 255 255 / 0.8); }
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):not([data-bg]):nth-of-type(3n) .cc-muted { color: rgb(255 255 255 / 0.8); }
|
||||
.cc-dark .cc-link, .cc-dark .cc-eyebrow, .cc-dark .cc-brand-text,
|
||||
[data-template="bold"] .cc-card .cc-link, [data-template="bold"] .cc-card .cc-eyebrow, [data-template="bold"] .cc-card .cc-brand-text,
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):nth-of-type(3n) .cc-link,
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):nth-of-type(3n) .cc-eyebrow,
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):nth-of-type(3n) .cc-brand-text { color: rgb(255 255 255); }
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):not([data-bg]):nth-of-type(3n) .cc-link,
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):not([data-bg]):nth-of-type(3n) .cc-eyebrow,
|
||||
[data-section-colour="mixed"] .cc-section:not(.cc-own-bg):not([data-bg]):nth-of-type(3n) .cc-brand-text { color: rgb(255 255 255); }
|
||||
|
||||
.cc-muted { color: rgb(75 85 99); }
|
||||
/* The church's colour as text (made AA on light by the palette): here, not a utility, so the dark rules above win. */
|
||||
@@ -108,10 +108,32 @@ h1, h2, h3 {
|
||||
[data-buttons="pill"] .cc-btn { border-radius: 9999px; }
|
||||
[data-template="bold"] .cc-btn { @apply uppercase tracking-wider; }
|
||||
/* A button on a photo or a dark band: always light on dark. */
|
||||
.cc-on-dark .cc-btn, .cc-dark .cc-btn, [data-section-colour="mixed"] .cc-section:not(.cc-own-bg):nth-of-type(3n) .cc-btn {
|
||||
.cc-on-dark .cc-btn, .cc-dark .cc-btn, [data-section-colour="mixed"] .cc-section:not(.cc-own-bg):not([data-bg]):nth-of-type(3n) .cc-btn {
|
||||
background: rgb(255 255 255); color: rgb(17 24 39); border-color: rgb(255 255 255);
|
||||
}
|
||||
|
||||
/*
|
||||
* A homepage section's own background (Template → Home page), always from the church's colours.
|
||||
* It replaces the Section colour's pattern for that section; a layout with its own background
|
||||
* (cc-own-bg: a photo, a band) keeps it. On the main colour, text is the palette's on-brand
|
||||
* colour (AA); on the deep shade, white.
|
||||
*/
|
||||
.cc-section[data-bg="light"]:not(.cc-own-bg) { background: rgb(255 255 255); }
|
||||
.cc-section[data-bg="tint"]:not(.cc-own-bg) { background: rgb(var(--brand-tint)); }
|
||||
.cc-section[data-bg="accent"]:not(.cc-own-bg) { background: rgb(var(--accent) / 0.12); }
|
||||
.cc-section[data-bg="brand"]:not(.cc-own-bg) { background: rgb(var(--brand)); color: rgb(var(--on-brand)); }
|
||||
.cc-section[data-bg="dark"]:not(.cc-own-bg) { background: linear-gradient(rgb(0 0 0 / 0.35), rgb(0 0 0 / 0.35)), rgb(var(--brand-dark)); color: rgb(255 255 255); }
|
||||
.cc-section[data-bg="brand"]:not(.cc-own-bg) .cc-card,
|
||||
.cc-section[data-bg="dark"]:not(.cc-own-bg) .cc-card { background: rgb(255 255 255 / 0.08); border-color: rgb(255 255 255 / 0.25); color: inherit; box-shadow: none; }
|
||||
.cc-section[data-bg="brand"]:not(.cc-own-bg) .cc-muted { color: rgb(var(--on-brand) / 0.85); }
|
||||
.cc-section[data-bg="brand"]:not(.cc-own-bg) :is(.cc-link, .cc-eyebrow, .cc-brand-text) { color: rgb(var(--on-brand)); }
|
||||
.cc-section[data-bg="dark"]:not(.cc-own-bg) .cc-muted { color: rgb(255 255 255 / 0.8); }
|
||||
.cc-section[data-bg="dark"]:not(.cc-own-bg) :is(.cc-link, .cc-eyebrow, .cc-brand-text) { color: rgb(255 255 255); }
|
||||
.cc-section[data-bg="brand"]:not(.cc-own-bg) .cc-btn { background: rgb(var(--on-brand)); color: rgb(var(--brand)); border-color: rgb(var(--on-brand)); }
|
||||
.cc-section[data-bg="dark"]:not(.cc-own-bg) .cc-btn { background: rgb(255 255 255); color: rgb(17 24 39); border-color: rgb(255 255 255); }
|
||||
.cc-section[data-bg="brand"]:not(.cc-own-bg) .cc-btn:hover,
|
||||
.cc-section[data-bg="dark"]:not(.cc-own-bg) .cc-btn:hover { opacity: 0.9; }
|
||||
|
||||
/* Cards. */
|
||||
.cc-card { @apply overflow-hidden bg-white; border-radius: var(--cc-radius, 0.5rem); }
|
||||
[data-template="heritage"] .cc-card { border: 1px solid rgb(var(--brand-text) / 0.2); }
|
||||
|
||||
@@ -9,8 +9,9 @@ import { Button, cx, DateBadge, dayName, fmtDate, fmtTime, Img, Paragraphs, Pict
|
||||
import type { SectionProps, SiteEvent } from "../types";
|
||||
import { Hero } from "./Hero";
|
||||
|
||||
const Section = ({ children, className, id }: { children: React.ReactNode; className?: string; id?: string }) => (
|
||||
<section id={id} className={cx("cc-section", className)}>{children}</section>
|
||||
/** `data-bg`: the section's own background, when the church gave it one (globals.css). */
|
||||
const Section = ({ p, children, className, id }: { p: SectionProps; children: React.ReactNode; className?: string; id?: string }) => (
|
||||
<section id={id} data-bg={p.section.background} className={cx("cc-section", className)}>{children}</section>
|
||||
);
|
||||
|
||||
const tz = (p: SectionProps) => p.site.church?.timezone ?? "Africa/Johannesburg";
|
||||
@@ -79,7 +80,7 @@ function ServiceTimes(p: SectionProps) {
|
||||
if (p.section.variant === "map") {
|
||||
const geo = p.site.church?.contact.address?.geo;
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap grid items-stretch gap-8 md:grid-cols-2">
|
||||
{panel}
|
||||
{geo ? (
|
||||
@@ -90,7 +91,7 @@ function ServiceTimes(p: SectionProps) {
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
return <Section><div className="cc-wrap"><div className={cx(p.template === "heritage" ? "mx-auto max-w-xl" : "max-w-2xl")}>{panel}</div></div></Section>;
|
||||
return <Section p={p}><div className="cc-wrap"><div className={cx(p.template === "heritage" ? "mx-auto max-w-xl" : "max-w-2xl")}>{panel}</div></div></Section>;
|
||||
}
|
||||
|
||||
// ─── Welcome: Text · Image and text · With pastor's photo and quote ────────────────
|
||||
@@ -108,7 +109,7 @@ function Welcome(p: SectionProps) {
|
||||
if (p.section.variant === "pastor" && d.pastor) {
|
||||
const photo = media(p.site, d.pastor.photoId, p.section.data);
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap grid items-center gap-10 md:grid-cols-[2fr_3fr]">
|
||||
<figure className={cx(centred && "text-center")}>
|
||||
<Img image={photo} ratio="aspect-[4/5]" className={cx(p.template === "community" && "rounded-[2rem]", centred && "mx-auto max-w-xs")} />
|
||||
@@ -122,7 +123,7 @@ function Welcome(p: SectionProps) {
|
||||
}
|
||||
if (p.section.variant === "image-text") {
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className={cx("grid items-center gap-10 md:grid-cols-2", p.template === "bold" ? "px-0 md:gap-0" : "cc-wrap")}>
|
||||
<Img image={media(p.site, d.imageId, p.section.data)} ratio={p.template === "bold" ? "aspect-square md:aspect-auto md:h-full md:min-h-[28rem]" : "aspect-[4/3]"} className={cx(p.template === "community" && "rounded-[2rem]", p.template === "bold" && "rounded-none")} />
|
||||
<div className={cx(p.template === "bold" && "px-6 py-10 sm:px-12")}>{words}</div>
|
||||
@@ -130,7 +131,7 @@ function Welcome(p: SectionProps) {
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
return <Section><div className="cc-wrap"><div className="cc-text">{words}</div></div></Section>;
|
||||
return <Section p={p}><div className="cc-wrap"><div className="cc-text">{words}</div></div></Section>;
|
||||
}
|
||||
|
||||
// ─── Ministries: Cards · List · Alternating bands ───────────────────────────────
|
||||
@@ -145,7 +146,7 @@ function Ministries(p: SectionProps) {
|
||||
|
||||
if (p.section.variant === "bands") {
|
||||
return (
|
||||
<Section className="!pb-0">
|
||||
<Section p={p} className="!pb-0">
|
||||
<div className="cc-wrap">{head}</div>
|
||||
<div className={cx(p.template === "bold" ? "" : "cc-wrap space-y-10")}>
|
||||
{list.map((m, i) => (
|
||||
@@ -165,7 +166,7 @@ function Ministries(p: SectionProps) {
|
||||
}
|
||||
if (p.section.variant === "list") {
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
<ul className={cx("divide-y", p.template === "heritage" ? "mx-auto max-w-2xl divide-brand-text/20" : "divide-gray-200")}>
|
||||
@@ -181,7 +182,7 @@ function Ministries(p: SectionProps) {
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
<ul className={cx("grid gap-6", list.length > 3 ? "sm:grid-cols-2 lg:grid-cols-4" : "sm:grid-cols-3")}>
|
||||
@@ -220,7 +221,7 @@ function Team(p: SectionProps) {
|
||||
);
|
||||
if (p.section.variant === "list") {
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
<ul className="mx-auto max-w-2xl divide-y divide-gray-200">
|
||||
@@ -233,7 +234,7 @@ function Team(p: SectionProps) {
|
||||
if (p.section.variant === "featured") {
|
||||
const [lead, ...rest] = people;
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
{face(lead!, true)}
|
||||
@@ -242,7 +243,7 @@ function Team(p: SectionProps) {
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
return <Section><div className="cc-wrap">{head}<div className="grid grid-cols-2 gap-8 sm:grid-cols-4">{people.map((l) => face(l))}</div></div></Section>;
|
||||
return <Section p={p}><div className="cc-wrap">{head}<div className="grid grid-cols-2 gap-8 sm:grid-cols-4">{people.map((l) => face(l))}</div></div></Section>;
|
||||
}
|
||||
|
||||
// ─── Upcoming events: Cards · List · Calendar strip ─────────────────────────────
|
||||
@@ -253,7 +254,12 @@ export function EventLine({ e, timeZone }: { e: SiteEvent; timeZone: string }) {
|
||||
<>
|
||||
<time dateTime={e.startsAt} className="cc-muted block text-sm">{when}</time>
|
||||
{e.location && <span className="cc-muted block text-sm">{e.location}</span>}
|
||||
{e.registration && e.registration.status === "open" && <span className="cc-eyebrow mt-1 block text-xs">Register on our Events site</span>}
|
||||
{e.registration && e.from === "events" && (
|
||||
<span className="cc-eyebrow mt-1 block text-xs">
|
||||
{/* Only an event that takes registrations says "Register"; a contact-only one (or a full or closed one) has its details there. */}
|
||||
{(e.registration.mode ?? "origin") === "origin" && e.registration.status === "open" ? "Register on our Events site" : "More info on our Events site"}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -266,11 +272,11 @@ function Events(p: SectionProps) {
|
||||
const head = <SectionHeading heading={d.heading ?? "Coming up"} centred={p.template === "heritage"} />;
|
||||
const more = page && <p className={cx("mt-8", p.template === "heritage" && "text-center")}><a href={page.path} className="cc-link font-semibold">All events</a></p>;
|
||||
if (!list.length) {
|
||||
return <Section><div className="cc-wrap">{head}<p className="cc-muted">Nothing on the calendar just now. Check back soon.</p></div></Section>;
|
||||
return <Section p={p}><div className="cc-wrap">{head}<p className="cc-muted">Nothing on the calendar just now. Check back soon.</p></div></Section>;
|
||||
}
|
||||
if (p.section.variant === "cards") {
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
<ul className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||
@@ -294,7 +300,7 @@ function Events(p: SectionProps) {
|
||||
}
|
||||
if (p.section.variant === "calendar") {
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
<ol className="flex snap-x gap-4 overflow-x-auto pb-4">
|
||||
@@ -314,7 +320,7 @@ function Events(p: SectionProps) {
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
<ul className={cx("divide-y divide-gray-200", p.template === "heritage" && "mx-auto max-w-2xl")}>
|
||||
@@ -351,7 +357,7 @@ function LatestMessage(p: SectionProps) {
|
||||
);
|
||||
if (p.section.variant === "compact") {
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
<div className="flex flex-col gap-4 border-y border-gray-200 py-6 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div><p className="cc-eyebrow">{d.heading ?? "Latest message"}</p><p className="font-heading text-xl font-semibold">{m.title}</p><p className="cc-muted text-sm">{meta}</p></div>
|
||||
@@ -363,7 +369,7 @@ function LatestMessage(p: SectionProps) {
|
||||
}
|
||||
if (p.section.variant === "video") {
|
||||
return (
|
||||
<Section className={cx(p.template === "bold" && "cc-own-bg cc-dark bg-gray-950 text-white")}>
|
||||
<Section p={p} className={cx(p.template === "bold" && "cc-own-bg cc-dark bg-gray-950 text-white")}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
<MessagePlayer title={m.title} embedUrl={m.embedUrl} thumbnail={m.thumbnail} url={m.url} source={m.source} />
|
||||
@@ -373,7 +379,7 @@ function LatestMessage(p: SectionProps) {
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap">
|
||||
{head}
|
||||
<div className="cc-card grid items-center gap-0 md:grid-cols-2">
|
||||
@@ -414,7 +420,7 @@ function Invitation(p: SectionProps) {
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap text-center">
|
||||
<h2 className="cc-h2">{d.heading}</h2>
|
||||
{d.text && <p className="cc-muted mx-auto mt-4 max-w-2xl text-lg">{d.text}</p>}
|
||||
@@ -428,13 +434,13 @@ function Invitation(p: SectionProps) {
|
||||
|
||||
function TextBlock(p: SectionProps) {
|
||||
const d = p.section.data as { heading: string | null; body: string };
|
||||
return <Section><div className="cc-wrap"><div className="cc-text">{d.heading && <h2 className="cc-h2 mb-6">{d.heading}</h2>}<Paragraphs text={d.body} /></div></div></Section>;
|
||||
return <Section p={p}><div className="cc-wrap"><div className="cc-text">{d.heading && <h2 className="cc-h2 mb-6">{d.heading}</h2>}<Paragraphs text={d.body} /></div></div></Section>;
|
||||
}
|
||||
|
||||
function ImageTextBlock(p: SectionProps) {
|
||||
const d = p.section.data as { heading: string | null; body: string; imageId: string | null; button: ButtonData };
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<div className="cc-wrap grid items-center gap-10 md:grid-cols-2">
|
||||
<Img image={media(p.site, d.imageId, p.section.data)} className={cx(p.template === "community" && "rounded-[2rem]")} />
|
||||
<div>{d.heading && <h2 className="cc-h2 mb-6">{d.heading}</h2>}<Paragraphs text={d.body} /><div className="mt-6"><Button button={d.button} /></div></div>
|
||||
@@ -446,7 +452,7 @@ function ImageTextBlock(p: SectionProps) {
|
||||
function QuoteBlock(p: SectionProps) {
|
||||
const d = p.section.data as { quote: string; by: string | null };
|
||||
return (
|
||||
<Section>
|
||||
<Section p={p}>
|
||||
<figure className="cc-wrap text-center">
|
||||
<blockquote className="font-heading mx-auto max-w-3xl text-2xl leading-snug sm:text-3xl">“{d.quote}”</blockquote>
|
||||
{str(d.by) && <figcaption className="cc-muted mt-4">{d.by}</figcaption>}
|
||||
|
||||
@@ -12,7 +12,8 @@ export type Focus = { x: number; y: number; zoom: number };
|
||||
|
||||
export type Image = { url: string; alt: string; width: number | null; height: number | null; srcset?: { webp: string; jpg: string }; focus?: Focus };
|
||||
|
||||
export type Section = { type: string; variant: string | null; data: Record<string, unknown> };
|
||||
/** `background`: a homepage section's own background (light | tint | accent | brand | dark), when it has one. */
|
||||
export type Section = { type: string; variant: string | null; data: Record<string, unknown>; background?: "light" | "tint" | "accent" | "brand" | "dark" };
|
||||
|
||||
export type Page = {
|
||||
kind: string;
|
||||
@@ -59,7 +60,7 @@ export type SiteEvent = {
|
||||
slug: string | null;
|
||||
link: string | null;
|
||||
from: "website" | "events" | "app";
|
||||
registration: { status: string; priceFromCents: number | null } | null;
|
||||
registration: { mode: string; status: string; priceFromCents: number | null } | null;
|
||||
};
|
||||
|
||||
export type SiteMessage = {
|
||||
|
||||
Reference in New Issue
Block a user