Compare commits

..
Author SHA1 Message Date
joshua 35501deb0d Merge branch 'fix/website-starter-pages' 2026-11-27 08:18:53 +02:00
joshuaandClaude Opus 5.5 79e1450df6 Website 1.2.0: starter pages on a new install, and a site icon
A new install had no pages, so the home page and its live preview showed
only the header and footer (found on cross-demo2). The backend now adds the
fixed pages with starter text at startup. Settings -> Site icon sets the
favicon, with a default from the church's colour and initial. The Latest
message's Card layout has its name; the media picker's placeholder has
enough contrast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:18:47 +02:00
18 changed files with 285 additions and 24 deletions
+27
View File
@@ -1,5 +1,32 @@
# Changelog — Church Website
## [1.2.0] — 2026-11-27
No migration, no new environment settings. Its first start on an existing site adds the missing
fixed pages (below).
### Fixed
- **A new install had no pages**, so its home page (and the live preview of it) showed only the
header and footer whatever was chosen under Template and style, and Plan your visit, About, Give,
Contact and the rest didn't exist. Only `npm run demo` made pages. Now the backend adds the fixed
pages at startup (`src/site/starter.ts`) with starter text: Home with every homepage section,
Plan your visit, About us, Ministries, Leadership, Events, Messages, Give, Contact, and Terms and
Safeguarding (footer links, not in the menu; WEBSITE-1.0-PLAN §2). All of them while a site has
none of them (pages it made itself move after them; an address already taken is skipped), else
only a missing home page. A removed page isn't brought back. They're drafts, published with the
site; the audit log says "Added the starter pages". Found on cross-demo2.
- **Template and style → Home page layout:** the Latest message's Card layout had no name.
- **Media picker:** the "No image" placeholder had too little contrast (WCAG AA).
### Added
- **Site icon** (Settings): a picture from the media library as the favicon, live at once
(setting `favicon_media_id`; `favicon` in the site content). Without one the site uses the
church's icon from its profile, else a default: the church's initial on its brand colour (a cross
before the church is known). Every page links `/site-icon?v=…`, which redirects to the icon or
serves the default SVG; the version changes with the icon.
## [1.1.0] — 2026-11-26
No migration, no new settings, no backend changes. The admin redesigned as Cross Events' admin
+9
View File
@@ -3,6 +3,15 @@
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.2.0
- **Your home page and the other pages are there from the start:** a new website now comes with
its home page, Plan your visit, About us, Give, Contact and the rest, with some starter text to
change. Before, a new website had no pages, so the home page and its preview were empty apart
from the header and footer.
- **Your own site icon:** under **Settings → Site icon**, choose the little picture that shows in
the browser tab and bookmarks. Until you do, your site shows your church's initial in its colour.
## 1.1.0
- **An easier admin.** A menu with icons down the side, and a dashboard with a tile for every part
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/website-backend",
"version": "1.1.0",
"version": "1.2.0",
"description": "Church Website: the public site's content API, the admin API, publishing and uploads",
"private": true,
"type": "module",
+12 -5
View File
@@ -1,7 +1,9 @@
/**
* The site's own settings (WEBSITE-1.0-PLAN §10, "Settings"), live at once (they aren't the site's
* design): the Coming soon line (§5), and the search engines' verification codes (ROADMAP-v3 §11:
* Google Search Console and Bing Webmaster Tools), shown as `<meta>` tags on the home page. Also the
* Google Search Console and Bing Webmaster Tools), shown as `<meta>` tags on the home page, and the
* site's icon (1.2.0: the favicon, a picture from the media library; without one the site uses the
* church's icon from its profile, else one made from its colour and initial). Also the
* menu's order, and the audit log.
*/
import { z } from 'zod';
@@ -18,13 +20,14 @@ const schema = z.object({
comingSoonText: z.string().trim().max(300).optional(),
googleVerification: code.optional(),
bingVerification: code.optional(),
faviconId: z.string().uuid().nullable().optional(),
});
export type SiteSettings = { comingSoonText: string; googleVerification: string | null; bingVerification: string | null };
export type SiteSettings = { comingSoonText: string; googleVerification: string | null; bingVerification: string | null; faviconId: string | null };
export async function getSettings(ctx: Ctx): Promise<SiteSettings> {
const [coming, google, bing] = await Promise.all([ctx.settings.get('coming_soon_text'), ctx.settings.get('google_verification'), ctx.settings.get('bing_verification')]);
return { comingSoonText: coming || 'Our new website is on its way.', googleVerification: google || null, bingVerification: bing || null };
const [coming, google, bing, favicon] = await Promise.all([ctx.settings.get('coming_soon_text'), ctx.settings.get('google_verification'), ctx.settings.get('bing_verification'), ctx.settings.get('favicon_media_id')]);
return { comingSoonText: coming || 'Our new website is on its way.', googleVerification: google || null, bingVerification: bing || null, faviconId: favicon || null };
}
export async function saveSettings(ctx: Ctx, body: unknown, by: { id: string; role: string }) {
@@ -35,10 +38,14 @@ export async function saveSettings(ctx: Ctx, body: unknown, by: { id: string; ro
throw new ApiError(400, 'VALIDATION', 'Some settings need another look.', fields);
}
const s = r.data;
if (s.faviconId && !(await ctx.db.mediaAsset.findUnique({ where: { id: s.faviconId } }))) {
throw new ApiError(400, 'VALIDATION', 'Some settings need another look.', { faviconId: 'That picture isn\'t in the media library' });
}
await ctx.settings.setMany({
...(s.comingSoonText !== undefined ? { coming_soon_text: s.comingSoonText || null } : {}),
...(s.googleVerification !== undefined ? { google_verification: s.googleVerification || null } : {}),
...(s.bingVerification !== undefined ? { bing_verification: s.bingVerification || null } : {}),
...(s.faviconId !== undefined ? { favicon_media_id: s.faviconId || null } : {}),
});
await audit(ctx, { actorId: by.id, actorRole: by.role, action: 'settings_changed', targetType: 'settings', targetId: null, metadata: { fields: Object.keys(s) } });
return getSettings(ctx);
@@ -59,7 +66,7 @@ export async function orderPages(ctx: Ctx, body: unknown, by: { id: string }) {
}
const ACTIONS: Record<string, string> = {
site_published: 'Published the site', change_discarded: 'Discarded a change', version_restored: 'Restored a version',
site_published: 'Published the site', change_discarded: 'Discarded a change', version_restored: 'Restored a version', starter_pages_added: 'Added the starter pages',
preview_link_created: 'Made a preview link', preview_link_revoked: 'Stopped a preview link',
first_owner_signed_in: 'Signed in as the first Owner', admin_signed_in: 'Signed in', admin_signed_out: 'Signed out',
admin_sign_in_refused: 'Was refused sign-in (no role here)', website_user_added: 'Gave someone access',
+5
View File
@@ -11,6 +11,7 @@ import { createApp } from './app.js';
import { createCtx } from './context.js';
import { connectFromEnv, heartbeat, startHeartbeats } from './hub/client.js';
import { loadConfig } from './lib/config.js';
import { ensureStarterPages } from './site/starter.js';
import { startYoutubeSync } from './site/youtube.js';
import { startFeedSync } from './feed/feed.js';
@@ -20,6 +21,10 @@ async function main() {
if (!url) throw new Error('DATABASE_URL isn\'t set.');
const db = new PrismaClient({ adapter: new PrismaPg({ connectionString: url, connectionTimeoutMillis: 5000 }) });
const ctx = createCtx(config, db);
// A new install's fixed pages (home, Plan your visit, …), before anything is served.
await ensureStarterPages(ctx)
.then((kinds) => { if (kinds.length) console.log(`[website] Added the starter pages: ${kinds.join(', ')}.`); })
.catch((e) => console.error('[website] Couldn\'t add the starter pages:', (e as Error).message));
const app = createApp(ctx);
const server = app.listen(config.port, () => console.log(`[website] Listening on ${config.port} (${config.publicUrl}).`));
const stopHeartbeats = startHeartbeats(ctx);
+8 -4
View File
@@ -8,7 +8,7 @@ import { TEMPLATE_FONT_PAIRINGS, type Church, type CrosscodeEvent, type WebsiteT
import type { Ctx } from '../context.js';
import { churchProfile } from '../church/profile.js';
import { buildPalette, type Palette } from './palette.js';
import { buildSnapshot, imageOf, publishedSnapshot, type Image, type Snapshot } from './snapshot.js';
import { buildSnapshot, imageOf, mediaUrl, publishedSnapshot, type Image, type Snapshot } from './snapshot.js';
import { headerIsTransparent, TEMPLATE_STYLE, type Variant } from './variants.js';
export type SiteEvent = {
@@ -50,6 +50,8 @@ type Common = {
style: { fontPairing: string; corners: string };
/** Search engines' verification codes, for the home page's meta tags (§11). */
verification: { google: string | null; bing: string | null };
/** 1.2.0: the site's own icon (Settings), else null: the church's icon, else one made for it. */
favicon: string | null;
};
export type SiteContent =
@@ -158,13 +160,15 @@ export async function previewContent(ctx: Ctx, opts: { asTemplate?: WebsiteTempl
}
async function contentFrom(ctx: Ctx, church: Church | null, published: { number: number; publishedAt: Date; snapshot: Snapshot } | null): Promise<SiteContent> {
const [google, bing] = await Promise.all([ctx.settings.get('google_verification'), ctx.settings.get('bing_verification')]);
const [google, bing, faviconId] = await Promise.all([ctx.settings.get('google_verification'), ctx.settings.get('bing_verification'), ctx.settings.get('favicon_media_id')]);
const verification = { google: google || null, bing: bing || null };
const icon = faviconId ? await ctx.db.mediaAsset.findUnique({ where: { id: faviconId } }) : null;
const favicon = icon ? mediaUrl(icon.filename) : null;
if (!published) {
const design = await ctx.db.siteDesign.findUnique({ where: { id: 1 }, select: { template: true } });
const template = (design?.template ?? 'heritage') as WebsiteTemplate;
return {
mode: 'coming-soon', template, church, ...brandFor(church, template), verification,
mode: 'coming-soon', template, church, ...brandFor(church, template), verification, favicon,
comingSoonText: (await ctx.settings.get('coming_soon_text')) || 'Our new website is on its way.',
};
}
@@ -175,5 +179,5 @@ async function contentFrom(ctx: Ctx, church: Church | null, published: { number:
return [p.path, headerIsTransparent(template, snapshot.design.style.header, hero)];
}));
const [messages, events] = await Promise.all([liveMessages(ctx), liveEvents(ctx)]);
return { mode: 'published', version: published.number, snapshot, transparentHeader, church, ...brandFor(church, template), verification, messages, events };
return { mode: 'published', version: published.number, snapshot, transparentHeader, church, ...brandFor(church, template), verification, favicon, messages, events };
}
+88
View File
@@ -0,0 +1,88 @@
/**
* The fixed pages (WEBSITE-1.0-PLAN §6) with starter text, for a site that has no pages yet: a new
* install. Without them the home page had no sections (the site and its preview showed only the
* header and footer) and the other pages didn't exist. Terms and Safeguarding come from starter
* text too (§2), linked from the footer rather than the menu.
*
* Checked at startup (ensureStarterPages): a site with none of the fixed pages gets them all, one
* without a home page gets that. A page a church removed (archived) isn't brought back, except home,
* which can't be removed. Nothing is published: the pages are drafts like any other change. The text names no church, since a new install isn't
* always linked to its church profile yet; every section and block can be edited.
*/
import type { Ctx } from '../context.js';
import { audit } from '../lib/audit.js';
import type { SectionData } from './sections.js';
type Block = { type: string; data: Record<string, unknown> };
type StarterPage = { kind: string; slug: string; title: string; inNav?: boolean; description: string; sections: Block[] };
const VISIT = { label: 'Plan your visit', href: '/visit' };
export const STARTER_HOME: SectionData = {
hero: { headline: 'You are welcome here', subline: 'Join us this Sunday. Come as you are.', images: [], videoId: null, button: VISIT },
serviceTimes: { heading: 'Join us this Sunday', note: null },
welcome: {
heading: 'Welcome', mission: null, imageId: null, pastor: null,
body: 'We are a family of ordinary people who have found good news in Jesus. Whether you have followed him for years or are just curious, there is a seat for you here.',
},
ministries: { heading: 'Find your place', intro: 'There is something for every age and stage.' },
team: { heading: 'Our team', intro: null },
events: { heading: 'Coming up', count: 3 },
latestMessage: { heading: 'Latest message' },
invitation: { heading: 'We saved you a seat', text: 'New here? Let us know you are coming and we will meet you at the door.', button: VISIT, imageId: null },
};
const text = (heading: string | null, body: string): Block => ({ type: 'text', data: { heading, body } });
export const STARTER_PAGES: StarterPage[] = [
{ kind: 'home', slug: 'home', title: 'Home', description: 'Join us this Sunday. Come as you are.', sections: Object.entries(STARTER_HOME).map(([type, data]) => ({ type, data })) },
{
kind: 'visit', slug: 'visit', title: 'Plan your visit', description: 'What to expect on your first Sunday with us.', sections: [
text('What to expect', 'We sing together, pray, and hear a message from the Bible. Dress is casual, and there is coffee after the service.'),
{ type: 'cta', data: { heading: 'Questions before you come?', text: 'Get in touch and we will get back to you.', button: { label: 'Contact us', href: '/contact' } } },
],
},
{ kind: 'about', slug: 'about', title: 'About us', description: 'Our story, what we believe and what we value.', sections: [text('Our story', 'Tell your church\'s story here: how it started, what you believe and what you value.')] },
{ kind: 'ministries', slug: 'ministries', title: 'Ministries', description: 'Find your place in our church family.', sections: [] },
{ kind: 'leadership', slug: 'leadership', title: 'Leadership', description: 'The team who lead our church.', sections: [] },
{ kind: 'events', slug: 'events', title: 'Events', description: 'What is coming up at our church.', sections: [] },
{ kind: 'messages', slug: 'messages', title: 'Messages', description: 'Sunday messages from our church.', sections: [] },
{ kind: 'give', slug: 'give', title: 'Give', description: 'How to give to our church.', sections: [text('Giving', 'Thank you for giving. Add how to give here: your bank details, or links to SnapScan, Zapper or PayFast.')] },
{ kind: 'contact', slug: 'contact', title: 'Contact', description: 'How to find us and get in touch.', sections: [] },
{
kind: 'terms', slug: 'terms', title: 'Terms of use', inNav: false, description: 'The terms for using this website.', sections: [
text(null, 'This website is run by our church to share who we are, what we do and when we meet. You may use it for your own, personal purposes.\n\nWe do our best to keep it accurate and up to date, but things change: please check service times and events with us if you are unsure.\n\nLinks to other websites are for your convenience; we are not responsible for what they say.\n\nHow we handle personal information is in our privacy notice, linked at the bottom of every page.'),
],
},
{
kind: 'safeguarding', slug: 'safeguarding', title: 'Safeguarding', inNav: false, description: 'How we keep children and vulnerable adults safe.', sections: [
text(null, 'We are committed to the safety of every child and vulnerable adult in our care. Everyone who serves with children or vulnerable adults is screened and trained, and we follow a written safeguarding policy.\n\nIf you are worried about someone\'s safety, or about how anyone at our church has behaved, please speak to a member of our leadership team. If someone is in immediate danger, contact the police.'),
],
},
];
/**
* Adds the fixed pages a site is missing: all of them while it has none of them (only pages it made
* itself, or nothing at all), else just the home page if that's missing. A page whose address
* another page already has is left out. Custom pages move after them. Returns the kinds added.
*/
export async function ensureStarterPages(ctx: Ctx): Promise<string[]> {
const db = ctx.db;
const existing = await db.page.findMany({ select: { id: true, kind: true, slug: true, position: true, archivedAt: true } });
const fixed = existing.filter((p) => p.kind !== 'custom');
const wanted = fixed.length === 0 ? STARTER_PAGES : fixed.some((p) => p.kind === 'home' && !p.archivedAt) ? [] : STARTER_PAGES.filter((p) => p.kind === 'home');
const slugs = new Set(existing.map((p) => p.slug));
const adding = wanted.filter((p) => !slugs.has(p.slug));
if (!adding.length) return [];
// The site's own pages keep their order, after the fixed ones.
for (const p of existing.filter((x) => x.kind === 'custom')) await db.page.update({ where: { id: p.id }, data: { position: p.position + adding.length } });
let position = 0;
for (const p of adding) {
const page = await db.page.create({ data: { kind: p.kind as never, slug: p.slug, title: p.title, position: position++, description: p.description, inNav: p.inNav ?? true } });
let i = 0;
for (const s of p.sections) await db.section.create({ data: { pageId: page.id, type: s.type, position: i++, data: s.data as never } });
}
const kinds = adding.map((p) => p.kind);
await audit(ctx, { actorId: null, actorRole: 'system', action: 'starter_pages_added', targetType: 'page', metadata: { kinds } });
return kinds;
}
@@ -55,6 +55,18 @@ describe('settings, the menu and the audit log', () => {
assert.equal((await go('put', '/settings', { googleVerification: '<script>' })).status, 400);
});
it('sets the site icon from the media library, live at once, and takes it off again', async () => {
const { go, ctx, db } = await site();
assert.equal((await siteContent(ctx)).favicon, null, 'none: the site uses its default');
const m = await db.mediaAsset.create({ data: { filename: 'icon.png', mime: 'image/png', bytes: 100, width: 512, height: 512 } });
assert.equal((await go('put', '/settings', { faviconId: '00000000-0000-4000-8000-0000000000ff' })).body.error.fields.faviconId, 'That picture isn\'t in the media library');
const r = await go('put', '/settings', { faviconId: m.id });
assert.equal(r.body.faviconId, m.id);
assert.equal((await siteContent(ctx)).favicon, '/api/uploads/icon.png');
assert.equal((await go('put', '/settings', { faviconId: null })).body.faviconId, null);
assert.equal((await siteContent(ctx)).favicon, null);
});
it('orders the menu, and the audit log says who did what', async () => {
const { go, db } = await site();
const a = await db.page.create({ data: { kind: 'about', slug: 'about', title: 'About', position: 1 } });
@@ -0,0 +1,42 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { previewContent } from '../src/site/content.js';
import { ensureStarterPages, STARTER_PAGES } from '../src/site/starter.js';
import { harness } from './support/harness.js';
describe('a new install\'s starter pages', () => {
it('adds the fixed pages to a site with none, and the preview shows every homepage section', async () => {
const { ctx, db } = await harness({ linked: false });
assert.deepEqual(await ensureStarterPages(ctx), STARTER_PAGES.map((p) => p.kind));
const c = await previewContent(ctx);
assert.equal(c.mode, 'published');
if (c.mode !== 'published') return;
const home = c.snapshot.pages.find((p) => p.kind === 'home')!;
assert.deepEqual(home.sections.map((s) => s.type).sort(), ['events', 'hero', 'invitation', 'latestMessage', 'ministries', 'serviceTimes', 'team', 'welcome']);
// Every starter block fits its schema (a broken one would be left out of the site).
for (const p of STARTER_PAGES) assert.equal(c.snapshot.pages.find((x) => x.kind === p.kind)!.sections.length, p.sections.length, p.kind);
// Terms and Safeguarding are footer links, not menu items.
assert.equal(c.snapshot.pages.filter((p) => p.inNav).some((p) => p.kind === 'terms' || p.kind === 'safeguarding'), false);
// Only once.
assert.deepEqual(await ensureStarterPages(ctx), []);
assert.equal(await db.page.count(), STARTER_PAGES.length);
});
it('keeps the church\'s own pages, after the fixed ones, and skips an address they already use', async () => {
const { ctx, db } = await harness({ linked: false });
await db.page.create({ data: { kind: 'custom', slug: 'test', title: 'Test', position: 1 } });
await db.page.create({ data: { kind: 'custom', slug: 'give', title: 'Giving', position: 2 } });
const kinds = await ensureStarterPages(ctx);
assert.ok(kinds.includes('home') && !kinds.includes('give'));
const pages = await db.page.findMany({ orderBy: { position: 'asc' } });
assert.equal(pages[0]!.kind, 'home');
assert.deepEqual(pages.slice(-2).map((p) => p.slug), ['test', 'give']);
});
it('adds only a missing home page to a site that has its other fixed pages', async () => {
const { ctx, db } = await harness({ linked: false });
await db.page.create({ data: { kind: 'about', slug: 'about', title: 'About', archivedAt: new Date() } });
assert.deepEqual(await ensureStarterPages(ctx), ['home']);
assert.deepEqual(await ensureStarterPages(ctx), []);
});
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/website-frontend",
"version": "1.1.0",
"version": "1.2.0",
"private": true,
"description": "Church Website: the church's public site in its template, and the admin",
"scripts": {
+1 -1
View File
@@ -59,7 +59,7 @@ export function ImagePicker({ value, onChange, label }: { value: string | null;
<span className="block text-sm font-medium text-gray-800">{label}</span>
<div className="mt-1 flex items-center gap-3">
<div className="h-16 w-24 shrink-0 overflow-hidden rounded border border-gray-200 bg-gray-50">
{chosen ? <img src={chosen.url} alt={chosen.alt} className="h-full w-full object-cover" /> : <span className="flex h-full items-center justify-center text-xs text-gray-400">No image</span>}
{chosen ? <img src={chosen.url} alt={chosen.alt} className="h-full w-full object-cover" /> : <span className="flex h-full items-center justify-center text-xs text-gray-600">No image</span>}
</div>
<Btn onClick={() => setOpen(true)}>{value ? "Change" : "Choose"}</Btn>
{value && <Btn kind="link" onClick={() => onChange(null)}>Remove</Btn>}
@@ -8,9 +8,10 @@ import Link from "next/link";
import { useState } from "react";
import { api, canEdit } from "@/admin/api";
import { Btn, Field, inputClass, Loading, Notice, Panel, Title, useAction, useAdmin } from "@/admin/ui";
import { Hourglass, ListOrdered, Search, Settings } from "lucide-react";
import { AppWindow, Hourglass, ListOrdered, Search, Settings } from "lucide-react";
import { ImagePicker } from "@/admin/media";
type Settings = { comingSoonText: string; googleVerification: string | null; bingVerification: string | null };
type Settings = { comingSoonText: string; googleVerification: string | null; bingVerification: string | null; faviconId: string | null };
type PageRow = { id: string; kind: string; title: string; inNav: boolean };
export default function SettingsPage() {
@@ -42,6 +43,18 @@ export default function SettingsPage() {
</div>
<p className="mt-3 text-sm text-gray-600">A Google Business Profile helps people find your church on Google Maps: set one up at business.google.com with the same address as your church details.</p>
</Panel>
<Panel icon={AppWindow} title="Site icon">
<p className="mb-3 text-sm text-gray-600">The little picture in the browser tab and bookmarks. Choose a square picture (512 × 512 pixels is best; a PNG can have a see-through background). Without one, your site uses your church&apos;s icon, or your church&apos;s initial on its colour. This goes live straight away.</p>
<div className="flex flex-wrap items-end gap-6">
<ImagePicker label="Icon" value={s.faviconId} onChange={(faviconId) => setForm({ ...form, faviconId })} />
{/* What the site shows now (the default when none is chosen). */}
<div className="text-sm text-gray-600">
<span className="block font-medium text-gray-800">In use now</span>
<img src={`/site-icon?saved=${encodeURIComponent(settings.data.faviconId ?? "none")}`} alt="" width={32} height={32} className="mt-1 h-8 w-8 rounded" />
</div>
</div>
{fields.faviconId && <p className="mt-2 text-sm text-red-700">{fields.faviconId}</p>}
</Panel>
<Panel icon={Hourglass} title="Coming soon">
<Field label="The line under “Coming soon”" hint="Shown until you first publish your site." error={fields.comingSoonText}>
<input className={inputClass} value={s.comingSoonText} maxLength={300} onChange={(e) => setForm({ ...form, comingSoonText: e.target.value })} />
@@ -26,7 +26,7 @@ const SECTIONS: Record<string, string> = { hero: "Top of the page", serviceTimes
const VARIANT_NAMES: Record<string, string> = {
photo: "Photo", video: "Video", collage: "Collage", split: "Split", text: "Text only", panel: "Panel", strip: "Inline strip", map: "With map",
"image-text": "Image and text", pastor: "With pastor", cards: "Cards", list: "List", bands: "Alternating bands", faces: "Faces", featured: "Featured",
calendar: "Calendar strip", compact: "Compact", banner: "Banner", centred: "Centred", image: "Image background",
calendar: "Calendar strip", card: "Card", compact: "Compact", banner: "Banner", centred: "Centred", image: "Image background",
};
const ALL_VARIANTS: Record<string, string[]> = {
hero: ["photo", "video", "collage", "split", "text"], serviceTimes: ["panel", "strip", "map"], welcome: ["text", "image-text", "pastor"], ministries: ["cards", "list", "bands"],
+10 -1
View File
@@ -6,12 +6,21 @@ import { brandAttributes } from "@crosscode/ui";
import { loadContent } from "@/site/load";
import { PreviewBar } from "@/site/PreviewBar";
/** A short, stable version for the icon's address. */
const iconVersion = (s: string) => {
let h = 0;
for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) | 0;
return (h >>> 0).toString(36);
};
export async function generateMetadata(): Promise<Metadata> {
const c = await loadContent();
const name = c.church?.name ?? "Church Website";
return {
title: { default: name, template: `%s · ${name}` },
icons: c.church?.branding.iconUrl ? { icon: c.church.branding.iconUrl } : undefined,
// 1.2.0: always an icon (app/site-icon): the site's own, the church's, or a default. The
// version changes with it, so browsers don't keep showing an old one.
icons: { icon: `/site-icon?v=${iconVersion(c.favicon ?? c.church?.branding.iconUrl ?? `${c.palette.brand}|${c.church?.shortName ?? c.church?.name ?? ""}`)}` },
// A preview is never indexed (§4).
...(c.mode === "published" && c.preview ? { robots: { index: false, follow: false } } : {}),
};
@@ -0,0 +1,30 @@
import { NextResponse } from "next/server";
import { loadContent } from "@/site/load";
import { localRedirect } from "@/lib/localRedirect";
/**
* 1.2.0: the site's icon (favicon). The one chosen under Settings, else the church's icon from its
* profile, else a default made for the church: its initial on its brand colour (a cross when the
* church isn't known yet). The layout links here with a version, so a new icon shows at once.
*/
export async function GET() {
const c = await loadContent();
if (c.favicon) return localRedirect(c.favicon);
const shared = c.church?.branding.iconUrl;
if (shared && /^https:\/\//.test(shared)) return new NextResponse(null, { status: 303, headers: { Location: shared } });
return new NextResponse(defaultIcon(c.palette.brand, c.palette.onBrand, c.church?.shortName || c.church?.name || null), {
headers: { "Content-Type": "image/svg+xml", "Cache-Control": "public, max-age=300" },
});
}
const rgb = (v: string, otherwise: string) => (/^\d{1,3} \d{1,3} \d{1,3}$/.test(v) ? `rgb(${v.replace(/ /g, ",")})` : otherwise);
function defaultIcon(brand: string, onBrand: string, name: string | null): string {
const bg = rgb(brand, "rgb(31,78,121)");
const fg = rgb(onBrand, "#fff");
const initial = name?.trim().match(/\p{L}|\p{N}/u)?.[0]?.toUpperCase();
const mark = initial
? `<text x="32" y="44" text-anchor="middle" font-family="Georgia, 'Times New Roman', serif" font-size="38" font-weight="700" fill="${fg}">${initial.replace(/[<>&"']/g, "")}</text>`
: `<path d="M28 12h8v12h12v8H36v20h-8V32H16v-8h12z" fill="${fg}"/>`;
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="${bg}"/>${mark}</svg>`;
}
+5 -1
View File
@@ -72,7 +72,11 @@ export type SiteMessage = {
thumbnail: string | null;
};
type Common = { church: Church | null; palette: Palette; style: { fontPairing: string; corners: string }; verification?: { google: string | null; bing: string | null } };
type Common = {
church: Church | null; palette: Palette; style: { fontPairing: string; corners: string }; verification?: { google: string | null; bing: string | null };
/** 1.2.0: the site's own icon (Settings); absent from a backend before 1.2.0. */
favicon?: string | null;
};
export type ComingSoon = Common & { mode: "coming-soon"; template: Template; comingSoonText: string };
+16 -5
View File
@@ -1,6 +1,6 @@
# Versions — the latest release of everything
Last updated: 2026-11-26. Taken from the git tags, which is what a release is here (branch → merge →
Last updated: 2026-11-27. Taken from the git tags, which is what a release is here (branch → merge →
tag → push, see [HANDOVER.md](./HANDOVER.md) "Releasing"). **Update this file with every release.**
"Released" means tagged and pushed. Whether a release is **deployed** or rolled out is recorded
@@ -11,11 +11,11 @@ separately below; the two often differ.
| What | Repo | Latest | Tag | Released |
|------|------|--------|-----|----------|
| Cross Events | `crosscode-platform` (`apps/events`) | **3.7.1** | `events@3.7.1` | 2026-11-26 |
| Church Website | `crosscode-platform` (`apps/website`) | **1.1.0** | `website@1.1.0` | 2026-11-26 |
| Church Website | `crosscode-platform` (`apps/website`) | **1.2.0** | `website@1.2.0` | 2026-11-27 |
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.8.0** | `accounts@1.8.0` | 2026-11-26 |
| Server agent | `crosscode-platform` (`apps/agent`) | **1.5.0** | `agent@1.5.0` | 2026-11-23 |
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.18.0** | `contracts@1.18.0` | 2026-11-25 |
| Cross Code Hub | `events-hub` | **2.23.1** | `v2.23.1` | 2026-11-26 |
| Cross Code Hub | `events-hub` | **2.24.0** | `v2.24.0` | 2026-11-27 |
| crosscode.co.za | `crosscode-site` | **1.7.0** | `v1.7.0` | 2026-11-26 |
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-23 (last change: uninstall, export and purge one product of a church) |
@@ -30,7 +30,7 @@ on each run, so merging to `main` and pushing releases it. Its changes are liste
| `@crosscode/auth-client` | `packages/auth-client` | 1.1.0 (released with Events 3.0.0 and Accounts 1.1.0) |
| `@crosscode/seo` | `packages/seo` | 1.0.0 (released with Events 2.4.0) |
| `@crosscode/ui` | `packages/ui` | 0.3.0 (fonts, `ChurchFooter`; 0.2.0 with Accounts 1.7.0, 0.3.0 with Events 3.7.0) |
| Website | `apps/website` | 1.1.0 (1.0.0–1.1.0 released 2026-11-26; installed for the demo church cross-demo2 (1.0.1) only, Hope Family Church next) |
| Website | `apps/website` | 1.2.0 (1.0.0–1.1.0 released 2026-11-26, 1.2.0 on 2026-11-27; installed for the demo church cross-demo2 (1.1.0) only, Hope Family Church next) |
| App | `apps/app` | 0.0.0 (not started, phase 6) |
These shared packages ship inside the apps that use them, from the same checkout, so they don't
@@ -38,6 +38,17 @@ need their own tags until something outside this repo depends on them.
## What each latest release was for
- **Church Website 1.2.0 + Hub 2.24.0 (2026-11-27):** Website: a new install had no pages, so the
home page and its live preview showed only the header and footer (found on cross-demo2); the
backend now adds the fixed pages with starter text at startup (all of them to a site with none,
else a missing home page; never one a church removed), Terms and Safeguarding included. Settings →
Site icon (a favicon from the media library; else the church's icon, else its initial on its
colour). The Latest message's Card layout got its name. No migration. Hub: "Update everything to
latest" on a customer's Sites card plans every product that's behind in one batch (Accounts
first, one at a time, stopping at the first failure), scheduled or as an emergency, planned whole
or not at all; later products keep Accounts at the batch's new version. No migration. Checked:
the Website's backend tests (104), the admin e2e (11, with axe), typechecks and lint; the Hub's
backend tests (279), frontend typecheck and lint. **Not deployed yet.**
- **Accounts 1.8.0 + Church Website 1.1.0 (2026-11-26):** both admins redesigned as Cross Events' admin
dashboard and settings. Accounts: `/admin` is an overview, People moved to `/admin/people`, a
grouped sidebar showing the part you're in. Website: an icon sidebar, a dashboard, steps to the
@@ -294,5 +305,5 @@ you deploy one.
| Agent on the central server | 1.5.0 | 2026-11-23 | Reads and changes frps's config from the Hub (no longer read-only; decision 35 superseded) |
| Cross Events (churches) | 3.6.1 | 2026-11-20 | Every install adopted onto the monorepo and signing in through Accounts |
| Accounts (churches) | 1.6.0 | 2026-11-20 | |
| cross-demo2 (demo church) | Accounts 1.7.1, Cross Events 3.7.1, Church Website 1.0.2 | 2026-11-26 | The first Church Website install (`demo2.crosscode.co.za`, added next to the church's Accounts) |
| cross-demo2 (demo church) | Accounts 1.7.1, Cross Events 3.7.1, Church Website 1.1.0 (its health check, 2026-11-27) | 2026-11-26 | The first Church Website install (`demo2.crosscode.co.za`, added next to the church's Accounts) |
| crosscode.co.za | 1.6.1 | 2026-11-23 | Clearer web address choices on the Cross Events page |
+2 -2
View File
@@ -360,7 +360,7 @@
},
"apps/website/backend": {
"name": "@crosscode/website-backend",
"version": "1.1.0",
"version": "1.2.0",
"hasInstallScript": true,
"dependencies": {
"@crosscode/auth-client": "*",
@@ -387,7 +387,7 @@
},
"apps/website/frontend": {
"name": "@crosscode/website-frontend",
"version": "1.1.0",
"version": "1.2.0",
"dependencies": {
"@crosscode/contracts": "*",
"@crosscode/seo": "*",