website 1.0.1: thumbnails from the site, Calendar dates
- The messages' YouTube thumbnails are served from the site (/api/thumbnails/<id>.jpg): the backend fetches a message's thumbnail once and keeps it in uploads/.thumbnails (only the site's own videos, only a JPEG), so visitors ask nothing of YouTube before pressing play. The messages page preloads the first one (its LCP: Heritage 89 -> 95). - Calendar events' dates read "Sun · November", not "Sun (month: November)". - e2e: no request to YouTube or Spotify before play; the variant screenshots round section heights to whole pixels (a one-pixel flake); the e2e thumbnail is one of the demo's illustrations. - crosscode script: a Website's export leaves out uploads/.thumbnails. - docs: release checks on 1.0.1, VERSIONS, handover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/website-frontend",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"private": true,
|
||||
"description": "Church Website: the church's public site in its template, and the admin",
|
||||
"scripts": {
|
||||
|
||||
@@ -4,7 +4,8 @@ import { useState } from "react";
|
||||
|
||||
/**
|
||||
* A message's video or audio, loaded only when clicked (WEBSITE-1.0-PLAN §7): a thumbnail first,
|
||||
* then youtube-nocookie or Spotify's player. Nothing loads from YouTube or Spotify until then.
|
||||
* then youtube-nocookie or Spotify's player. Nothing loads from YouTube or Spotify until then: the
|
||||
* thumbnail is served by the site (`/api/thumbnails/<id>.jpg`, backend site/thumbnails.ts).
|
||||
*/
|
||||
/** `priority`: the first thing on screen (the messages page's first message), so its thumbnail isn't lazy (it's the LCP image). */
|
||||
export function MessagePlayer({ title, embedUrl, thumbnail, url, source, className, priority }: { title: string; embedUrl: string | null; thumbnail: string | null; url: string; source: "youtube" | "spotify"; className?: string; priority?: boolean }) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* A page other than home (WEBSITE-1.0-PLAN §6): its title, what its kind lists (ministries,
|
||||
* leaders, events, messages, contact details), then its blocks.
|
||||
*/
|
||||
import { preconnect } from "react-dom";
|
||||
import { preload } from "react-dom";
|
||||
import { MessagePlayer } from "./MessagePlayer";
|
||||
import { t } from "./load";
|
||||
import { cx, DateBadge, dayName, fmtDate, Img, Paragraphs } from "./parts";
|
||||
@@ -70,10 +70,10 @@ function Listing({ page, site }: { page: Page; site: Published }) {
|
||||
</section>
|
||||
);
|
||||
case "messages": {
|
||||
// The first thumbnail is the largest thing on screen (Lighthouse's LCP): connect to its host
|
||||
// straight away rather than once the HTML has been read.
|
||||
// The first thumbnail is the largest thing on screen (Lighthouse's LCP): ask for it from the
|
||||
// <head>, rather than once the HTML has been read. Thumbnails come from the site itself.
|
||||
const thumb = site.messages[0]?.thumbnail;
|
||||
if (thumb?.startsWith("https://")) preconnect(new URL(thumb).origin);
|
||||
if (thumb) preload(thumb, { as: "image", fetchPriority: "high" });
|
||||
return (
|
||||
<section className="cc-section">
|
||||
<div className="cc-wrap grid gap-10 sm:grid-cols-2">
|
||||
|
||||
@@ -90,7 +90,7 @@ export function messagesLd(site: Published, messages: SiteMessage[]): string | n
|
||||
const description = [m.speaker, m.passage, m.series].filter(Boolean).join(" · ") || m.title;
|
||||
return m.source === "spotify"
|
||||
? { "@type": "PodcastEpisode", name: m.title, datePublished: m.date.slice(0, 10), description, url: m.url }
|
||||
: { "@type": "VideoObject", name: m.title, uploadDate: m.date, description, ...(m.thumbnail ? { thumbnailUrl: [m.thumbnail] } : {}), ...(m.embedUrl ? { embedUrl: m.embedUrl.replace("?autoplay=1", "") } : {}), contentUrl: m.url };
|
||||
: { "@type": "VideoObject", name: m.title, uploadDate: m.date, description, ...(m.thumbnail ? { thumbnailUrl: [abs(site, m.thumbnail)] } : {}), ...(m.embedUrl ? { embedUrl: m.embedUrl.replace("?autoplay=1", "") } : {}), contentUrl: m.url };
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -301,7 +301,8 @@ function Events(p: SectionProps) {
|
||||
{list.map((e) => (
|
||||
<li key={e.url + e.startsAt} className="cc-card w-64 shrink-0 snap-start p-5">
|
||||
<p className="font-heading text-4xl font-bold cc-brand-text">{fmtDate(e.startsAt, zone, { day: "numeric" })}</p>
|
||||
<p className="cc-eyebrow">{fmtDate(e.startsAt, zone, { month: "long", weekday: "short" })}</p>
|
||||
{/* A weekday and month without a day is "Sun (month: November)" to Intl: two parts. */}
|
||||
<p className="cc-eyebrow">{fmtDate(e.startsAt, zone, { weekday: "short" })} · {fmtDate(e.startsAt, zone, { month: "long" })}</p>
|
||||
<h3 className="cc-h3 mt-3"><a href={e.url} className="no-underline hover:underline">{e.title}</a></h3>
|
||||
{!e.allDay && <p className="cc-muted text-sm">{fmtTime(e.startsAt, zone)}</p>}
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user