Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .claude/rules/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ Every denormalisation, banned field type used anyway, and hand-written database

| Object | Kind | Reason | Migration |
| --- | --- | --- | --- |
| None yet | | | |
| `calendar_doors_day_range_check` | CHECK constraint | A door's day is 1 to 24 for direct SQL too | `20261112_232323_calendar_checks` |
| `calendar_settings_opens_at_hour_range_check` | CHECK constraint | The opening hour is 0 to 23 for direct SQL too | `20261112_232323_calendar_checks` |
33 changes: 32 additions & 1 deletion docs/admin-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,38 @@ Sign in with your own `@clarksbowlingclub.com` address and password. Every accou
| Tour dates | The gigs on `/tour` | Date and venue are required. Links must start with `https://`. The site works out which dates are upcoming and which are past |
| Music items | The players on `/music` | Pick the type (YouTube, Spotify, Bandcamp) and paste the player link from that site. The category is written in both languages. Drag the rows to change their order |
| Lyrics | The songs on `/lyrics` | A song shows on the site only when its status is `published` and it has lyrics. Keep unfinished songs as `draft`. Drag the rows to change their order |
| Media | Images | Not used on a page yet |
| Calendar doors | The 24 doors of `/calendrier` | One entry per door: the day (1 to 24), a title, a note and the MP3 |
| Calendar settings | The look and behaviour of `/calendrier` | Colours, fonts, texts, images, year and opening hour |
| Media | Images | Used for the calendar's background, share picture and door pictures |

## The advent calendar (`/calendrier`)

### Upload or replace a demo

1. Open **Calendar doors** and press **Create new**, or open the door you want to change.
2. Choose the **Day** (1 to 24), type the **Title** and an optional **Note**, then drop the MP3 on the upload box. Fill the title and note in both languages with the `en` / `fr` switch.
3. Press **Save**. To replace a demo, open its door, remove the old file with the cross, drop the new MP3 and save. Visitors hear the new one straight away.

A demo is private: visitors can only play it on or after its day, and no link to the file works before that. Each door also has an optional **Color** and **Image**; leave them empty for the default look.

### Change a title or any text

Open **Calendar settings**, go to **Texts**, switch to `fr` or `en` and type. A field left empty shows the grey default. `{year}` in the date range and footer becomes the year set under **Behaviour**.

### Colours, fonts, images

- **Colors** has the five named colours. Each has a picker and a text box; the text must be a colour such as `#a23c20`, otherwise the form refuses to save. Every orange, brown and cream on the page follows these five, so change one and the whole page follows.
- **Door colors** is the repeating list of door colours. Leave it empty for the defaults.
- **Fonts** has three lists: the title, the second title line and the body text. Pick a font and save.
- **Images** takes an optional page background and a share picture used when the link is posted on social networks. Upload them in **Media** first.

### Hide the calendar, change the year or the hour

Under **Behaviour**: **Visible** starts unticked, so visitors get a holding page until you tick it and save; you stay able to see everything either way. **Year** and **Opens at hour** (Paris time) decide when each door opens. **After 24 December** chooses between keeping every door open and showing the holding page.

### Check the preview

Sign in at `/admin`, then open `/calendrier` in the same browser. A **Mode test** button appears: press it to open all 24 doors and play any demo, whatever the date.

## Switching language

