website 1.12.1: the With map layouts show the map

- Accounts' profile never has the address's geo, so Service times' and Contact's map layouts
  never drew a map. church/geocode.ts looks the address up on OpenStreetMap's Nominatim (the
  street, else the suburb and city) for the public site and the preview, kept in AppSetting
  church_geocode per address; one not found is retried after a day.
- Tests: backend (157, one new, with a stand-in Nominatim).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 11:38:53 +02:00
co-authored by Claude Opus 5.5
parent 76a44c9880
commit 33088c1377
8 changed files with 122 additions and 6 deletions
+3 -2
View File
@@ -7,6 +7,7 @@
import { TEMPLATE_FONT_PAIRINGS, type Church, type CrosscodeEvent, type WebsiteTemplate } from '@crosscode/contracts';
import type { Ctx } from '../context.js';
import { churchProfile } from '../church/profile.js';
import { withGeo } from '../church/geocode.js';
import { buildPalette, type Palette } from './palette.js';
import { buildSnapshot, framed, imageOf, mediaUrl, publishedSnapshot, type Image, type Snapshot } from './snapshot.js';
import { headerIsTransparent, TEMPLATE_STYLE, type Variant } from './variants.js';
@@ -156,13 +157,13 @@ async function liveEvents(ctx: Ctx): Promise<SiteEvent[]> {
/** What visitors see: the latest published version, else Coming soon. */
export async function siteContent(ctx: Ctx): Promise<SiteContent> {
const [church, published] = await Promise.all([churchProfile(ctx), publishedSnapshot(ctx)]);
const [church, published] = await Promise.all([churchProfile(ctx).then((c) => withGeo(ctx, c)), publishedSnapshot(ctx)]);
return contentFrom(ctx, church, published);
}
/** The preview (§4): the working copy as it would look published, whatever was published before. */
export async function previewContent(ctx: Ctx, opts: { asTemplate?: WebsiteTemplate } = {}): Promise<SiteContent> {
const [church, snapshot] = await Promise.all([churchProfile(ctx), buildSnapshot(ctx, opts)]);
const [church, snapshot] = await Promise.all([churchProfile(ctx).then((c) => withGeo(ctx, c)), buildSnapshot(ctx, opts)]);
return contentFrom(ctx, church, { number: 0, publishedAt: ctx.now(), snapshot });
}