Compare commits

..
Author SHA1 Message Date
joshua 66557c7f1d Merge branch 'feat/events-3.7' 2026-11-24 23:29:24 +02:00
joshuaandClaude Opus 5.5 f4b6a41f83 Events 3.7.0 + @crosscode/ui 0.3.0: the church's fonts, corners and footer on the public pages
- Backend: the church profile from Accounts (src/accounts/church.ts, kept 10
  minutes, last copy kept while Accounts is down), public GET /api/v2/church,
  and church.changed accepted at POST /api/church/v1/changed (signed with the
  Accounts link; it answered 404 before).
- Frontend: brandAttributes on <html>, @crosscode/ui/fonts.css, body and
  h1-h3 use the church's pairing, --radius follows its corners; the dashboard
  and setup screens (data-cc-staff) keep their fonts and 0.5rem.
- The shared ChurchFooter on public pages when Accounts is connected (terms
  and cookie settings below it); header links to the church's other sites.
- @crosscode/ui 0.3.0: ChurchFooter takes `bottom`.
- Tests: tests/churchProfile.test.ts (8); e2e/church-brand.spec.ts and a
  /test/profile hook on the e2e Accounts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:29:23 +02:00
30 changed files with 1359 additions and 42 deletions
+10
View File
@@ -2,6 +2,16 @@
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
## events@3.7.0 + @crosscode/ui 0.3.0 - 2026-11-24
Cross Events' public pages use the church's brand style and the shared footer (WEBSITE-1.0-PLAN §9).
Details in `apps/events/CHANGELOG.md`.
- **Events 3.7.0:** the church profile from Accounts (`GET /api/v2/church`), its fonts and corners
on the public pages, `ChurchFooter` and links to the church's other sites; `church.changed` is
accepted at `/api/church/v1/changed`. Dashboard and setup unchanged. No migrations.
- **`@crosscode/ui` 0.3.0:** `ChurchFooter` takes `bottom` (a product's own links).
## contracts@1.17.0 + accounts@1.7.0 + @crosscode/ui 0.2.0 - 2026-11-24
The first release of the Church Website 1.0.0 work (WEBSITE-1.0-PLAN §12). The contracts are
+32
View File
@@ -5,6 +5,38 @@ All notable changes to this project are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project follows [Semantic Versioning](https://semver.org/).
## [3.7.0] - 2026-11-24
The church's look from its Accounts (docs/WEBSITE-1.0-PLAN.md §9). Works with any Accounts: the
brand style needs Accounts 1.7.0 (with an older one the pages keep their fonts and only the footer
changes). No migrations, no new settings.
### Added
- **The church's fonts and corners on the public pages.** The backend reads the church profile from
Accounts (`GET /api/church/v1`, kept for 10 minutes; `src/accounts/church.ts`) and the public
pages get it from the new `GET /api/v2/church` (public). `<html>` gets `brandAttributes(style)`
from `@crosscode/ui` and the root layout imports `@crosscode/ui/fonts.css` (self-hosted, so no
font is loaded from another site). Body text and h1–h3 use `--cc-font-body` and
`--cc-font-heading` when the church picked a pairing, and `--radius` follows the corner style
(`soft` is 0.5rem, the same as before). The dashboard and setup screens (`data-cc-staff`) keep
the system fonts and 0.5rem.
- **`church.changed` from Accounts** at `POST /api/church/v1/changed` (signed with the Accounts
link, `LINK_HEADERS`): the profile is fetched again on the next page. Before 3.7.0 this answered
404 and Accounts kept retrying for a week.
- **The shared church footer** (`ChurchFooter`, `@crosscode/ui` 0.3.0) on the public pages when
Accounts is connected: name and logo, service times, address, contact, social links and links
to the church's other sites and the privacy notice, with Terms of Use and cookie settings below.
Without Accounts, and on the dashboard (`<Footer plain />`), the footer is as before.
- **Links to the church's other sites** in the header of the public pages (its Website, later its
App), from the profile's `links`.
### Changed
- `@crosscode/ui` 0.3.0: `ChurchFooter` takes `bottom` (a product's own links after the copyright).
- Frontend: `transpilePackages: ["@crosscode/ui"]`; Tailwind scans `packages/ui/src` and has
`brand` (brand-700) for the shared footer.
## [3.6.1] - 2026-11-20
### Fixed
+8
View File
@@ -12,6 +12,14 @@ Write for church admins, not developers: no environment variables, endpoints or
developer log is CHANGELOG.md. A tagged version without a section here shows "No details given".
-->
## 3.7.0
- **Your public pages look like the rest of your church's sites.** With sign-in through your
church's Accounts, the event pages use the fonts and corner style picked under Accounts → Admin →
Brand style (as your sign-in pages, and later your church website, do), and a new footer shows your service times,
address, contact details, social links and links to your other sites. The dashboard looks the same
as before.
## 3.6.1
- **Fix:** uploading a logo or site icon under Settings → Branding could fail with "uploaded, but
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/events-backend",
"version": "3.6.1",
"version": "3.7.0",
"description": "Event Management System Backend",
"main": "src/index.js",
"scripts": {
@@ -0,0 +1,67 @@
/**
* The church profile from the church's Accounts (3.7.0, docs/WEBSITE-1.0-PLAN.md §9): the brand
* style (fonts and corners) and what the shared footer shows (service times, address, contact,
* social, the church's other sites). Accounts owns it and serves it publicly at
* `GET /api/church/v1`; this keeps a copy in memory for the public pages (`GET /api/v2/church`).
*
* Fetched again after 10 minutes, or at once when Accounts sends `church.changed`
* (`POST /api/church/v1/changed`, src/links/routes.ts). While Accounts can't be reached the last
* copy is kept and it's tried again after a minute; a site without Accounts has none, and its
* pages look as they always have.
*/
import { CHURCH_PATHS, churchSchema, type Church } from '@crosscode/contracts';
import { accountsLink } from './client';
const FRESH_MS = 10 * 60e3;
const RETRY_MS = 60e3;
const TIMEOUT_MS = 5000;
type Cached = { url: string; church: Church | null; at: number; ok: boolean };
let cached: Cached | null = null;
let pending: Promise<Church | null> | null = null;
async function fetchProfile(accountsUrl: string): Promise<Church> {
const res = await fetch(`${accountsUrl.replace(/\/+$/, '')}${CHURCH_PATHS.profile}`, { headers: { accept: 'application/json' }, signal: AbortSignal.timeout(TIMEOUT_MS) });
if (!res.ok) throw new Error(`Accounts answered ${res.status}`);
const parsed = churchSchema.safeParse(await res.json());
if (!parsed.success) throw new Error(`the profile isn't crosscode.church/1 (${parsed.error.issues[0]?.message ?? 'invalid'})`);
return parsed.data;
}
/** The church's profile, or null when Accounts isn't connected or hasn't answered yet. Never throws. */
export async function churchProfile(): Promise<Church | null> {
let link;
try {
link = await accountsLink();
} catch {
return cached?.church ?? null;
}
if (!link) return null;
const url = link.url;
if (cached && cached.url === url && Date.now() - cached.at < (cached.ok ? FRESH_MS : RETRY_MS)) return cached.church;
if (!pending) {
const last = cached?.url === url ? cached.church : null;
pending = fetchProfile(url)
.then((church) => {
cached = { url, church, at: Date.now(), ok: true };
return church;
}, (e: Error) => {
console.warn('[church] profile not fetched from Accounts:', e.message);
cached = { url, church: last, at: Date.now(), ok: false };
return last;
})
.finally(() => { pending = null; });
}
return pending;
}
/** `church.changed`: the next `churchProfile()` fetches it again (the last copy is shown meanwhile). */
export function churchChanged(): void {
if (cached) cached = { ...cached, at: 0 };
}
/** Tests: start with nothing. */
export function resetChurchProfile(): void {
cached = null;
pending = null;
}
+22 -1
View File
@@ -4,6 +4,7 @@
*
* GET /api/feed/v1/events?updatedSince= crosscode.event-feed/1 (public; "Publish my events")
* POST /api/feed/v1/changed event.changed from a linked product (LINK_HEADERS)
* POST /api/church/v1/changed church.changed from the church's Accounts (3.7.0)
* POST /api/links/v1/connect crosscode.link/1 link.connect → link.connected
* POST /api/links/v1/disconnect crosscode.link/1 link.disconnect → link.disconnected
*
@@ -11,11 +12,12 @@
*/
import express, { type Request, type Response, type Router } from 'express';
import rateLimit from 'express-rate-limit';
import { eventChangedSchema, FEED_PATHS, LINK_PATHS, LINK_SCHEMA } from '@crosscode/contracts';
import { CHURCH_PATHS, churchChangedSchema, eventChangedSchema, FEED_PATHS, LINK_PATHS, LINK_SCHEMA } from '@crosscode/contracts';
import { LINK_HEADERS, verify } from '@crosscode/contracts/signing';
import { hubInstallId, publishOn } from '../feed/context';
import { feedResponse, lastRefresh, refreshOnce } from '../feed/entries';
import { acceptConnect, acceptDisconnect, LinkError } from './connect';
import { churchChanged } from '../accounts/church';
/* eslint-disable @typescript-eslint/no-require-imports -- CommonJS */
const prisma = require('../config/db');
@@ -74,6 +76,25 @@ export function crossProductRouter(): Router {
}
});
// 3.7.0: the church profile changed in Accounts (its brand style, footer details): fetch it again.
router.post(CHURCH_PATHS.changed.replace(/^\/api/, ''), limiter(300), express.raw({ type: () => true, limit: '16kb' }), async (req, res) => {
try {
const sender = String(req.get(LINK_HEADERS.sender) || '');
const link = sender ? await prisma.productLink.findUnique({ where: { installId: sender } }) : null;
if (!link || link.product !== 'accounts') return fail(res, 404, 'NOT_LINKED', 'This site has no link with that Accounts.');
const rawBody: Buffer = Buffer.isBuffer(req.body) ? req.body : Buffer.from('');
const check = verify({ secret: decrypt(link.secret), timestamp: req.get(LINK_HEADERS.timestamp), signature: req.get(LINK_HEADERS.signature), rawBody });
if (!check.ok) return fail(res, 401, check.code, "The signature doesn't match this link.");
let body: unknown;
try { body = JSON.parse(rawBody.toString('utf8')); } catch { body = null; }
if (!churchChangedSchema.safeParse(body).success) return fail(res, 400, 'INVALID_REQUEST', "That isn't a church.changed message.");
churchChanged();
return res.status(202).json({ accepted: true });
} catch (e) {
return sendError(res, e);
}
});
router.post(LINK_PATHS.connect.replace(/^\/api/, ''), limiter(30), json, async (req, res) => {
try {
return res.json(await acceptConnect(req.body, getClientIp(req)));
+1
View File
@@ -26,6 +26,7 @@ import './resources/ai';
import './resources/feedback';
import './resources/linkedProducts';
import './resources/signIn';
import './resources/church';
const pkg = require('../../package.json') as { version: string };
@@ -0,0 +1,23 @@
import { churchSchema } from '@crosscode/contracts';
import { defineRoute } from '../route';
import { single } from '../paging';
import { churchProfile } from '../../accounts/church';
/**
* The church profile for the public pages (3.7.0, docs/WEBSITE-1.0-PLAN.md §9): its brand style
* (fonts, corners) and the shared footer's details, from the church's Accounts
* (src/accounts/church.ts). null when Accounts isn't connected.
*/
export const getChurch = defineRoute({
method: 'get',
path: '/church',
tag: 'Site',
summary: "The church's profile",
description: "The church profile (crosscode.church/1) from the church's Accounts: name, logo, brand style, service times, contact details, social links and its other sites. null when sign-in doesn't go through Accounts yet. Kept for up to 10 minutes, or until Accounts says it changed.",
access: 'public',
response: single(churchSchema.nullable()),
async handler({ res }) {
res.setHeader('Cache-Control', 'public, max-age=60');
return { data: await churchProfile() };
},
});
@@ -0,0 +1,140 @@
// 3.7.0 (docs/WEBSITE-1.0-PLAN.md §9): the church profile from Accounts for the public pages (its
// brand style and the shared footer), kept in memory and fetched again on church.changed.
import fs from 'fs';
import path from 'path';
import express from 'express';
import request from 'supertest';
type Link = { installId: string; product: string; url: string; secret: string; updatedAt: Date };
const mockLinks: Link[] = [];
jest.mock('../src/config/db', () => ({
productLink: {
findFirst: async ({ where }: { where: { product: string } }) => mockLinks.find((l) => l.product === where.product) ?? null,
findUnique: async ({ where }: { where: { installId: string } }) => mockLinks.find((l) => l.installId === where.installId) ?? null,
},
}));
jest.mock('../src/jobs', () => ({ enqueueTask: async () => ({ queued: true }) }));
process.env.JWT_SECRET = 'a-test-secret-that-is-long-enough-for-the-encryption';
import { CHURCH_PATHS } from '@crosscode/contracts';
import { LINK_HEADERS, signedHeaders } from '@crosscode/contracts/signing';
import { churchProfile, resetChurchProfile } from '../src/accounts/church';
import { crossProductRouter } from '../src/links/routes';
import { getChurch } from '../src/v2/resources/church';
// eslint-disable-next-line @typescript-eslint/no-require-imports -- CommonJS
const { encrypt } = require('../src/utils/encryption') as { encrypt(v: string): string };
const SAMPLES = path.join(path.dirname(require.resolve('@crosscode/contracts/package.json')), 'samples');
const sample = (name: string) => JSON.parse(fs.readFileSync(path.join(SAMPLES, name), 'utf8'));
const ACCOUNTS_ID = '5c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f';
const SECRET = 'link-secret-for-the-test-0123456789';
let profile = sample('church.json');
let answers: (number | 'down')[] = [];
let fetches = 0;
const realFetch = global.fetch;
beforeAll(() => {
global.fetch = (async (url: string) => {
fetches++;
expect(url).toBe(`https://accounts.hope.test${CHURCH_PATHS.profile}`);
const next = answers.shift() ?? 200;
if (next === 'down') throw new Error('connect ECONNREFUSED');
return new Response(JSON.stringify(profile), { status: next, headers: { 'content-type': 'application/json' } });
}) as typeof fetch;
});
afterAll(() => { global.fetch = realFetch; });
beforeEach(() => {
resetChurchProfile();
mockLinks.length = 0;
answers = [];
fetches = 0;
profile = sample('church.json');
jest.spyOn(console, 'warn').mockImplementation(() => {});
});
afterEach(() => { jest.restoreAllMocks(); });
const connectAccounts = () => mockLinks.push({ installId: ACCOUNTS_ID, product: 'accounts', url: 'https://accounts.hope.test/', secret: encrypt(SECRET), updatedAt: new Date() });
function app() {
const a = express();
a.use('/api', crossProductRouter());
return a;
}
function changed(body: object, { from = ACCOUNTS_ID, secret = SECRET } = {}) {
const raw = JSON.stringify(body);
const headers = signedHeaders(LINK_HEADERS, { senderId: from, secret, rawBody: raw });
return request(app()).post(CHURCH_PATHS.changed).set({ 'content-type': 'application/json', ...headers }).send(raw);
}
describe('the church profile', () => {
test('none without Accounts, and nothing is fetched', async () => {
expect(await churchProfile()).toBeNull();
expect(fetches).toBe(0);
});
test("fetched from the church's Accounts, with its brand style, and kept", async () => {
connectAccounts();
const c = await churchProfile();
expect(c?.branding.style).toEqual({ fontPairing: 'warm', corners: 'soft' });
expect(c?.name).toBe(profile.name);
await churchProfile();
expect(fetches).toBe(1);
});
test('a pairing this version doesn\'t know reads as none, so the page keeps its fonts', async () => {
connectAccounts();
profile.branding.style = { fontPairing: 'from-the-future', corners: 'round' };
expect((await churchProfile())?.branding.style).toEqual({ fontPairing: null, corners: 'round' });
});
test('Accounts down: none at first, then the last copy is kept while it is down', async () => {
connectAccounts();
answers = ['down'];
expect(await churchProfile()).toBeNull();
resetChurchProfile();
expect((await churchProfile())?.name).toBe(profile.name);
});
test('a profile that isn\'t crosscode.church/1 isn\'t used', async () => {
connectAccounts();
profile = { hello: 'world' };
expect(await churchProfile()).toBeNull();
});
test('GET /api/v2/church answers it, cacheable for a minute', async () => {
connectAccounts();
const headers: Record<string, string> = {};
const res = { setHeader: (k: string, v: string) => { headers[k] = v; } };
const out = await getChurch.handler({ res } as never);
expect(getChurch.response.safeParse(out).success).toBe(true);
expect((out as { data: { name: string } }).data.name).toBe(profile.name);
expect(headers['Cache-Control']).toBe('public, max-age=60');
});
});
describe('church.changed from Accounts', () => {
test('fetches the profile again (the last copy until then)', async () => {
connectAccounts();
await churchProfile();
profile.branding.style = { fontPairing: 'classic', corners: 'sharp' };
expect((await churchProfile())?.branding.style?.fontPairing).toBe('warm');
const res = await changed(sample('church-changed.json'));
expect(res.status).toBe(202);
expect((await churchProfile())?.branding.style).toEqual({ fontPairing: 'classic', corners: 'sharp' });
expect(fetches).toBe(2);
});
test('refuses a wrong signature, a sender that isn\'t Accounts and a body that isn\'t church.changed', async () => {
connectAccounts();
mockLinks.push({ installId: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee', product: 'website', url: 'https://www.hope.test', secret: encrypt(SECRET), updatedAt: new Date() });
expect((await changed(sample('church-changed.json'), { secret: 'not-the-secret-at-all-0123456789' })).status).toBe(401);
expect((await changed(sample('church-changed.json'), { from: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee' })).status).toBe(404);
const bad = await changed({ type: 'something.else' });
expect(bad.status).toBe(400);
expect(bad.body.code).toBe('INVALID_REQUEST');
});
});
+117
View File
@@ -0,0 +1,117 @@
import path from "path";
import AxeBuilder from "@axe-core/playwright";
import { test, expect, loginAs, seed } from "./fixtures";
// 3.7.0 (docs/WEBSITE-1.0-PLAN.md §9 and §13): with the church's Accounts connected, the public
// pages use the church's fonts and corners from its profile and the shared church footer, as the
// Website and Accounts' own pages do. The dashboard stays as it is. Accounts runs in memory
// (e2e/support/accounts-server.mts); afterwards the link is removed, so the other specs see the
// site as before.
/* eslint-disable @typescript-eslint/no-require-imports -- the backend's own modules, as prepare-db.js uses them */
const backend = path.join(__dirname, "..", "backend");
require(require.resolve("dotenv", { paths: [backend] })).config({ path: path.join(backend, ".env") });
const { Client } = require(require.resolve("pg", { paths: [backend] }));
const { e2eDatabaseUrl } = require("./support/db-url");
const signing = require(require.resolve("@crosscode/contracts/signing", { paths: [backend] }));
const { encrypt } = require(path.join(backend, "src", "utils", "encryption"));
/* eslint-enable @typescript-eslint/no-require-imports */
const ACCOUNTS_API = "http://127.0.0.1:5221";
const ACCOUNTS_ID = "7e2d1c0b-9a8f-4e6d-8c5b-4a3f2e1d0c9b";
const TAGS = ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"];
async function sql(text: string, values: unknown[] = []) {
const client = new Client({ connectionString: e2eDatabaseUrl() });
await client.connect();
try {
return (await client.query(text, values)).rows;
} finally {
await client.end();
}
}
test.describe.serial("the church's brand style and footer", () => {
test.beforeAll(async () => {
const profile = await fetch(`${ACCOUNTS_API}/test/profile`, {
method: "POST",
body: JSON.stringify({
name: "E2E Church",
branding: { style: { fontPairing: "warm", corners: "round" } },
serviceTimes: [{ day: "sunday", time: "09:00", label: "Morning service", campus: null, note: null }],
contact: { email: "office@e2e.test", phone: "+27161234567", whatsapp: null, address: { line1: "1 Church Street", line2: null, suburb: null, city: "Vereeniging", postalCode: "1939" } },
}),
});
expect(profile.ok, await profile.text()).toBe(true);
// Linked to Accounts, as Connect would (the backend reads the profile from this address).
await sql(`DELETE FROM "ProductLink" WHERE product = 'accounts'`);
await sql(
`INSERT INTO "ProductLink" ("installId", product, url, "publicKey", secret, "connectedAt", "createdAt", "updatedAt") VALUES ($1, 'accounts', $2, 'x', $3, now(), now(), now())`,
[ACCOUNTS_ID, ACCOUNTS_API, encrypt(signing.newLinkSecret())],
);
});
test.afterAll(async () => {
await sql(`DELETE FROM "ProductLink" WHERE product = 'accounts'`);
});
test("public pages: the church's fonts, round corners and the shared footer, all from this site", async ({ page }) => {
const elsewhere: string[] = [];
page.on("request", (r) => {
if (r.resourceType() === "font" && !r.url().startsWith("http://localhost:3100/")) elsewhere.push(r.url());
});
// The site keeps the profile for a minute; reload until it's there.
await expect(async () => {
await page.goto("/events");
await expect(page.locator("html")).toHaveAttribute("data-cc-fonts", "warm", { timeout: 1000 });
}).toPass({ timeout: 90_000 });
await expect(page.locator("html")).toHaveAttribute("data-cc-corners", "round");
await expect(page.getByText("E2E Free Evening")).toBeVisible();
const fonts = await page.evaluate(async () => {
await document.fonts.ready;
const h1 = document.querySelector("h1");
return {
body: getComputedStyle(document.body).fontFamily,
heading: h1 ? getComputedStyle(h1).fontFamily : "",
radius: getComputedStyle(document.documentElement).getPropertyValue("--radius").trim(),
loaded: [...document.fonts].filter((f) => f.status === "loaded").map((f) => f.family.replace(/"/g, "")),
};
});
expect(fonts.body).toContain("CC Nunito Sans");
expect(fonts.heading).toContain("CC Fraunces");
expect(fonts.radius).toBe("0.75rem");
expect(fonts.loaded).toContain("CC Nunito Sans");
const footer = page.locator("footer");
await expect(footer.getByRole("heading", { name: "Service times" })).toBeVisible();
await expect(footer).toContainText("Sundays 09:00");
await expect(footer).toContainText("1 Church Street");
await expect(footer.getByRole("link", { name: "+27161234567" })).toHaveAttribute("href", "tel:+27161234567");
await expect(footer.getByRole("link", { name: "Your account" })).toHaveAttribute("href", /127\.0\.0\.1/);
await expect(footer.getByRole("link", { name: "Privacy notice" })).toHaveAttribute("href", "/legal/privacy");
await expect(footer.getByRole("link", { name: "Terms of Use" })).toBeVisible();
await expect(footer.getByRole("button", { name: /cookie/i })).toBeVisible();
await page.goto(`/events/${seed().events.course}`);
await expect(page.getByRole("heading", { name: "E2E Alpha Course" })).toBeVisible();
await expect(page.locator("footer").getByRole("heading", { name: "Service times" })).toBeVisible();
await page.waitForLoadState("networkidle");
const results = await new AxeBuilder({ page }).withTags(TAGS).analyze();
expect(results.violations.map((v) => `${v.id}: ${v.nodes.map((n) => n.target.join(" ")).join(", ")}`)).toEqual([]);
expect(elsewhere).toEqual([]);
});
test("the dashboard keeps its own fonts, corners and footer", async ({ page }) => {
await loginAs(page, "admin");
await page.goto("/dashboard");
await expect(page.locator("[data-cc-staff]").first()).toBeVisible();
await expect(page.locator("main")).toBeVisible();
const look = await page.evaluate(() => ({
body: getComputedStyle(document.body).fontFamily,
radius: getComputedStyle(document.documentElement).getPropertyValue("--radius").trim(),
}));
expect(look.body).not.toContain("CC ");
expect(look.radius).toBe("0.5rem");
await expect(page.locator("footer")).toContainText("All rights reserved");
});
});
+16 -1
View File
@@ -5,11 +5,13 @@
* differs from the Events site's (localhost), so their cookies stay apart as on two domains.
*
* Test helpers: POST /test/link { installId, url, secret } links Events, as Connect would;
* GET /test/code?to=<email> answers the last code emailed to that address.
* GET /test/code?to=<email> answers the last code emailed to that address; POST /test/profile changes
* the church profile (3.7.0, church-brand.spec.ts), as an admin's save in Accounts would.
*/
import http from 'node:http';
import { ed25519PublicToPem, generateEd25519 } from '@crosscode/contracts/signing';
import { createApp } from '../../../accounts/backend/src/app.ts';
import { updateProfile } from '../../../accounts/backend/src/church/profile.ts';
import { createCtx } from '../../../accounts/backend/src/context.ts';
import { loadConfig } from '../../../accounts/backend/src/lib/config.ts';
import { MemoryMessenger } from '../../../accounts/backend/src/lib/messages.ts';
@@ -33,6 +35,19 @@ http.createServer((req, res) => {
res.writeHead(200, { 'content-type': 'text/plain' }).end(messenger.lastCode(to) ?? '');
return;
}
if (req.method === 'POST' && req.url === '/test/profile') {
let body = '';
req.on('data', (c) => { body += c; });
req.on('end', async () => {
try {
const church = await updateProfile(ctx, JSON.parse(body));
res.writeHead(200, { 'content-type': 'application/json' }).end(JSON.stringify(church));
} catch (e) {
res.writeHead(400, { 'content-type': 'application/json' }).end(JSON.stringify({ message: (e as Error).message }));
}
});
return;
}
if (req.method === 'POST' && req.url === '/test/link') {
let body = '';
req.on('data', (c) => { body += c; });
+2
View File
@@ -14,6 +14,8 @@ const nextConfig: NextConfig = {
// The end-to-end tests run their own dev server; a separate build folder keeps it
// from clashing with one already running.
distDir: process.env.NEXT_DIST_DIR || ".next",
// The shared fonts and footer (3.7.0) are TypeScript source.
transpilePackages: ["@crosscode/ui"],
images: {
// (images.domains is deprecated in Next 16.)
remotePatterns: [{ protocol: 'https', hostname: 'images.unsplash.com' }],
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/events-frontend",
"version": "3.6.1",
"version": "3.7.0",
"private": true,
"scripts": {
"dev": "next dev",
@@ -12,6 +12,7 @@
"dependencies": {
"@crosscode/contracts": "*",
"@crosscode/seo": "*",
"@crosscode/ui": "*",
"@dnd-kit/core": "^6.3.1",
"@hookform/resolvers": "^5.2.1",
"@radix-ui/react-accordion": "^1.2.11",
@@ -75,7 +75,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
// Don't render protected content until auth state is known
if (loading || !user) {
return (
<div className="min-h-screen flex items-center justify-center bg-gray-50">
<div data-cc-staff className="min-h-screen flex items-center justify-center bg-gray-50">
<div className="text-sm text-gray-400">Loading…</div>
</div>
);
@@ -88,7 +88,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
// scroll) so the sidebar can be a plain sibling column that never
// scrolls — only the content column (main + footer) scrolls internally.
return (
<div className="h-screen flex flex-col overflow-hidden">
<div data-cc-staff className="h-screen flex flex-col overflow-hidden">
<Navbar />
<LicenceBanner />
<ProviderNotices />
@@ -99,7 +99,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
<Sidebar />
<div className="flex-1 min-w-0 flex flex-col overflow-y-auto">
<main className="flex-1 p-6 bg-gray-50">{children}</main>
<Footer />
<Footer plain />
</div>
</div>
</div>
@@ -107,14 +107,14 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
}
return (
<div className="min-h-screen flex flex-col">
<div data-cc-staff className="min-h-screen flex flex-col">
<Navbar />
<LicenceBanner />
<ProviderNotices />
<PrivacyPrompts />
<CommandPalette />
<main className="flex-1 p-6 bg-gray-50">{children}</main>
<Footer />
<Footer plain />
</div>
);
}
+26 -1
View File
@@ -47,7 +47,8 @@
--input: 214.3 31.8% 91.4%;
--ring: 243 75% 59%;
--radius: 0.5rem;
/* The church's corners (3.7.0, @crosscode/ui fonts.css): soft (0.5rem) unless it picked others. */
--radius: var(--cc-radius-sm, 0.5rem);
/* Fallback brand scale (matches the pre-branding-feature default indigo, brand-600 #4F46E5) */
--brand-50: #EEF2FF;
@@ -73,6 +74,30 @@ html {
scroll-behavior: smooth;
}
/*
* The church's fonts (3.7.0, docs/WEBSITE-1.0-PLAN.md §3 and §9): <html> gets
* data-cc-fonts from its brand style in Accounts, and @crosscode/ui/fonts.css sets these
* variables. Without a pairing they're unset and the page keeps Tailwind's system fonts.
* The dashboard and setup screens (data-cc-staff) stay as they are.
*/
@layer base {
body {
font-family: var(--cc-font-body, theme("fontFamily.sans"));
}
h1,
h2,
h3 {
font-family: var(--cc-font-heading, inherit);
font-variation-settings: var(--cc-heading-variation, normal);
}
html:has([data-cc-staff]) {
--cc-font-body: initial;
--cc-font-heading: initial;
--cc-heading-variation: initial;
--cc-radius-sm: initial;
}
}
/*
* Accessibility (WCAG 2.2 AA, 1.50.0): a clear focus ring for keyboard users on every
* focusable element (mouse clicks don't show it), in the brand colour with a white halo
+10 -2
View File
@@ -1,5 +1,7 @@
import type { Metadata } from "next";
import "@crosscode/ui/fonts.css";
import "./globals.css";
import { brandAttributes } from "@crosscode/ui";
import { AuthProvider } from "@/contexts/AuthContext";
import { SiteSettingsProvider } from "@/contexts/SiteSettingsContext";
import { ToastProvider } from "@/components/shared/ToastProvider";
@@ -11,6 +13,8 @@ import { ImpersonationBanner } from "@/components/shared/ImpersonationBanner";
import { SkipLink } from "@/components/layout/SkipLink";
import { resolveToApiOrigin } from "@/lib/api";
import { getServerSettings } from "@/lib/serverSettings";
import { getServerChurch } from "@/lib/serverChurch";
import { ChurchProvider } from "@/contexts/ChurchContext";
import { buildThemeCssVars } from "@/lib/colorScale";
import { appUrl } from "@/lib/siteConfig";
@@ -49,7 +53,7 @@ export async function generateMetadata(): Promise<Metadata> {
}
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const settings = await getServerSettings();
const [settings, church] = await Promise.all([getServerSettings(), getServerChurch()]);
const cssVars = buildThemeCssVars({
primary: settings.primary_color || settings.accent_color,
secondary: settings.secondary_color,
@@ -57,12 +61,15 @@ export default async function RootLayout({ children }: { children: React.ReactNo
});
return (
<html lang="en">
// The church's fonts and corners from Accounts (3.7.0): used by the public pages; the
// dashboard and setup screens keep their own (globals.css, data-cc-staff).
<html lang="en" {...brandAttributes(church?.branding.style)}>
<body>
{cssVars && (
<style id="brand-theme" dangerouslySetInnerHTML={{ __html: `:root{${cssVars}}` }} />
)}
<SkipLink />
<ChurchProvider church={church}>
<SiteSettingsProvider initialSettings={settings}>
<AuthProvider>
<ToastProvider>
@@ -75,6 +82,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
</ToastProvider>
</AuthProvider>
</SiteSettingsProvider>
</ChurchProvider>
</body>
</html>
+1 -1
View File
@@ -247,7 +247,7 @@ export default function SetupPage() {
};
return (
<div className="min-h-screen bg-gradient-to-br from-brand-50 to-brand-100 flex items-center justify-center p-4">
<div data-cc-staff className="min-h-screen bg-gradient-to-br from-brand-50 to-brand-100 flex items-center justify-center p-4">
<div className={`bg-white rounded-2xl shadow-lg w-full p-8 transition-all ${step === 3 ? "max-w-4xl" : "max-w-lg"}`}>
{/* Heading */}
@@ -1,30 +1,53 @@
"use client";
import Link from "next/link";
import { ChurchFooter } from "@crosscode/ui";
import { appName } from "@/lib/siteConfig";
import { useSiteSettings } from "@/contexts/SiteSettingsContext";
import { useChurch } from "@/contexts/ChurchContext";
import { CookieSettingsButton } from "@/components/shared/CookieSettingsButton";
export const Footer = () => {
/**
* The public pages' footer. With the church's Accounts connected (3.7.0) it's the shared church
* footer (as on the Website and Accounts' pages): name and logo, service times, address, contact,
* social links and the church's other sites, with this site's terms and cookie settings below.
* `plain`: the dashboard's own footer, as before.
*/
export const Footer = ({ plain = false }: { plain?: boolean }) => {
const { settings } = useSiteSettings();
const church = useChurch();
const displayName = settings.org_name || appName;
return (
<>
<footer className="bg-gray-900 text-white py-6 text-center text-sm">
<p>© {new Date().getFullYear()} {displayName}. All rights reserved.</p>
<div className="mt-2 space-x-4">
<Link href="/legal/terms" className="hover:underline text-gray-300">
Terms of Use
</Link>
<Link href="/legal/privacy" className="hover:underline text-gray-300">
Privacy Policy
</Link>
<CookieSettingsButton className="hover:underline text-gray-300" />
</div>
</footer>
{church && !plain ? (
<ChurchFooter
church={church}
current="events"
privacyUrl="/legal/privacy"
bottom={
<>
<Link href="/legal/terms" className="hover:underline">Terms of Use</Link>
<CookieSettingsButton className="hover:underline" />
</>
}
/>
) : (
<footer className="bg-gray-900 text-white py-6 text-center text-sm">
<p>© {new Date().getFullYear()} {displayName}. All rights reserved.</p>
<div className="mt-2 space-x-4">
<Link href="/legal/terms" className="hover:underline text-gray-300">
Terms of Use
</Link>
<Link href="/legal/privacy" className="hover:underline text-gray-300">
Privacy Policy
</Link>
<CookieSettingsButton className="hover:underline text-gray-300" />
</div>
</footer>
)}
{/* Spacer so content isn't hidden behind the fixed mobile bottom nav */}
<div className="h-16 md:hidden" aria-hidden="true" />
</>
);
};
};
@@ -9,6 +9,8 @@ import { BottomNav } from "./BottomNav";
import defaultLogo from "@/app/default_logo.png";
import { appName } from "@/lib/siteConfig";
import { resolveToApiOrigin } from "@/lib/api";
import { productLinks } from "@crosscode/ui";
import { useChurch } from "@/contexts/ChurchContext";
type NavLink = {
href: string;
@@ -20,6 +22,10 @@ export const Navbar = () => {
const { user, loading: authLoading, logout } = useAuth();
const { settings, loading: settingsLoading } = useSiteSettings();
const pathname = usePathname();
const church = useChurch();
// The church's other sites from its profile in Accounts (3.7.0): its Website, later its App.
// Not on the dashboard, which stays as it is.
const otherSites = church && !pathname?.startsWith("/dashboard") ? productLinks(church.links, "events") : [];
const displayName = settings.org_name || appName;
const logoSrc = settings.logo_url ? resolveToApiOrigin(settings.logo_url) : null;
@@ -94,6 +100,11 @@ export const Navbar = () => {
{link.label}
</Link>
))}
{otherSites.map(site => (
<a key={site.href} href={site.href} className="text-sm pb-0.5 border-b-2 border-transparent text-gray-700 transition-colors hover:text-brand-600">
{site.label}
</a>
))}
{/* Auth links are only known once the token has been validated —
rendering nothing here (instead of guessing "logged out") avoids
@@ -0,0 +1,13 @@
"use client";
import React, { createContext, useContext } from "react";
import type { Church } from "@crosscode/contracts";
/** The church profile from Accounts (3.7.0), fetched once by the root layout; null without Accounts. */
const ChurchContext = createContext<Church | null>(null);
export function ChurchProvider({ church, children }: { church: Church | null; children: React.ReactNode }) {
return <ChurchContext.Provider value={church}>{children}</ChurchContext.Provider>;
}
export const useChurch = () => useContext(ChurchContext);
@@ -74271,6 +74271,648 @@
}
}
}
},
"/church": {
"get": {
"tags": [
"Site"
],
"summary": "The church's profile",
"description": "The church profile (crosscode.church/1) from the church's Accounts: name, logo, brand style, service times, contact details, social links and its other sites. null when sign-in doesn't go through Accounts yet. Kept for up to 10 minutes, or until Accounts says it changed.\n\n**Who:** Anyone.",
"operationId": "getChurch",
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"anyOf": [
{
"type": "object",
"properties": {
"schema": {
"type": "string",
"const": "crosscode.church/1"
},
"customerId": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"shortName": {
"anyOf": [
{
"type": "string",
"maxLength": 30
},
{
"type": "null"
}
]
},
"timezone": {
"type": "string",
"pattern": "^[A-Za-z_]+(\\/[A-Za-z0-9_+-]+){0,2}$|^UTC$"
},
"locale": {
"type": "string",
"pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
},
"branding": {
"type": "object",
"properties": {
"logoUrl": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"iconUrl": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"colours": {
"type": "object",
"properties": {
"primary": {
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}$"
},
"accent": {
"anyOf": [
{
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}$"
},
{
"type": "null"
}
]
}
},
"required": [
"primary",
"accent"
],
"additionalProperties": false
},
"style": {
"type": "object",
"properties": {
"fontPairing": {
"default": null,
"anyOf": [
{
"type": "string",
"enum": [
"classic",
"scholarly",
"editorial",
"impact",
"contemporary",
"friendly",
"warm",
"modern"
]
},
{
"type": "null"
}
]
},
"corners": {
"default": null,
"anyOf": [
{
"type": "string",
"enum": [
"sharp",
"soft",
"round"
]
},
{
"type": "null"
}
]
}
},
"required": [
"fontPairing",
"corners"
],
"additionalProperties": false
}
},
"required": [
"logoUrl",
"iconUrl",
"colours"
],
"additionalProperties": false
},
"campuses": {
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"slug": {
"type": "string",
"maxLength": 100,
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"address": {
"anyOf": [
{
"type": "object",
"properties": {
"line1": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"line2": {
"anyOf": [
{
"type": "string",
"maxLength": 200
},
{
"type": "null"
}
]
},
"suburb": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"city": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"province": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"postalCode": {
"anyOf": [
{
"type": "string",
"maxLength": 20
},
{
"type": "null"
}
]
},
"country": {
"type": "string",
"pattern": "^[A-Z]{2}$"
},
"geo": {
"anyOf": [
{
"type": "object",
"properties": {
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90
},
"lng": {
"type": "number",
"minimum": -180,
"maximum": 180
}
},
"required": [
"lat",
"lng"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"line1",
"line2",
"suburb",
"city",
"province",
"postalCode",
"country",
"geo"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"slug",
"name",
"address"
],
"additionalProperties": false
}
},
"serviceTimes": {
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"day": {
"type": "string",
"enum": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday"
]
},
"time": {
"type": "string",
"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
},
"label": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"campus": {
"anyOf": [
{
"type": "string",
"maxLength": 100,
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
},
{
"type": "null"
}
]
},
"note": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
}
},
"required": [
"day",
"time",
"label",
"campus",
"note"
],
"additionalProperties": false
}
},
"contact": {
"type": "object",
"properties": {
"email": {
"anyOf": [
{
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
{
"type": "null"
}
]
},
"phone": {
"anyOf": [
{
"type": "string",
"pattern": "^\\+[1-9]\\d{6,14}$"
},
{
"type": "null"
}
]
},
"whatsapp": {
"anyOf": [
{
"type": "string",
"pattern": "^\\+[1-9]\\d{6,14}$"
},
{
"type": "null"
}
]
},
"address": {
"anyOf": [
{
"type": "object",
"properties": {
"line1": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"line2": {
"anyOf": [
{
"type": "string",
"maxLength": 200
},
{
"type": "null"
}
]
},
"suburb": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"city": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"province": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"postalCode": {
"anyOf": [
{
"type": "string",
"maxLength": 20
},
{
"type": "null"
}
]
},
"country": {
"type": "string",
"pattern": "^[A-Z]{2}$"
},
"geo": {
"anyOf": [
{
"type": "object",
"properties": {
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90
},
"lng": {
"type": "number",
"minimum": -180,
"maximum": 180
}
},
"required": [
"lat",
"lng"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"line1",
"line2",
"suburb",
"city",
"province",
"postalCode",
"country",
"geo"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"email",
"phone",
"whatsapp",
"address"
],
"additionalProperties": false
},
"social": {
"maxItems": 20,
"type": "array",
"items": {
"type": "object",
"properties": {
"network": {
"type": "string",
"enum": [
"facebook",
"instagram",
"youtube",
"tiktok",
"x",
"spotify",
"whatsapp-channel",
"other"
]
},
"url": {
"type": "string",
"maxLength": 2048,
"format": "uri"
}
},
"required": [
"network",
"url"
],
"additionalProperties": false
}
},
"links": {
"type": "object",
"properties": {
"website": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"events": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"app": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"accounts": {
"type": "string",
"maxLength": 2048,
"format": "uri"
}
},
"required": [
"website",
"events",
"app",
"accounts"
],
"additionalProperties": false
}
},
"required": [
"schema",
"customerId",
"updatedAt",
"name",
"shortName",
"timezone",
"locale",
"branding",
"campuses",
"serviceTimes",
"contact",
"social",
"links"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
}
}
}
}
},
"components": {
+125
View File
@@ -7760,6 +7760,28 @@ export interface paths {
patch?: never;
trace?: never;
};
"/church": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* The church's profile
* @description The church profile (crosscode.church/1) from the church's Accounts: name, logo, brand style, service times, contact details, social links and its other sites. null when sign-in doesn't go through Accounts yet. Kept for up to 10 minutes, or until Accounts says it changed.
*
* **Who:** Anyone.
*/
get: operations["getChurch"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
@@ -40739,4 +40761,107 @@ export interface operations {
};
};
};
getChurch: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
/** @constant */
schema: "crosscode.church/1";
/** Format: uuid */
customerId: string;
/** Format: date-time */
updatedAt: string;
name: string;
shortName: string | null;
timezone: string;
locale: string;
branding: {
logoUrl: string | null;
iconUrl: string | null;
colours: {
primary: string;
accent: string | null;
};
style?: {
/** @default null */
fontPairing: ("classic" | "scholarly" | "editorial" | "impact" | "contemporary" | "friendly" | "warm" | "modern") | null;
/** @default null */
corners: ("sharp" | "soft" | "round") | null;
};
};
campuses: {
slug: string;
name: string;
address: {
line1: string;
line2: string | null;
suburb: string | null;
city: string;
province: string | null;
postalCode: string | null;
country: string;
geo: {
lat: number;
lng: number;
} | null;
} | null;
}[];
serviceTimes: {
/** @enum {string} */
day: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
time: string;
label: string | null;
campus: string | null;
note: string | null;
}[];
contact: {
email: string | null;
phone: string | null;
whatsapp: string | null;
address: {
line1: string;
line2: string | null;
suburb: string | null;
city: string;
province: string | null;
postalCode: string | null;
country: string;
geo: {
lat: number;
lng: number;
} | null;
} | null;
};
social: {
/** @enum {string} */
network: "facebook" | "instagram" | "youtube" | "tiktok" | "x" | "spotify" | "whatsapp-channel" | "other";
/** Format: uri */
url: string;
}[];
links: {
website: string | null;
events: string | null;
app: string | null;
/** Format: uri */
accounts: string;
};
} | null;
};
};
};
};
};
}
@@ -0,0 +1,19 @@
import type { Church } from "@crosscode/contracts";
import { API_BASE } from "@/lib/api";
/**
* The church profile from the church's Accounts (3.7.0), through the backend's
* `GET /api/v2/church`: the brand style for `<html>` and the shared footer. null when Accounts
* isn't connected or the backend can't be reached, and the pages look as they always have.
* Fetched the same way as getServerSettings, so Next dedupes it within a request.
*/
export async function getServerChurch(): Promise<Church | null> {
if (!API_BASE) return null;
try {
const res = await fetch(`${API_BASE}/api/v2/church`, { next: { revalidate: 60 } });
if (!res.ok) return null;
return ((await res.json())?.data as Church | null) ?? null;
} catch {
return null;
}
}
+4
View File
@@ -2,6 +2,8 @@
module.exports = {
content: [
"./src/**/*.{js,ts,jsx,tsx}",
// The shared footer (3.7.0)
"../../../packages/ui/src/**/*.{ts,tsx}",
],
theme: {
extend: {
@@ -47,6 +49,8 @@ module.exports = {
// colorScale.ts's buildBrandScale + globals.css for the static
// fallback defaults used when no setting is saved yet).
brand: {
// `brand` alone (the shared footer's links, @crosscode/ui)
DEFAULT: "var(--brand-700)",
50: "var(--brand-50)",
100: "var(--brand-100)",
200: "var(--brand-200)",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/events",
"version": "3.6.1",
"version": "3.7.0",
"main": "index.js",
"scripts": {
"dev:backend": "cd backend && npm run dev",
+3 -3
View File
@@ -32,9 +32,9 @@ every release).
| 1d | Agent 1.x + Hub 2.1+ | **Released, rolled out and tested** (agent `1.5.0` on every server: from 1.4.0 the Hub reads and changes frps's / frpc's config and probes ports before an install; from 1.5.0 one product of a church can be uninstalled, exported or purged) |
| 2 | Cross Events 2.4.0: protocol v2, Linked products, event feed, `packages/seo` | **Released, rolled out and tested** ([EVENTS-2.4-PLAN.md](./EVENTS-2.4-PLAN.md)) |
| 3 | Accounts 1.0.0 | **Released, rolled out and tested** (now `accounts@1.6.0`; [ACCOUNTS-1.0-PLAN.md](./ACCOUNTS-1.0-PLAN.md)) |
| 4 | Cross Events 3.0.0: sign-in through Accounts | **Released, rolled out and tested** (now `events@3.6.1`; [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md)). Churches sign in through their Accounts; crosscode-site `v1.6.0` deployed |
| 4 | Cross Events 3.0.0: sign-in through Accounts | **Released, rolled out and tested** (now `events@3.7.0`; [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md)). Churches sign in through their Accounts; crosscode-site `v1.6.0` deployed |
| 4+ | Running it: jobs from the dashboard, styled emails, .env from the Hub, sign-in health, the nightly people check; then frp config and one-product uninstalls, and the Hub's popups, pickers and port list | **Released, deployed and tested** 2026-11-20 and 2026-11-23 (below) |
| 5 | Church Website 1.0.0 | **Planned** 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (all decisions confirmed). Font pairings confirmed 2026-11-24 (§3). `contracts@1.17.0` and `accounts@1.7.0` released 2026-11-24 (Accounts not yet rolled out); Events 3.7.0 next |
| 5 | Church Website 1.0.0 | **Planned** 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (all decisions confirmed). Font pairings confirmed 2026-11-24 (§3). `contracts@1.17.0`, `accounts@1.7.0` and `events@3.7.0` released 2026-11-24 (not yet rolled out); Hub 2.21.0 next |
| 6–7 | App 1.0.0 → App 1.x | Not started |
## Released 2026-11-23
@@ -101,7 +101,7 @@ out").
1. **Phase 5, Church Website 1.0.0** (ROADMAP §6, §9). Planned in
[WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md): decisions all confirmed 2026-11-21. Font pairings
confirmed 2026-11-24 (§3). Order: ~~contracts 1.17.0~~ → ~~Accounts 1.7.0~~ (both released 2026-11-24; Accounts
ships with contracts because it answers the new `church.update`) → Events 3.7.0 (shared fonts and footer) → **Hub 2.21.0** (the
ships with contracts because it answers the new `church.update`) → ~~Events 3.7.0~~ (shared fonts and footer; released 2026-11-24) → **Hub 2.21.0** (the
plan said 2.13.0; the Hub has moved on since) → `website@1.0.0` → Hope Family Church → a second
church → crosscode-site 1.7.0.
2. **Archive `hope-events`** if it isn't yet (every install now reports 2.2.0 or later;
+7 -2
View File
@@ -10,7 +10,7 @@ separately below; the two often differ.
| What | Repo | Latest | Tag | Released |
|------|------|--------|-----|----------|
| Cross Events | `crosscode-platform` (`apps/events`) | **3.6.1** | `events@3.6.1` | 2026-11-20 |
| Cross Events | `crosscode-platform` (`apps/events`) | **3.7.0** | `events@3.7.0` | 2026-11-24 |
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.7.0** | `accounts@1.7.0` | 2026-11-24 |
| Server agent | `crosscode-platform` (`apps/agent`) | **1.5.0** | `agent@1.5.0` | 2026-11-23 |
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.17.0** | `contracts@1.17.0` | 2026-11-24 |
@@ -28,7 +28,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.2.0 (fonts, `ChurchFooter`; released with Accounts 1.7.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` | 0.0.0 (phase 5, being built: contracts 1.17.0 released) |
| App | `apps/app` | 0.0.0 (not started, phase 6) |
@@ -37,6 +37,11 @@ need their own tags until something outside this repo depends on them.
## What each latest release was for
- **Events 3.7.0 (2026-11-24):** the public pages use the church's fonts, corners and the shared
church footer from its profile in Accounts (`GET /api/v2/church`, kept 10 minutes), with links to
its other sites in the header; `church.changed` from Accounts is now accepted (it answered 404
before). The dashboard and setup screens are unchanged. `@crosscode/ui` 0.3.0. No migrations.
The style needs Accounts 1.7.0. **Not deployed yet.**
- **Contracts 1.17.0 + Accounts 1.7.0 (2026-11-24):** the first piece of the Church Website. Contracts:
the 8 font pairings, corner styles and template ids (`./style`), an optional `branding.style` on the
church profile, `church.update` (the Website changes shared profile facts), an optional `website`
+6 -5
View File
@@ -46,7 +46,7 @@
},
"apps/accounts/backend": {
"name": "@crosscode/accounts-backend",
"version": "1.6.0",
"version": "1.7.0",
"hasInstallScript": true,
"dependencies": {
"@crosscode/contracts": "*",
@@ -83,7 +83,7 @@
},
"apps/accounts/frontend": {
"name": "@crosscode/accounts-frontend",
"version": "1.6.0",
"version": "1.7.0",
"dependencies": {
"@crosscode/contracts": "*",
"@crosscode/ui": "*",
@@ -128,7 +128,7 @@
},
"apps/events/backend": {
"name": "@crosscode/events-backend",
"version": "3.6.1",
"version": "3.7.0",
"hasInstallScript": true,
"dependencies": {
"@cj-tech-master/excelts": "^10.2.0",
@@ -178,10 +178,11 @@
},
"apps/events/frontend": {
"name": "@crosscode/events-frontend",
"version": "3.6.1",
"version": "3.7.0",
"dependencies": {
"@crosscode/contracts": "*",
"@crosscode/seo": "*",
"@crosscode/ui": "*",
"@dnd-kit/core": "^6.3.1",
"@hookform/resolvers": "^5.2.1",
"@radix-ui/react-accordion": "^1.2.11",
@@ -21436,7 +21437,7 @@
},
"packages/ui": {
"name": "@crosscode/ui",
"version": "0.2.0",
"version": "0.3.0",
"dependencies": {
"@fontsource-variable/dm-sans": "5.3.0",
"@fontsource-variable/eb-garamond": "5.3.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/ui",
"version": "0.2.0",
"version": "0.3.0",
"private": true,
"description": "Shared UI for the church's sign-in pages, Website and App: the branded shell, forms and buttons, the church's fonts and footer (Tailwind; apps compile the source with transpilePackages)",
"main": "src/index.tsx",
+7 -3
View File
@@ -57,9 +57,10 @@ export function productLinks(links: FooterChurch["links"], current: FooterProduc
/**
* One footer for every product: the church's name and logo, service times, address and contact,
* social links, links to its other sites, and the privacy notice. Sections without data are left
* out. `className` lets a Website template restyle it.
* out. `className` lets a Website template restyle it; `bottom` goes after the copyright line (a
* product's own links, such as its terms and cookie settings).
*/
export function ChurchFooter({ church, current, privacyUrl, className }: { church: FooterChurch; current: FooterProduct; privacyUrl?: string | null; className?: string }) {
export function ChurchFooter({ church, current, privacyUrl, className, bottom }: { church: FooterChurch; current: FooterProduct; privacyUrl?: string | null; className?: string; bottom?: React.ReactNode }) {
const times = church.serviceTimes ?? [];
const contact = church.contact;
const address = contact?.address;
@@ -110,7 +111,10 @@ export function ChurchFooter({ church, current, privacyUrl, className }: { churc
</nav>
)}
</div>
<p className="px-4 pb-6 text-center text-xs text-gray-500">© {new Date().getFullYear()} {church.name}</p>
<div className="flex flex-wrap items-center justify-center gap-x-4 gap-y-1 px-4 pb-6 text-center text-xs text-gray-500">
<p>© {new Date().getFullYear()} {church.name}</p>
{bottom}
</div>
</footer>
);
}