Website 1.6.0: real photos for the demo church, photos sized to their frames
The demo church (and the eight demo profiles) used one generated "hills and sun" SVG for every picture. Now 104 Unsplash stock photos (models; free under the Unsplash License, credited in backend/demo-photos/CREDITS.md): a set per profile, a portrait for every leader (before: only the pastor), a picture for each event, and a photo for each message instead of the stand-in video's thumbnail. Demo photos go through processImage like an upload, made once per machine and copied; without demo-photos/ the illustration still stands in. A message's thumbnailUrl that is one of the site's own uploads now comes before the YouTube thumbnail; admins and the YouTube feed store YouTube's address there, so a church's own messages are unchanged. Faster on phones: the Community collage hero, the collage row, the team's portraits and the ministry cards give the browser their real width (sizes), so a phone no longer fetches the full-width photo for a small frame. Checked: backend tests (131), Website e2e (130, baselines retaken; Lighthouse mobile 90-98 performance, 100 accessibility and SEO), typecheck, lint and both builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ import { websiteTemplateSchema } from '@crosscode/contracts';
|
||||
import { PrismaClient } from '../backend/src/generated/prisma/client.js';
|
||||
import { createApp } from '../backend/src/app.js';
|
||||
import { createCtx } from '../backend/src/context.js';
|
||||
import { illustration, loadDemo } from '../backend/src/demo/demoChurch.js';
|
||||
import { DEMO_PHOTO_DIR, loadDemo } from '../backend/src/demo/demoChurch.js';
|
||||
import { loadConfig } from '../backend/src/lib/config.js';
|
||||
import { hashToken } from '../backend/src/lib/crypto.js';
|
||||
import { publish } from '../backend/src/site/snapshot.js';
|
||||
@@ -56,9 +56,9 @@ async function freshPostgres(url: string) {
|
||||
// A frozen clock (a Monday morning), so the demo's dates, and so the screenshots, are the same every
|
||||
// run (variants.spec.ts). E2E_NOW changes it.
|
||||
const frozen = new Date(process.env.E2E_NOW ?? '2026-11-23T06:00:00Z');
|
||||
// YouTube's thumbnails (site/thumbnails.ts) without the network: one of the demo's illustrations,
|
||||
// as a JPEG the size of YouTube's, for every video.
|
||||
const thumb = await sharp(Buffer.from(illustration(4, 480, 360))).jpeg().toBuffer();
|
||||
// YouTube's thumbnails (site/thumbnails.ts) without the network: one of the demo's photos, as a
|
||||
// JPEG the size of YouTube's, for every video.
|
||||
const thumb = await sharp(path.join(DEMO_PHOTO_DIR, 'congregation-warm.webp')).resize(480, 360, { fit: 'cover' }).jpeg().toBuffer();
|
||||
const fakeYoutube = async (url: string) => url.startsWith('https://i.ytimg.com/')
|
||||
? new Response(new Uint8Array(thumb), { headers: { 'content-type': 'image/jpeg' } })
|
||||
: new Response('not here', { status: 404 });
|
||||
|
||||
@@ -70,7 +70,9 @@ test("the messages ask nothing of YouTube until play is clicked; their thumbnail
|
||||
page.on("request", (r) => { if (/youtube|ytimg|spotify/.test(new URL(r.url()).hostname)) outside.push(r.url()); });
|
||||
await page.goto("/messages");
|
||||
const thumb = page.locator("main img").first();
|
||||
await expect(thumb).toHaveAttribute("src", /^\/api\/thumbnails\/[\w-]+\.jpg$/);
|
||||
// The demo's messages have photos of their own (uploads); a church's show their YouTube video's
|
||||
// thumbnail, served from /api/thumbnails/ (backend tests). Either way, from the site.
|
||||
await expect(thumb).toHaveAttribute("src", /^\/api\/(thumbnails\/[\w-]+\.jpg|uploads\/demo\/[\w-]+\.webp)$/);
|
||||
await expect.poll(() => thumb.evaluate((i: HTMLImageElement) => i.naturalWidth)).toBeGreaterThan(0);
|
||||
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
Reference in New Issue
Block a user