Expand Down
1 change: 1 addition & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const nextConfig: NextConfig = {
return {
beforeFiles: [
{ source: "/admin/:path*", destination: "/nope" },
{ source: "/calendrier", destination: "/nope" },
{
source: "/api/:path((?!send-emails$).*)",
destination: "/nope",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@payloadcms/db-postgres": "3.93.0",
"@payloadcms/next": "3.93.0",
"@payloadcms/storage-s3": "3.93.0",
"@payloadcms/ui": "3.93.0",
"clsx": "^2.1.1",
"focus-trap-react": "^12.0.3",
"graphql": "^16.15.0",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions src/app/(calendar)/calendrier/_page/markup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import type { Messages } from "./messages";

const escapeHtml = (value: string) =>
value
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");

const masthead = (m: Messages) => `
<header class="masthead">
<span class="brand">Clark’s Bowling Club</span>
<button type="button" id="sound" class="sound" aria-pressed="true">${escapeHtml(m.soundOn)}</button>
</header>`;

const heading = (m: Messages) => `
<h1 id="title">${escapeHtml(m.title)} <em>${escapeHtml(m.accentLine)}</em></h1>`;

export const holdingMarkup = (m: Messages) => `
<main>
<header class="masthead"><span class="brand">Clark’s Bowling Club</span></header>
<section class="hero" aria-labelledby="title">${heading(m)}
<p class="intro">${escapeHtml(m.holding)}</p>
</section>
<footer>${escapeHtml(m.footer)}</footer>
</main>`;

export const calendarMarkup = (m: Messages) => `
<main>${masthead(m)}
<section class="hero" aria-labelledby="title">
<p class="label">${escapeHtml(m.dateRange)}</p>${heading(m)}
<p class="intro">${escapeHtml(m.intro)}</p>
</section>
<div id="preview-tools" class="preview-tools" hidden>
<button type="button" id="preview-toggle" aria-pressed="false">${escapeHtml(m.previewToggle)}</button>
<button type="button" id="preview-reset" hidden>${escapeHtml(m.previewReset)}</button>
<span id="preview-note" hidden>${escapeHtml(m.previewNote)}</span>
</div>
<p id="status" role="status">${escapeHtml(m.loading)}</p>
<div class="grid" id="calendar" aria-label="${escapeHtml(m.gridLabel)}"></div>
<noscript>${escapeHtml(m.noscript)}</noscript>
<footer>${escapeHtml(m.footer)}</footer>
</main>
<dialog class="portrait-dialog" id="portrait" aria-labelledby="portrait-title">
<div class="portrait-screen" id="portrait-screen">
<section class="portrait-stage">
<button type="button" class="portrait-close" id="portrait-close" aria-label="${escapeHtml(m.portraitClose)}" autofocus>×</button>
<p class="portrait-kicker">Clark’s Bowling Club</p>
<button type="button" class="portrait-record" id="portrait-record" aria-label="${escapeHtml(m.portraitPlay)}">
<span class="portrait-vinyl" aria-hidden="true"><span class="portrait-label">CBC</span></span>
</button>
<div class="portrait-info">
<p class="portrait-day" id="portrait-day"></p>
<h2 id="portrait-title"></h2>
<p class="portrait-description" id="portrait-description" hidden></p>
</div>
</section>
</div>
</dialog>`;
83 changes: 83 additions & 0 deletions src/app/(calendar)/calendrier/_page/messages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import type { CalendarLocale, TextName } from "@/lib/calendar/defaults";

/** Page text that is not editable in the admin. {braces} are filled in by the page script. */
const fixed = {
fr: {
portraitDay: "{day} décembre · Calendrier de Clark’s",
portraitClose: "Quitter le mode portrait",
portraitPlay: "Écouter le morceau",
portraitPause: "Mettre le morceau en pause",
month: "Déc.",
door: "Case {day} décembre",
doorOpen: "Ouvrir la case {day} décembre",
doorOpened: "Case {day} décembre ouverte",
closeTitle: "Refermer la case",
closeDoor: "Refermer la case {day} décembre",
upcoming: " · à venir",
preparing: " · en préparation",
play: "Écouter {title} · case {day}",
pause: "Mettre en pause {title} · case {day}",
downloadLabel: "Télécharger {title}",
tapToPlay: "Appuie sur la case pour lancer le morceau.",
playFailed: "Ce morceau n’a pas pu être lu.",
loading: "Chargement du calendrier…",
loadingPreview: "Chargement de l’aperçu…",
previewToggle: "Mode test",
previewReset: "Réinitialiser les cases",
previewNote: "Aperçu privé réservé au groupe",
testTitle: "Case de test",
testNote: "Aucun morceau pour cette case.",
previewReady:
"Mode test actif. Les 24 cases sont disponibles dans cet aperçu.",
first: "La première case s’ouvrira le 1ᵉʳ décembre.",
over: "Les 24 jours de l’Avent sont passés.",
ongoing: "Les cases s’ouvrent au fil des jours.",
resetDone: "Cases de test réinitialisées. Tu peux les rouvrir.",
unavailable: "Le calendrier est momentanément indisponible.",
previewUnavailable: "Le mode test est momentanément indisponible.",
gridLabel: "Les 24 cases du calendrier",
noscript: "Activez JavaScript pour ouvrir les cases et écouter les morceaux.",
},
en: {
portraitDay: "December {day} · Clark’s Advent calendar",
portraitClose: "Leave portrait mode",
portraitPlay: "Play the track",
portraitPause: "Pause the track",
month: "Dec.",
door: "Door {day} December",
doorOpen: "Open door {day} December",
doorOpened: "Door {day} December opened",
closeTitle: "Close the door",
closeDoor: "Close door {day} December",
upcoming: " · coming up",
preparing: " · in preparation",
play: "Play {title} · door {day}",
pause: "Pause {title} · door {day}",
downloadLabel: "Download {title}",
tapToPlay: "Tap the door to start the track.",
playFailed: "This track could not be played.",
loading: "Loading the calendar…",
loadingPreview: "Loading the preview…",
previewToggle: "Test mode",
previewReset: "Reset the doors",
previewNote: "Private preview for the band",
testTitle: "Test door",
testNote: "No track for this door yet.",
previewReady: "Test mode on. All 24 doors are available in this preview.",
first: "The first door opens on 1 December.",
over: "All 24 days of Advent have passed.",
ongoing: "The doors open day by day.",
resetDone: "Test doors reset. You can open them again.",
unavailable: "The calendar is temporarily unavailable.",
previewUnavailable: "Test mode is temporarily unavailable.",
gridLabel: "The 24 doors of the calendar",
noscript: "Turn on JavaScript to open the doors and play the tracks.",
},
} as const satisfies Record<CalendarLocale, Record<string, string>>;

export type Messages = Record<keyof (typeof fixed)["fr"] | TextName, string>;

export const getMessages = (
locale: CalendarLocale,
texts: Record<TextName, string>
): Messages => ({ ...fixed[locale], ...texts });
2 changes: 2 additions & 0 deletions src/app/(calendar)/calendrier/_page/openingSound.ts

Large diffs are not rendered by default.

Loading
Loading