import { FONT_PAIRINGS, type agent } from "@crosscode/contracts"; import { demoChurch, type DemoMark } from "./churches"; /** * Each demo church's logo and icon, drawn for the demo (never a real church's): a simple mark in * white on the church's colour, and the mark beside the church's name. SVG, so they're crisp at * any size; Accounts serves them (`/api/demo-assets//icon.svg`, `logo.svg`). */ /** The marks, drawn in white on a 512 × 512 square. */ const MARKS: Record = { // A church window: a pointed arch with a sill. arch: '', cross: '', flame: '', wave: '', // An acacia: a flat crown on a thin trunk. tree: '', sun: '', // A compass point. north: '', // A river through three points (three campuses). river: '', }; const escapeXml = (s: string) => s.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); /** The square icon (app icon, favicon): the mark on the church's primary colour. */ export function demoIconSvg(scenario: agent.DemoScenarioKey): string { const c = demoChurch(scenario); const radius = c.profile.style.corners === "sharp" ? 48 : c.profile.style.corners === "round" ? 160 : 96; return `${MARKS[c.mark]}`; } /** The logo: the icon and the church's name in its heading font (a font stack, with a fallback). */ export function demoLogoSvg(scenario: agent.DemoScenarioKey): string { const c = demoChurch(scenario); const pairing = FONT_PAIRINGS[c.profile.style.fontPairing]; const font = `${pairing.heading.family}, ${pairing.heading.category === "serif" ? "Georgia, serif" : "Helvetica, Arial, sans-serif"}`; const name = c.profile.name; const size = name.length > 20 ? 64 : 76; const width = Math.round(240 + name.length * size * 0.56); const icon = demoIconSvg(scenario).replace(/^]*>/, "").replace(/<\/svg>$/, ""); return `` + `${icon}` + `${escapeXml(name)}`; }