app: announcements, devotionals and events' screens; @crosscode/seo 1.1.0 (APP-1.0-PLAN §5-§7)

Public pages: Home with today's devotional, the latest announcements (pinned
first) and what's on; Announcements and each one's page (markdown without
HTML, a button, Article JSON-LD; members-only ones ask for a sign-in and are
noindex); Devotional (the passage in full with its copyright line, Read in
YouVersion, the prayer), each day's page, the archive by month and the
Acknowledgements; Events and each one's page (Register on the Events site for
Cross Events', a canonical to the origin, Event JSON-LD on the App's own).
A sitemap of the public pages, named in robots.txt.

Admin: Announcements (schedule, end, pin, campus, who sees it, also send it),
Events (simple events, Linked products: publish and show events from), and
Devotionals (Cross Code's or our own, Sync now, a month's days, writing, the
CSV import with its preview, keep or replace days already filled).

@crosscode/seo 1.1.0: articleJsonLd. The backend gives the App's own address
and the sitemap's list, and a simple event's crosscode.event/1 for its page.

Checked in a browser on a throwaway PostgreSQL: the pages for a visitor, the
JSON-LD, a members-only announcement asking for a sign-in, the sitemap, a
Content admin publishing an announcement and a Devotional writer saving one;
no page errors. 94 backend tests, 19 seo tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 11:36:41 +02:00
co-authored by Claude Opus 5.5
parent a9079f1195
commit 0ac6827ddd
43 changed files with 1482 additions and 30 deletions
@@ -0,0 +1,60 @@
import Link from "next/link";
import { BookOpen, ExternalLink, MapPin, Pin } from "lucide-react";
import { dateTile, eventWhen, plain, type Announcement, type Devotional, type EventItem } from "@/lib/content";
import { truncate } from "@/lib/text";
/** An announcement in a list (Home, Announcements): pinned ones say so. */
export function AnnouncementCard({ a }: { a: Announcement }) {
return (
<Link href={`/announcements/${a.slug}`} className="cca-card block space-y-2 hover:border-brand">
{a.imageUrl && <img src={a.imageUrl} alt="" className="-mx-4 -mt-4 mb-2 h-36 w-[calc(100%+2rem)] max-w-none rounded-t-cc object-cover" />}
<div className="flex items-start justify-between gap-2">
<h3 className="cca-h2">{a.title}</h3>
{a.pinned && <Pin className="mt-1 h-4 w-4 shrink-0 text-brand-text" aria-label="Pinned" />}
</div>
<p className="cca-muted">{truncate(plain(a.body), 140)}</p>
{a.membersOnly && <p className="text-xs font-semibold text-gray-600">Members only</p>}
</Link>
);
}
/** One event in a list: the date tile, title, when and where, and where it comes from. */
export function EventCard({ e }: { e: EventItem }) {
const tile = dateTile(e.startsAt, e.timezone);
return (
<Link href={`/events/${e.key}`} className="cca-card flex gap-3 hover:border-brand">
<div className="flex h-14 w-14 shrink-0 flex-col items-center justify-center rounded-cc bg-brand-tint text-brand-text" aria-hidden>
<span className="text-xl font-semibold leading-none">{tile.day}</span>
<span className="text-xs font-semibold">{tile.month}</span>
</div>
<div className="min-w-0 space-y-0.5">
<h3 className={`font-semibold ${e.cancelled ? "line-through" : ""}`}>{e.title}</h3>
<p className="text-sm text-gray-700">{eventWhen(e)}</p>
{e.location && <p className="flex items-center gap-1 text-sm text-gray-600"><MapPin className="h-3.5 w-3.5" aria-hidden />{e.location}</p>}
{e.cancelled ? <p className="text-sm font-semibold text-red-700">Cancelled</p> : e.source === "events" && <p className="text-xs text-gray-500">Register on the Events site</p>}
</div>
</Link>
);
}
/** Home's devotional card: the title, the passage, the first lines. */
export function DevotionalCard({ d }: { d: Devotional }) {
return (
<Link href={d.today ? "/devotional" : `/devotional/${d.date}`} className="cca-card block space-y-2 hover:border-brand">
<p className="flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-brand-text"><BookOpen className="h-3.5 w-3.5" aria-hidden />{d.today ? "Today's devotional" : "The latest devotional"}</p>
<h2 className="cca-h2">{d.title}</h2>
<p className="text-sm font-medium text-gray-700">{d.passage.reference} ({d.passage.translation})</p>
<p className="cca-muted">{truncate(plain(d.passage.text), 140)}</p>
</Link>
);
}
/** "Register on the Events site" (or More info): a link out, never a registration here (§7). */
export function RegisterButton({ e }: { e: EventItem }) {
if (!e.registration || e.cancelled) return null;
return (
<a href={e.registration.url} className="cca-btn w-full" target="_blank" rel="noopener noreferrer">
{e.registration.label}<ExternalLink className="h-4 w-4" aria-hidden />
</a>
);
}