app: the Church App's foundation; docs for Hub 2.26.1 and two years of devotionals

apps/app (not released; app@1.0.0 is built in slices, APP-1.0-PLAN §15):
- backend (Express, Prisma, pg-boss, as the Website): the Hub client
  (CCP-, product app, the active-member band in the heartbeat), links
  and church.changed, sign-in through Accounts (everyone a Member; 8 days
  renewed up to 90; every role only with 2FA; the first Owner from
  HUB_ADMIN_EMAIL), Accounts' user.updated/export/deleted, active members
  once a day, modules on and off, GET /api/v1/app. Migration init.
- frontend (Next.js 16): header, tab bar, footer, manifest and icons from
  the church profile, service worker, Add to home screen, Me, the admin's
  first dashboard.
- env.template.json, PM2 template, README, CHANGELOG, WHATS-NEW; 27 tests.

Docs: the Hub runs 2.26.1 with two years of Cross Code's devotionals; an
App gets 2 weeks, today included. HANDOVER lists the App's slices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 00:20:07 +02:00
co-authored by Claude Opus 5.5
parent 74dee881e4
commit bb36e06fa4
85 changed files with 4479 additions and 53 deletions
+48
View File
@@ -0,0 +1,48 @@
/**
* What every page of the App needs, public (APP-1.0-PLAN §2): the church (from its profile in
* Accounts), its colours made safe, its font pairing and corners, and the modules switched on.
* The frontend builds the header, tab bar, manifest and icons from it.
*/
import { DEFAULT_CORNERS, type Church } from '@crosscode/contracts';
import type { Ctx } from '../context.js';
import { churchProfile } from '../church/profile.js';
import { buildPalette, type Palette } from '../church/palette.js';
import { enabledModules } from '../modules.js';
/** The colour before the church has a profile (Cross Code's blue, as the Website's). */
export const DEFAULT_COLOUR = '#1f4e79';
/** The mockup's pairing (APP-1.0-PLAN, "Mockup"), until the church picks one in Accounts. */
export const DEFAULT_FONT_PAIRING = 'warm';
export type AppInfo = {
church: Church | null;
/** The profile's short name, else the name cut to 12 characters (the home-screen label, §2). */
shortName: string;
palette: Omit<Palette, 'notes'>;
style: { fontPairing: string; corners: string };
modules: string[];
/** The church's timezone (the profile's, else APP_TIMEZONE): days and slots are in it (§1). */
timezone: string;
};
export function shortNameFor(church: Pick<Church, 'name' | 'shortName'> | null): string {
if (church?.shortName) return church.shortName;
const name = church?.name?.trim() || 'Church App';
return name.length <= 12 ? name : `${name.slice(0, 11).trimEnd()}…`;
}
export async function appInfo(ctx: Ctx): Promise<AppInfo> {
const [church, modules] = await Promise.all([churchProfile(ctx), enabledModules(ctx)]);
const { notes: _notes, ...palette } = buildPalette(church?.branding.colours.primary ?? DEFAULT_COLOUR, church?.branding.colours.accent ?? null);
return {
church,
shortName: shortNameFor(church),
palette,
style: {
fontPairing: church?.branding.style?.fontPairing ?? DEFAULT_FONT_PAIRING,
corners: church?.branding.style?.corners ?? DEFAULT_CORNERS,
},
modules,
timezone: church?.timezone ?? ctx.config.timezone,
};
}