Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ba755145d | ||
|
|
6be1a2782d |
@@ -65,6 +65,11 @@
|
||||
added twice; one from the feed can only be hidden (deleting it would bring it back).
|
||||
- **Simple events** (§8): date and time or all day, place, description, photo and an optional
|
||||
link; publish, cancel, remove. Both publish on their own, not with the site (decision 9).
|
||||
- **Photos made safe and fast** (§3): every upload is turned upright, **stripped of its metadata**
|
||||
(a phone photo can carry where it was taken), kept at most 2400 px wide, and saved at 480, 960
|
||||
and 1600 px in WebP and JPEG; the pages pick the size the screen needs (`<picture>`, `srcset`).
|
||||
Every file counts towards storage; a photo the library can't read is refused. (sharp 0.35:
|
||||
prebuilt binaries, no build step on the servers.)
|
||||
- The admin page signs people in and out; `/auth/problem` explains a refused sign-in.
|
||||
- **The church's export** (`scripts/export-church.ts`): `export.json` in
|
||||
`crosscode.church-export/1` with its `website` part, for `crosscode export` and uninstall.
|
||||
|
||||
@@ -10,7 +10,7 @@ presses Publish; until the first publish visitors see Coming soon.
|
||||
**State:** being built (2026-11-25): signing in through Accounts, the four templates and the public
|
||||
site, the admin (editing, preview, publish, discard, restore, shared previews, media), and the demo
|
||||
church, people and roles, messages (with the YouTube feed) and simple events. Still to come:
|
||||
responsive image sizes, the event feed with Cross Events, the Hub's "Get more storage", Lighthouse
|
||||
the event feed with Cross Events, the Hub's "Get more storage", Lighthouse
|
||||
and the VM test. Not released;
|
||||
`website@1.0.0` is tagged when the plan is built.
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"@prisma/client": "^7.10.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^5.3.0",
|
||||
"sharp": "^0.35.5",
|
||||
"zod": "^4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
* `limits.storageBytes` says more once extra storage is bought. **When it's full, uploads stop**
|
||||
* (decision 12) until more is bought; what's already uploaded keeps showing.
|
||||
*
|
||||
* Responsive sizes (WebP and JPEG per width) come next; for now the file is served as uploaded.
|
||||
* Every photo is turned upright and **stripped of its metadata** (a phone photo can carry the place
|
||||
* it was taken), kept at most 2400 px wide, and saved in responsive sizes (WebP and JPEG at 480,
|
||||
* 960 and 1600 px wide, each smaller than the photo), all counted towards storage (§3).
|
||||
*/
|
||||
import crypto from 'node:crypto';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import sharp, { type Metadata, type Sharp } from 'sharp';
|
||||
import type { Ctx } from '../context.js';
|
||||
import { defaultUploadDir } from '../demo/demoChurch.js';
|
||||
import { INCLUDED_STORAGE_BYTES } from '../hub/client.js';
|
||||
@@ -82,11 +85,63 @@ export async function upload(ctx: Ctx, body: Buffer, alt: string, by: string) {
|
||||
throw new ApiError(409, 'STORAGE_FULL', 'Your website\'s storage is full, so uploads have stopped. To get more (5 GB at a time), contact Cross Code; everything already uploaded keeps showing.');
|
||||
}
|
||||
const now = ctx.now();
|
||||
const rel = `${now.getUTCFullYear()}/${String(now.getUTCMonth() + 1).padStart(2, '0')}/${crypto.randomUUID()}.${kind.ext}`;
|
||||
const file = path.join(uploadDir(ctx), rel);
|
||||
await fs.mkdir(path.dirname(file), { recursive: true });
|
||||
await fs.writeFile(file, body, { mode: 0o644 });
|
||||
const { width, height } = dimensions(body, kind);
|
||||
const row = await ctx.db.mediaAsset.create({ data: { filename: rel, mime: kind.mime, bytes: body.length, width, height, alt: alt.trim().slice(0, 500), uploadedBy: by } });
|
||||
const base = `${now.getUTCFullYear()}/${String(now.getUTCMonth() + 1).padStart(2, '0')}/${crypto.randomUUID()}`;
|
||||
const dir = uploadDir(ctx);
|
||||
await fs.mkdir(path.join(dir, path.dirname(base)), { recursive: true });
|
||||
const made = await processImage(body, kind, path.join(dir, base));
|
||||
const bytes = made.files.reduce((t, f) => t + f.bytes, 0);
|
||||
if (s.usedBytes + bytes > s.limitBytes) {
|
||||
await Promise.all(made.files.map((f) => fs.rm(path.join(dir, path.dirname(base), f.name), { force: true })));
|
||||
throw new ApiError(409, 'STORAGE_FULL', 'That photo doesn\'t fit in the storage that\'s left, so it wasn\'t added. To get more (5 GB at a time), contact Cross Code.');
|
||||
}
|
||||
const filename = `${base}.${made.main.ext}`;
|
||||
const row = await ctx.db.mediaAsset.create({
|
||||
data: { filename, mime: made.main.mime, bytes, width: made.width, height: made.height, alt: alt.trim().slice(0, 500), sizes: made.sizes as never, uploadedBy: by },
|
||||
});
|
||||
return { ...row, url: mediaUrl(row.filename) };
|
||||
}
|
||||
|
||||
export const MAX_WIDTH = 2400;
|
||||
export const WIDTHS = [480, 960, 1600] as const;
|
||||
|
||||
export type Sizes = { w: number; webp: string; jpg: string }[];
|
||||
|
||||
/**
|
||||
* The photo as kept (upright, no metadata, at most MAX_WIDTH wide, in its own format) and its
|
||||
* responsive sizes, written next to `basePath` (`<base>.<ext>`, `<base>-<w>.webp`, `<base>-<w>.jpg`).
|
||||
* A photo the library can't read is refused rather than kept as uploaded.
|
||||
*/
|
||||
export async function processImage(body: Buffer, kind: Kind, basePath: string) {
|
||||
let img: Sharp;
|
||||
let meta: Metadata;
|
||||
try {
|
||||
img = sharp(body, { failOn: 'error' }).rotate();
|
||||
meta = await img.metadata();
|
||||
} catch {
|
||||
throw new ApiError(415, 'NOT_AN_IMAGE', 'That photo can\'t be read. Save it again as JPEG, PNG or WebP and try again.');
|
||||
}
|
||||
// After rotate(), width and height follow the EXIF orientation.
|
||||
const swap = (meta.orientation ?? 1) >= 5;
|
||||
const fullW = (swap ? meta.height : meta.width) ?? dimensions(body, kind).width ?? MAX_WIDTH;
|
||||
const fullH = (swap ? meta.width : meta.height) ?? dimensions(body, kind).height ?? null;
|
||||
const width = Math.min(fullW, MAX_WIDTH);
|
||||
const height = fullH ? Math.round((fullH * width) / fullW) : null;
|
||||
const name = path.basename(basePath);
|
||||
const files: { name: string; bytes: number }[] = [];
|
||||
const write = async (pipeline: Sharp, file: string) => {
|
||||
const info = await pipeline.toFile(path.join(path.dirname(basePath), file));
|
||||
files.push({ name: file, bytes: info.size });
|
||||
};
|
||||
// sharp writes no metadata unless asked (withMetadata), so EXIF, GPS and XMP are gone.
|
||||
const main = kind.ext === 'png' ? { ext: 'png', mime: 'image/png' } : kind.ext === 'webp' ? { ext: 'webp', mime: 'image/webp' } : { ext: 'jpg', mime: 'image/jpeg' };
|
||||
const resized = () => img.clone().resize({ width, withoutEnlargement: true });
|
||||
await write(main.ext === 'png' ? resized().png({ compressionLevel: 9 }) : main.ext === 'webp' ? resized().webp({ quality: 82 }) : resized().jpeg({ quality: 82, mozjpeg: true }), `${name}.${main.ext}`);
|
||||
const sizes: Sizes = [];
|
||||
for (const w of WIDTHS) {
|
||||
if (w >= width) continue;
|
||||
await write(img.clone().resize({ width: w }).webp({ quality: 78 }), `${name}-${w}.webp`);
|
||||
await write(img.clone().resize({ width: w }).flatten({ background: '#ffffff' }).jpeg({ quality: 80, mozjpeg: true }), `${name}-${w}.jpg`);
|
||||
sizes.push({ w, webp: `${name}-${w}.webp`, jpg: `${name}-${w}.jpg` });
|
||||
}
|
||||
return { main, width, height, sizes, files };
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TEMPLATE_FONT_PAIRINGS, type Church, type CrosscodeEvent, type WebsiteT
|
||||
import type { Ctx } from '../context.js';
|
||||
import { churchProfile } from '../church/profile.js';
|
||||
import { buildPalette, type Palette } from './palette.js';
|
||||
import { buildSnapshot, mediaUrl, publishedSnapshot, type Image, type Snapshot } from './snapshot.js';
|
||||
import { buildSnapshot, imageOf, publishedSnapshot, type Image, type Snapshot } from './snapshot.js';
|
||||
import { headerIsTransparent, TEMPLATE_STYLE, type Variant } from './variants.js';
|
||||
|
||||
export type SiteEvent = {
|
||||
@@ -112,7 +112,7 @@ async function liveEvents(ctx: Ctx): Promise<SiteEvent[]> {
|
||||
]);
|
||||
const image = (id: string | null) => {
|
||||
const m = id ? media.find((x) => x.id === id) : null;
|
||||
return m ? { url: mediaUrl(m.filename), alt: m.alt, width: m.width, height: m.height } : null;
|
||||
return m ? imageOf(m) : null;
|
||||
};
|
||||
const own: SiteEvent[] = simple.map((e) => ({
|
||||
title: e.title, summary: e.description ? e.description.slice(0, 200) : null, startsAt: e.startsAt.toISOString(), endsAt: e.endsAt?.toISOString() ?? null,
|
||||
|
||||
@@ -15,7 +15,10 @@ import { defaultDesign, isVariant, SECTION_TYPES, type SectionType, type SiteDes
|
||||
|
||||
export const SNAPSHOT_VERSION = 1;
|
||||
|
||||
export type Image = { url: string; alt: string; width: number | null; height: number | null };
|
||||
/** An image to show: the photo, and its responsive sizes as `srcset`s when it has them (§3). */
|
||||
export type Image = { url: string; alt: string; width: number | null; height: number | null; srcset?: { webp: string; jpg: string } };
|
||||
|
||||
type MediaRow = { id: string; filename: string; alt: string; width: number | null; height: number | null; sizes?: unknown };
|
||||
|
||||
export type SnapshotSection = { type: string; variant: string | null; data: Record<string, unknown> };
|
||||
|
||||
@@ -47,6 +50,18 @@ export type Snapshot = {
|
||||
|
||||
export const mediaUrl = (filename: string) => `/api/uploads/${filename.split('/').map(encodeURIComponent).join('/')}`;
|
||||
|
||||
/** A media row as an Image, with `srcset`s from its sizes and the photo itself as the widest. */
|
||||
export function imageOf(m: MediaRow): Image {
|
||||
const img: Image = { url: mediaUrl(m.filename), alt: m.alt, width: m.width, height: m.height };
|
||||
const sizes = Array.isArray(m.sizes) ? (m.sizes as { w: number; webp: string; jpg: string }[]) : [];
|
||||
if (sizes.length && m.width) {
|
||||
const dir = m.filename.includes('/') ? m.filename.slice(0, m.filename.lastIndexOf('/') + 1) : '';
|
||||
const set = (key: 'webp' | 'jpg') => [...sizes.map((x) => `${mediaUrl(dir + x[key])} ${x.w}w`), `${img.url} ${m.width}w`].join(', ');
|
||||
img.srcset = { webp: set('webp'), jpg: set('jpg') };
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
/** The design as saved, made safe: an unknown template, variant or section falls back to the default. */
|
||||
export function cleanDesign(saved: { template: string; variants: unknown; home: unknown; style: unknown } | null): SiteDesign {
|
||||
const template: WebsiteTemplate = saved && (WEBSITE_TEMPLATES as readonly string[]).includes(saved.template) ? (saved.template as WebsiteTemplate) : 'heritage';
|
||||
@@ -107,8 +122,8 @@ export async function buildSnapshot(ctx: Ctx): Promise<Snapshot> {
|
||||
return snapshotFrom(toSource(w), media);
|
||||
}
|
||||
|
||||
export function snapshotFrom(source: Source, media: { id: string; filename: string; alt: string; width: number | null; height: number | null }[]): Snapshot {
|
||||
const images = new Map(media.map((m) => [m.id, { url: mediaUrl(m.filename), alt: m.alt, width: m.width, height: m.height } satisfies Image]));
|
||||
export function snapshotFrom(source: Source, media: MediaRow[]): Snapshot {
|
||||
const images = new Map(media.map((m) => [m.id, imageOf(m)]));
|
||||
const image = (id: string | null | undefined) => (id ? images.get(id) ?? null : null);
|
||||
const used: Record<string, Image> = {};
|
||||
const collect = (data: unknown) => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import request from 'supertest';
|
||||
import sharp from 'sharp';
|
||||
import { loadDemo } from '../src/demo/demoChurch.js';
|
||||
import { hashToken } from '../src/lib/crypto.js';
|
||||
import { dimensions, sniff } from '../src/admin/media.js';
|
||||
@@ -181,17 +182,45 @@ describe('uploads and storage (§10, decision 12)', () => {
|
||||
assert.equal(sniff(Buffer.from('<svg>')), null);
|
||||
});
|
||||
|
||||
it('stores an upload, refuses what isn\'t a photo, and stops when storage is full', async () => {
|
||||
const { as, db, dir } = await signedIn('editor');
|
||||
const up = await as.upload('/media?alt=The%20hall', png);
|
||||
it('keeps a photo upright and without its location, in responsive sizes; refuses what isn\'t one', async () => {
|
||||
const { as, dir, app } = await signedIn('editor');
|
||||
// A 2000 × 1200 phone photo with its GPS position in the metadata.
|
||||
const photo = await sharp({ create: { width: 2000, height: 1200, channels: 3, background: '#1d5c63' } })
|
||||
.jpeg().withExifMerge({ IFD3: { GPSLatitudeRef: 'S', GPSLatitude: '25/1 44/1 46/1' } }).toBuffer();
|
||||
assert.ok((await sharp(photo).metadata()).exif, 'the test photo has EXIF');
|
||||
const up = await as.upload('/media?alt=The%20hall', photo);
|
||||
assert.equal(up.status, 200);
|
||||
assert.equal(up.body.width, 640);
|
||||
assert.ok(fs.existsSync(path.join(dir, up.body.filename)));
|
||||
const notPhoto = await as.upload('/media', Buffer.from('<svg onload=alert(1)>'));
|
||||
assert.equal(notPhoto.status, 415);
|
||||
// Full: the media library already holds the included 5 GB.
|
||||
assert.equal(up.body.width, 2000);
|
||||
assert.deepEqual(up.body.sizes.map((x: { w: number }) => x.w), [480, 960, 1600]);
|
||||
const file = path.join(dir, up.body.filename);
|
||||
assert.equal((await sharp(fs.readFileSync(file)).metadata()).exif, undefined, 'no metadata kept');
|
||||
const files = fs.readdirSync(path.dirname(file));
|
||||
assert.equal(files.length, 7, 'the photo and 3 sizes in WebP and JPEG');
|
||||
const total = files.reduce((t, n) => t + fs.statSync(path.join(path.dirname(file), n)).size, 0);
|
||||
assert.equal(up.body.bytes, total, 'every file counts towards storage');
|
||||
|
||||
// The site gets srcsets.
|
||||
const about = (await as.get('/pages')).body.find((p: { kind: string }) => p.kind === 'about').id;
|
||||
await as.put(`/pages/${about}`, { imageId: up.body.id });
|
||||
await as.post('/publish');
|
||||
const content = (await request(app).get('/api/v1/site/content')).body;
|
||||
const img = content.snapshot.pages.find((p: { kind: string }) => p.kind === 'about').image;
|
||||
assert.match(img.srcset.webp, /-480\.webp 480w, .*-960\.webp 960w, .*-1600\.webp 1600w, .*\.jpg 2000w$/);
|
||||
|
||||
const big = await sharp({ create: { width: 4000, height: 3000, channels: 3, background: '#e0a458' } }).png().toBuffer();
|
||||
const b = await as.upload('/media', big);
|
||||
assert.equal(b.body.width, 2400, 'kept at most 2400 wide');
|
||||
assert.equal(b.body.height, 1800);
|
||||
assert.equal((await as.upload('/media', Buffer.from('<svg onload=alert(1)>'))).status, 415);
|
||||
assert.equal((await as.upload('/media', png)).status, 415, 'a PNG header with nothing behind it');
|
||||
});
|
||||
|
||||
it('stops uploads when storage is full', async () => {
|
||||
const { as, db } = await signedIn('editor');
|
||||
const photo = await sharp({ create: { width: 800, height: 600, channels: 3, background: '#ffffff' } }).jpeg().toBuffer();
|
||||
// The media library already holds the included 5 GB.
|
||||
await db.mediaAsset.create({ data: { filename: 'big.jpg', mime: 'image/jpeg', bytes: 5 * 1024 ** 3 } });
|
||||
const full = await as.upload('/media', png);
|
||||
const full = await as.upload('/media', photo);
|
||||
assert.equal(full.status, 409);
|
||||
assert.equal(full.body.error.code, 'STORAGE_FULL');
|
||||
assert.equal((await as.get('/media')).body.storage.full, true);
|
||||
|
||||
@@ -3,13 +3,26 @@ import type { Image } from "./types";
|
||||
|
||||
export const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(" ");
|
||||
|
||||
/**
|
||||
* An uploaded image at the size the screen needs (§3: responsive sizes in WebP and JPEG): the
|
||||
* browser picks from the `srcset`s by `sizes`. `alt` overrides the image's own (e.g. "" when it's
|
||||
* only decoration behind text).
|
||||
*/
|
||||
export function Picture({ image, className, sizes = "100vw", priority = false, alt }: { image: Image; className?: string; sizes?: string; priority?: boolean; alt?: string }) {
|
||||
const img = (
|
||||
<img src={image.url} srcSet={image.srcset?.jpg} sizes={image.srcset ? sizes : undefined} alt={alt ?? image.alt}
|
||||
width={image.width ?? undefined} height={image.height ?? undefined}
|
||||
loading={priority ? "eager" : "lazy"} fetchPriority={priority ? "high" : undefined} decoding="async" className={className} />
|
||||
);
|
||||
return image.srcset ? <picture><source type="image/webp" srcSet={image.srcset.webp} sizes={sizes} />{img}</picture> : img;
|
||||
}
|
||||
|
||||
/** An image in a frame (Heritage frames, duotone tints), or a soft placeholder when there's none. */
|
||||
export function Img({ image, className, sizes = "(min-width: 768px) 50vw, 100vw", priority = false, ratio = "aspect-[4/3]" }: { image: Image | null; className?: string; sizes?: string; priority?: boolean; ratio?: string }) {
|
||||
return (
|
||||
<div className={cx("cc-frame", ratio, className)}>
|
||||
{image ? (
|
||||
<img src={image.url} alt={image.alt} sizes={sizes} width={image.width ?? undefined} height={image.height ?? undefined}
|
||||
loading={priority ? "eager" : "lazy"} fetchPriority={priority ? "high" : undefined} decoding="async" className="cc-img" />
|
||||
<Picture image={image} sizes={sizes} priority={priority} className="cc-img" />
|
||||
) : (
|
||||
<div aria-hidden="true" className="h-full w-full bg-gradient-to-br from-brand/25 via-brand-tint to-accent/30" />
|
||||
)}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* photo.
|
||||
*/
|
||||
import { media } from "../load";
|
||||
import { Button, cx, Img, type ButtonData } from "../parts";
|
||||
import { Button, cx, Img, Picture, type ButtonData } from "../parts";
|
||||
import type { Image, SectionProps } from "../types";
|
||||
|
||||
type HeroData = { headline: string; subline: string | null; images: string[]; videoId: string | null; button: ButtonData };
|
||||
@@ -24,7 +24,7 @@ function Words({ d, centred, light, size = "cc-h1" }: { d: HeroData; centred?: b
|
||||
function Video({ video, still, className }: { video: Image | null; still: Image | null; className?: string }) {
|
||||
return (
|
||||
<div className={cx("relative h-full w-full", className)}>
|
||||
{still ? <img src={still.url} alt={still.alt} className="cc-img absolute inset-0" fetchPriority="high" /> : <div className="absolute inset-0 bg-brand" />}
|
||||
{still ? <Picture image={still} priority className="cc-img absolute inset-0" /> : <div className="absolute inset-0 bg-brand" />}
|
||||
{video && (
|
||||
<video className="cc-motion cc-img absolute inset-0 hidden sm:block" src={video.url} poster={still?.url} autoPlay muted loop playsInline aria-hidden="true" />
|
||||
)}
|
||||
@@ -79,7 +79,7 @@ export function Hero({ section, site, template }: SectionProps) {
|
||||
if (template === "bold") {
|
||||
return (
|
||||
<section className="cc-section-hero grid bg-gray-950 text-white md:min-h-[80vh] md:grid-cols-2">
|
||||
<div className="relative min-h-[50vh] md:order-2">{first && <img src={first.url} alt={first.alt} className="cc-img absolute inset-0" fetchPriority="high" />}</div>
|
||||
<div className="relative min-h-[50vh] md:order-2">{first && <Picture image={first} sizes="(min-width: 768px) 50vw, 100vw" priority className="cc-img absolute inset-0" />}</div>
|
||||
<div className="flex flex-col justify-center px-6 pb-16 pt-32 sm:px-12"><Words d={d} light /></div>
|
||||
</section>
|
||||
);
|
||||
@@ -100,7 +100,7 @@ export function Hero({ section, site, template }: SectionProps) {
|
||||
return (
|
||||
<Fullbleed d={d} site={site}>
|
||||
<div className="grid h-full grid-cols-3 gap-1">
|
||||
{three.map((im, i) => <div key={i} className="relative">{im ? <img src={im.url} alt={im.alt} className="cc-img absolute inset-0" /> : <div className="absolute inset-0 bg-brand/60" />}</div>)}
|
||||
{three.map((im, i) => <div key={i} className="relative">{im ? <Picture image={im} sizes="34vw" priority={i === 0} className="cc-img absolute inset-0" /> : <div className="absolute inset-0 bg-brand/60" />}</div>)}
|
||||
</div>
|
||||
</Fullbleed>
|
||||
);
|
||||
@@ -134,7 +134,7 @@ export function Hero({ section, site, template }: SectionProps) {
|
||||
}
|
||||
|
||||
// photo (and video, drawn the same way with its loop).
|
||||
const visual = variant === "video" ? <Video video={video} still={first} /> : first ? <img src={first.url} alt={first.alt} className="cc-img absolute inset-0" fetchPriority="high" /> : null;
|
||||
const visual = variant === "video" ? <Video video={video} still={first} /> : first ? <Picture image={first} priority className="cc-img absolute inset-0" /> : null;
|
||||
if (template === "bold") return <Fullbleed d={d} site={site}>{visual ?? <div className="h-full w-full bg-brand" />}</Fullbleed>;
|
||||
if (template === "heritage") {
|
||||
return (
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { MessagePlayer } from "../MessagePlayer";
|
||||
import { media, str, t } from "../load";
|
||||
import { Button, cx, DateBadge, dayName, fmtDate, fmtTime, Img, Paragraphs, SectionHeading, type ButtonData } from "../parts";
|
||||
import { Button, cx, DateBadge, dayName, fmtDate, fmtTime, Img, Paragraphs, Picture, SectionHeading, type ButtonData } from "../parts";
|
||||
import type { SectionProps, SiteEvent } from "../types";
|
||||
import { Hero } from "./Hero";
|
||||
|
||||
@@ -394,7 +394,7 @@ function Invitation(p: SectionProps) {
|
||||
const img = media(p.site, d.imageId);
|
||||
return (
|
||||
<section className="cc-section cc-own-bg cc-dark relative isolate overflow-hidden bg-gray-900 text-white">
|
||||
{img && <img src={img.url} alt="" className="cc-img absolute inset-0 -z-10" loading="lazy" />}
|
||||
{img && <Picture image={img} alt="" className="cc-img absolute inset-0 -z-10" />}
|
||||
<div className="absolute inset-0 -z-10 bg-black/60" aria-hidden="true" />
|
||||
<div className="cc-wrap py-10 text-center">
|
||||
<h2 className="cc-h2">{d.heading}</h2>
|
||||
|
||||
@@ -6,7 +6,8 @@ import type { Church } from "@crosscode/contracts";
|
||||
|
||||
export type Template = "heritage" | "bold" | "community" | "clean";
|
||||
|
||||
export type Image = { url: string; alt: string; width: number | null; height: number | null };
|
||||
/** An uploaded image; `srcset` lists its responsive sizes (WebP and JPEG) when it has them. */
|
||||
export type Image = { url: string; alt: string; width: number | null; height: number | null; srcset?: { webp: string; jpg: string } };
|
||||
|
||||
export type Section = { type: string; variant: string | null; data: Record<string, unknown> };
|
||||
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ out").
|
||||
[WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md): decisions all confirmed 2026-11-21. Font pairings
|
||||
confirmed 2026-11-24 (§3). Order: ~~contracts 1.17.0~~ → ~~Accounts 1.7.0~~ (both released 2026-11-24; Accounts
|
||||
ships with contracts because it answers the new `church.update`) → ~~Events 3.7.0~~ (shared fonts and footer; released 2026-11-24) → ~~Hub 2.21.0~~ (released
|
||||
and deployed 2026-11-25; the plan said 2.13.0) → **`website@1.0.0`** (being built in `apps/website` since 2026-11-25: signing in, the four templates and public site, the admin with preview, publish and restore, people and roles, messages with the YouTube feed, simple events; next: image sizes, the event feed, Get more storage, Lighthouse, the VM test) → Hope Family Church → a second
|
||||
and deployed 2026-11-25; the plan said 2.13.0) → **`website@1.0.0`** (being built in `apps/website` since 2026-11-25: signing in, the four templates and public site, the admin with preview, publish and restore, people and roles, messages with the YouTube feed, simple events, responsive photo sizes without metadata; next: the event feed, Get more storage, Lighthouse, the VM test) → Hope Family Church → a second
|
||||
church → crosscode-site 1.7.0.
|
||||
Done (confirmed by Joshua 2026-11-25): `hope-events` is archived, and every FastPanel site set up
|
||||
before Hub 2.10.0, and the Hub's own site, has `location ^~ /api/`.
|
||||
|
||||
Generated
+1
-4
@@ -367,6 +367,7 @@
|
||||
"@prisma/client": "^7.10.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^5.3.0",
|
||||
"sharp": "^0.35.5",
|
||||
"zod": "^4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -2053,7 +2054,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",
|
||||
"integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
@@ -10820,7 +10820,6 @@
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
|
||||
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -18907,7 +18906,6 @@
|
||||
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz",
|
||||
"integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@img/colour": "^1.1.0",
|
||||
"detect-libc": "^2.1.2",
|
||||
@@ -18957,7 +18955,6 @@
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz",
|
||||
"integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==",
|
||||
"license": "ISC",
|
||||
"optional": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user