Milestone 0/1: shell, calendar/psalter/hours scaffold, Prime
Deploy / deploy (push) Failing after 1m8s
Deploy / deploy (push) Failing after 1m8s
Client-side-first PWA (Vite/TS, no backend) per the approved plan: day- navigable shell listing all 8 hours, Prime fully resolves via the calendar -> psalter -> ordo pipeline, the other 7 hours are registered but flagged not-implemented. Sanctoral/temporal calendar data uses a day -> id indirection layer (saints, easter-offsets, fixed-date-calendar) so reassigning a feast to a different day is a data edit, not a code change. Docker (Caddy-serving-static) + Gitea CI workflow scaffolded to match the eec/drip/bookshop operational pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { getState, setLanguages, type AppState } from '../app-state';
|
||||
|
||||
// Hardcoded to en/la since those are the only languages with any data so
|
||||
// far. The two-language ceiling (never three+ columns) is the real
|
||||
// constraint per the plan; the specific set of offered languages is
|
||||
// expected to grow independently of that.
|
||||
const OPTIONS: { label: string; languages: AppState['languages'] }[] = [
|
||||
{ label: 'English', languages: ['en'] },
|
||||
{ label: 'Latin', languages: ['la'] },
|
||||
{ label: 'English + Latin', languages: ['en', 'la'] },
|
||||
];
|
||||
|
||||
export function renderLanguageToggle(container: HTMLElement): void {
|
||||
const { languages } = getState();
|
||||
const current = languages.join('+');
|
||||
|
||||
container.innerHTML = `
|
||||
<div class="language-toggle" role="group" aria-label="Display language">
|
||||
${OPTIONS.map((opt) => {
|
||||
const isActive = opt.languages.join('+') === current;
|
||||
return `<button type="button" class="lang-btn${isActive ? ' is-active' : ''}" data-langs="${opt.languages.join(',')}">${opt.label}</button>`;
|
||||
}).join('')}
|
||||
</div>
|
||||
`;
|
||||
|
||||
container.querySelectorAll<HTMLButtonElement>('[data-langs]').forEach((btn) => {
|
||||
btn.addEventListener('click', () => {
|
||||
const langs = btn.dataset.langs!.split(',') as AppState['languages'];
|
||||
setLanguages(langs);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { getState, shiftDate, goToToday } from '../app-state';
|
||||
import { formatDateLong } from './format';
|
||||
|
||||
export function renderDayNav(container: HTMLElement): void {
|
||||
const { date } = getState();
|
||||
container.innerHTML = `
|
||||
<nav class="day-nav" aria-label="Day navigation">
|
||||
<button type="button" class="day-nav-btn" data-action="prev" aria-label="Previous day">←</button>
|
||||
<button type="button" class="day-nav-btn day-nav-today" data-action="today">Today</button>
|
||||
<span class="day-nav-date">${formatDateLong(date)}</span>
|
||||
<button type="button" class="day-nav-btn" data-action="next" aria-label="Next day">→</button>
|
||||
</nav>
|
||||
`;
|
||||
container.querySelector('[data-action="prev"]')?.addEventListener('click', () => shiftDate(-1));
|
||||
container.querySelector('[data-action="next"]')?.addEventListener('click', () => shiftDate(1));
|
||||
container.querySelector('[data-action="today"]')?.addEventListener('click', () => goToToday());
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/** Formats an ISO date as e.g. "Sunday, August 9, 2026" — always in UTC so
|
||||
* it matches calendar/weekday.ts's interpretation regardless of the
|
||||
* viewer's local timezone. */
|
||||
export function formatDateLong(isoDate: string): string {
|
||||
const date = new Date(`${isoDate}T00:00:00Z`);
|
||||
return new Intl.DateTimeFormat('en-US', {
|
||||
weekday: 'long',
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
timeZone: 'UTC',
|
||||
}).format(date);
|
||||
}
|
||||
|
||||
export function hourLabel(hourId: string): string {
|
||||
return hourId.charAt(0).toUpperCase() + hourId.slice(1);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { getState, setSelectedHour } from '../app-state';
|
||||
import { HOUR_IDS, resolveOrdo, type HourId } from '../hours';
|
||||
import { hourLabel } from './format';
|
||||
|
||||
export function renderHourList(container: HTMLElement): void {
|
||||
const { date, selectedHour } = getState();
|
||||
|
||||
const items = HOUR_IDS.map((hourId) => {
|
||||
const ordo = resolveOrdo(hourId, date);
|
||||
const isSelected = hourId === selectedHour;
|
||||
const isReady = !ordo.notImplemented;
|
||||
return `
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
class="hour-item${isSelected ? ' is-selected' : ''}${isReady ? '' : ' is-pending'}"
|
||||
data-hour="${hourId}"
|
||||
aria-current="${isSelected ? 'true' : 'false'}"
|
||||
>
|
||||
<span class="hour-name">${hourLabel(hourId)}</span>
|
||||
${isReady ? '' : '<span class="hour-status">coming soon</span>'}
|
||||
</button>
|
||||
</li>
|
||||
`;
|
||||
}).join('');
|
||||
|
||||
container.innerHTML = `<ul class="hour-list">${items}</ul>`;
|
||||
|
||||
container.querySelectorAll<HTMLButtonElement>('[data-hour]').forEach((btn) => {
|
||||
btn.addEventListener('click', () => {
|
||||
setSelectedHour(btn.dataset.hour as HourId);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import { getState } from '../app-state';
|
||||
import { resolveOrdo } from '../hours';
|
||||
import type { ResolvedPart, ResolvedText, ResolvedVerse } from '../hours/types';
|
||||
import { hourLabel } from './format';
|
||||
|
||||
function escapeHtml(value: string): string {
|
||||
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
}
|
||||
|
||||
function cellFor(resolved: ResolvedText | ResolvedVerse, lang: string): string {
|
||||
const status = resolved.status[lang] ?? 'missing';
|
||||
const text = resolved.text[lang];
|
||||
if (status === 'missing' || !text) {
|
||||
return '<span class="text-pending">(translation pending)</span>';
|
||||
}
|
||||
const escaped = escapeHtml(text);
|
||||
return status === 'draft' ? `<span class="text-draft" title="unverified draft text">${escaped}</span>` : escaped;
|
||||
}
|
||||
|
||||
function renderColumns(resolved: ResolvedText | ResolvedVerse, languages: readonly string[]): string {
|
||||
const cols = languages
|
||||
.map((lang) => `<div class="lang-column" lang="${lang}">${cellFor(resolved, lang)}</div>`)
|
||||
.join('');
|
||||
return `<div class="lang-columns lang-columns-${languages.length}">${cols}</div>`;
|
||||
}
|
||||
|
||||
function renderPart(part: ResolvedPart, languages: readonly string[]): string {
|
||||
switch (part.kind) {
|
||||
case 'hymn':
|
||||
case 'chapter':
|
||||
case 'responsory':
|
||||
case 'versicle':
|
||||
case 'prayer':
|
||||
return `
|
||||
<section class="ordo-part ordo-part-${part.kind}">
|
||||
<h3 class="ordo-part-label">${hourLabel(part.kind)}</h3>
|
||||
${renderColumns(part.text, languages)}
|
||||
</section>
|
||||
`;
|
||||
case 'psalm':
|
||||
return `
|
||||
<section class="ordo-part ordo-part-psalm">
|
||||
<h3 class="ordo-part-label">Psalm ${part.psalmNumber}</h3>
|
||||
${part.antiphon ? renderColumns(part.antiphon, languages) : ''}
|
||||
<ol class="psalm-verses">
|
||||
${part.verses.map((v) => `<li class="psalm-verse">${renderColumns(v, languages)}</li>`).join('')}
|
||||
</ol>
|
||||
</section>
|
||||
`;
|
||||
case 'canticle':
|
||||
return `
|
||||
<section class="ordo-part ordo-part-canticle">
|
||||
<h3 class="ordo-part-label">Canticle</h3>
|
||||
${part.antiphon ? renderColumns(part.antiphon, languages) : ''}
|
||||
</section>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
export function renderHourView(container: HTMLElement): void {
|
||||
const { date, selectedHour, languages } = getState();
|
||||
const ordo = resolveOrdo(selectedHour, date);
|
||||
|
||||
if (ordo.notImplemented) {
|
||||
container.innerHTML = `
|
||||
<div class="hour-view hour-view-pending">
|
||||
<h2>${hourLabel(selectedHour)}</h2>
|
||||
<p>This hour hasn't been built yet.</p>
|
||||
</div>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
container.innerHTML = `
|
||||
<div class="hour-view">
|
||||
<h2>${hourLabel(selectedHour)}</h2>
|
||||
${ordo.parts.map((part) => renderPart(part, languages)).join('')}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { subscribe } from '../app-state';
|
||||
import { renderDayNav } from './day-nav';
|
||||
import { renderHourList } from './hour-list';
|
||||
import { renderHourView } from './hour-view';
|
||||
import { renderLanguageToggle } from './bilingual-toggle';
|
||||
|
||||
export function mountShell(root: HTMLElement): void {
|
||||
root.innerHTML = `
|
||||
<header class="site-header">
|
||||
<span class="site-title">vu</span>
|
||||
<div data-slot="language-toggle"></div>
|
||||
</header>
|
||||
<div data-slot="day-nav"></div>
|
||||
<main id="main" class="app-main">
|
||||
<nav data-slot="hour-list" class="hour-list-nav" aria-label="Hours"></nav>
|
||||
<div data-slot="hour-view" class="hour-view-region"></div>
|
||||
</main>
|
||||
`;
|
||||
|
||||
const dayNavEl = root.querySelector<HTMLElement>('[data-slot="day-nav"]');
|
||||
const hourListEl = root.querySelector<HTMLElement>('[data-slot="hour-list"]');
|
||||
const hourViewEl = root.querySelector<HTMLElement>('[data-slot="hour-view"]');
|
||||
const languageToggleEl = root.querySelector<HTMLElement>('[data-slot="language-toggle"]');
|
||||
if (!dayNavEl || !hourListEl || !hourViewEl || !languageToggleEl) {
|
||||
throw new Error('shell markup is missing an expected slot');
|
||||
}
|
||||
|
||||
function render(): void {
|
||||
renderDayNav(dayNavEl!);
|
||||
renderHourList(hourListEl!);
|
||||
renderHourView(hourViewEl!);
|
||||
renderLanguageToggle(languageToggleEl!);
|
||||
}
|
||||
|
||||
render();
|
||||
subscribe(render);
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
/* ==========================================================================
|
||||
vu — design tokens adapted from michaelferrara-site's parchment/ink/oxblood
|
||||
palette and EB Garamond/Source Serif 4/Inter type system (the "most me"
|
||||
existing site, per the plan). Same technical pattern as reground-site and
|
||||
michaelferrara-site: CSS custom properties, prefers-color-scheme dark mode,
|
||||
a skip-link, explicit :focus-visible rings.
|
||||
========================================================================== */
|
||||
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
|
||||
--color-bg: #f7f3ea;
|
||||
--color-bg-raised: #efe9db;
|
||||
--color-ink: #2a2521;
|
||||
--color-ink-heading: #1c1712;
|
||||
--color-accent: #7a2e2e;
|
||||
--color-accent-hover: #5c2222;
|
||||
--color-brass: #8c7a5b;
|
||||
--color-border: #ddd3bd;
|
||||
--color-pending: #9a8f7d;
|
||||
|
||||
--font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
|
||||
--font-heading: 'EB Garamond', 'Palatino Linotype', Georgia, serif;
|
||||
--font-ui: 'Inter', 'IBM Plex Sans', -apple-system, sans-serif;
|
||||
|
||||
--font-size-base: 19px;
|
||||
--line-height-base: 1.65;
|
||||
--measure: 70ch;
|
||||
--radius: 4px;
|
||||
|
||||
--space-1: 0.5rem;
|
||||
--space-2: 1rem;
|
||||
--space-3: 1.75rem;
|
||||
--space-4: 3rem;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
/* Matins and Compline get used in the dark far more than a marketing
|
||||
site ever would — this needs to be a good reading mode, not just
|
||||
present. */
|
||||
--color-bg: #1a1613;
|
||||
--color-bg-raised: #24201b;
|
||||
--color-ink: #e9e2d4;
|
||||
--color-ink-heading: #f5efe2;
|
||||
--color-accent: #d98a8a;
|
||||
--color-accent-hover: #e6a6a6;
|
||||
--color-brass: #b3a483;
|
||||
--color-border: #3a332a;
|
||||
--color-pending: #7d7364;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background-color: var(--color-bg);
|
||||
color: var(--color-ink);
|
||||
font-family: var(--font-body);
|
||||
font-size: var(--font-size-base);
|
||||
line-height: var(--line-height-base);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
font-family: var(--font-heading);
|
||||
color: var(--color-ink-heading);
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
button {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.skip-link {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
background: var(--color-accent);
|
||||
color: var(--color-bg);
|
||||
padding: var(--space-1) var(--space-2);
|
||||
border-radius: 0 0 var(--radius) 0;
|
||||
}
|
||||
.skip-link:focus {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
a:focus-visible,
|
||||
button:focus-visible {
|
||||
outline: 2px solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Header + language toggle
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
.site-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2) var(--space-2);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
font-family: var(--font-ui);
|
||||
}
|
||||
|
||||
.site-title {
|
||||
font-family: var(--font-heading);
|
||||
font-size: 1.4rem;
|
||||
color: var(--color-ink-heading);
|
||||
}
|
||||
|
||||
.language-toggle {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.lang-btn {
|
||||
font-family: var(--font-ui);
|
||||
font-size: 0.8rem;
|
||||
padding: 0.35rem 0.7rem;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius);
|
||||
background: var(--color-bg-raised);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.lang-btn.is-active {
|
||||
background: var(--color-accent);
|
||||
color: var(--color-bg);
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Day nav
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
.day-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2);
|
||||
font-family: var(--font-ui);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.day-nav-btn {
|
||||
border: 1px solid var(--color-border);
|
||||
background: var(--color-bg-raised);
|
||||
border-radius: var(--radius);
|
||||
padding: 0.4rem 0.75rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.day-nav-date {
|
||||
font-weight: 600;
|
||||
min-width: 16rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Layout: hour list + hour view
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
.app-main {
|
||||
display: grid;
|
||||
grid-template-columns: 12rem 1fr;
|
||||
gap: var(--space-3);
|
||||
max-width: 64rem;
|
||||
margin: 0 auto;
|
||||
padding: var(--space-3) var(--space-2);
|
||||
}
|
||||
|
||||
@media (max-width: 40rem) {
|
||||
.app-main {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.hour-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: var(--font-ui);
|
||||
}
|
||||
|
||||
.hour-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
padding: 0.6rem 0.75rem;
|
||||
border: none;
|
||||
background: none;
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
.hour-item:hover {
|
||||
background: var(--color-bg-raised);
|
||||
}
|
||||
|
||||
.hour-item.is-selected {
|
||||
background: var(--color-accent);
|
||||
color: var(--color-bg);
|
||||
}
|
||||
|
||||
.hour-item.is-pending {
|
||||
color: var(--color-pending);
|
||||
}
|
||||
|
||||
.hour-item.is-selected.is-pending {
|
||||
color: var(--color-bg);
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.hour-status {
|
||||
font-size: 0.7rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
.hour-view-region {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.hour-view-pending p {
|
||||
color: var(--color-pending);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Ordo parts + bilingual columns
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
.ordo-part {
|
||||
margin-bottom: var(--space-3);
|
||||
}
|
||||
|
||||
.ordo-part-label {
|
||||
font-size: 1rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--color-brass);
|
||||
font-family: var(--font-ui);
|
||||
margin: 0 0 var(--space-1);
|
||||
}
|
||||
|
||||
.psalm-verses {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.psalm-verse {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
/* One-language vs two-language layout — the real display-width ceiling from
|
||||
the plan: never more than two columns, regardless of how many languages
|
||||
eventually have data. */
|
||||
.lang-columns-1 {
|
||||
max-width: var(--measure);
|
||||
}
|
||||
|
||||
.lang-columns-2 {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
@media (max-width: 40rem) {
|
||||
.lang-columns-2 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.lang-column[lang='la'] {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.text-pending {
|
||||
color: var(--color-pending);
|
||||
font-style: italic;
|
||||
font-family: var(--font-ui);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.text-draft {
|
||||
border-bottom: 1px dashed var(--color-brass);
|
||||
}
|
||||
|
||||
@media print {
|
||||
body {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
.site-header,
|
||||
.day-nav,
|
||||
.hour-list-nav,
|
||||
.language-toggle {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user