Accessibility, event photo and analytics (v1.12.0-accessibility) #25
14 changed files with 69 additions and 15 deletions
|
|
@ -61,6 +61,8 @@ export const events = {
|
|||
text("event_logo"),
|
||||
text("color"),
|
||||
text("card_image"),
|
||||
text("photo"),
|
||||
text("photo_alt"),
|
||||
bool("is_published"),
|
||||
bool("is_listed"),
|
||||
bool("in_timeline"),
|
||||
|
|
|
|||
20
server/src/migrations/061_event_photo.sql
Normal file
20
server/src/migrations/061_event_photo.sql
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 061 EVENTS: EVENT PHOTO
|
||||
--
|
||||
-- An event's own 16:9 photo, shown whole: at the top of its page, as
|
||||
-- the front page's featured event, on featured cards, in newsletter
|
||||
-- picks and as its page's share preview. photo_alt says what it
|
||||
-- shows, for screen readers (blank: decoration).
|
||||
--
|
||||
-- card_image (029) goes back to being only the faded background of
|
||||
-- the event's card, which crops it to the card's shape. Until now it
|
||||
-- did both jobs, so each event's photo starts as its card
|
||||
-- background, to keep the front page and previews as they were.
|
||||
--
|
||||
-- v_events selects e.*, so it carries the new columns as it is.
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
ALTER TABLE events ADD COLUMN photo TEXT;
|
||||
ALTER TABLE events ADD COLUMN photo_alt TEXT;
|
||||
|
||||
UPDATE events SET photo = card_image WHERE card_image IS NOT NULL;
|
||||
|
|
@ -199,7 +199,7 @@ function eventMeta(site, db, id, meta) {
|
|||
|
||||
const when = [row.date_label, row.location_label].filter(Boolean).join(" · ");
|
||||
const image =
|
||||
imageUrl(site, row.card_image, "eventBackground") ??
|
||||
imageUrl(site, row.photo, "eventPhoto") ??
|
||||
imageUrl(site, row.event_logo, "eventLogo") ??
|
||||
imageUrl(site, row.effective_org_logo, "organization") ??
|
||||
meta.image;
|
||||
|
|
|
|||
|
|
@ -150,6 +150,8 @@ function shapeEvent(row, links, cardBlocks, hosts = []) {
|
|||
event_logo: row.event_logo,
|
||||
color: row.effective_color,
|
||||
card_image: row.card_image,
|
||||
photo: row.photo,
|
||||
photo_alt: row.photo_alt,
|
||||
|
||||
hosts: hosts.map(shapeHost),
|
||||
|
||||
|
|
|
|||
|
|
@ -87,14 +87,15 @@ function statValue(db, row) {
|
|||
}
|
||||
|
||||
/* The countdown's fields plus what the hero's event card also draws:
|
||||
its tagline, place, card background and buttons. */
|
||||
its tagline, place, photo and buttons. */
|
||||
function shapeHeroEvent(db, row) {
|
||||
if (!row) return null;
|
||||
const { actions } = splitLinks(loadLinks(db, "event", [row.id]).get(row.id) ?? []);
|
||||
return {
|
||||
...shapeCountdown(row),
|
||||
tagline: row.tagline,
|
||||
card_image: row.card_image,
|
||||
photo: row.photo,
|
||||
photo_alt: row.photo_alt,
|
||||
org_logo: row.effective_org_logo,
|
||||
links: actions,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -369,6 +369,8 @@ tx(db, () => {
|
|||
event_logo: IMAGE,
|
||||
color: "#d62976",
|
||||
card_image: IMAGE,
|
||||
photo: IMAGE,
|
||||
photo_alt: "The showcase test image",
|
||||
is_published: 1,
|
||||
is_listed: LISTED,
|
||||
in_timeline: LISTED,
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ export function shapeSeries(row) {
|
|||
`image` is { file, kind }, like the timeline's logo: the record
|
||||
tables keep bare filenames in different public/ directories,
|
||||
and logoForKind in media.ts knows which is which. The kinds are
|
||||
the ref kinds, plus 'event-background' and 'featured' (the
|
||||
the ref kinds, plus 'event-photo' and 'featured' (the
|
||||
card's own image). An unpublished
|
||||
record's card is dropped; an unlisted one's stays, since
|
||||
featuring it is attaching it by hand.
|
||||
|
|
@ -213,11 +213,11 @@ const FEATURED_REFS = {
|
|||
event: {
|
||||
sql: (marks) =>
|
||||
`SELECT id, title, tagline AS blurb, date_label AS eyebrow,
|
||||
card_image, event_logo
|
||||
photo, event_logo
|
||||
FROM events WHERE is_published = 1 AND id IN (${marks})`,
|
||||
image: (row) =>
|
||||
row.card_image
|
||||
? { file: row.card_image, kind: "event-background" }
|
||||
row.photo
|
||||
? { file: row.photo, kind: "event-photo" }
|
||||
: row.event_logo
|
||||
? { file: row.event_logo, kind: "event" }
|
||||
: null,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import { useSmallImage } from '../lib/useSmallImage.ts'
|
|||
|
||||
/* Image kinds that are photographs, drawn edge to edge. Anything
|
||||
else is a logo, drawn whole. */
|
||||
const PHOTO_KINDS = new Set(['event-background', 'featured', 'person'])
|
||||
const PHOTO_KINDS = new Set(['event-photo', 'featured', 'person'])
|
||||
|
||||
function hrefFor(card: FeaturedCard): string | null {
|
||||
if (card.kind === 'record' && card.ref) {
|
||||
|
|
|
|||
|
|
@ -147,13 +147,27 @@ export const events = {
|
|||
{ path: "event_logo", label: "Event logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true },
|
||||
{ path: "org_logo", label: "Org logo override", widget: "image", folder: "logos", resolve: mediaUrl, full: true },
|
||||
{ path: "color", label: "Color", widget: "color" },
|
||||
{
|
||||
path: "photo",
|
||||
label: "Event photo",
|
||||
widget: "image",
|
||||
resolve: mediaUrl,
|
||||
full: true,
|
||||
help: "16:9, eg. 1920 x 1080, shown whole: at the top of the event's page, as the front page's featured event, on featured cards, in the newsletter and when the page is shared.",
|
||||
},
|
||||
{
|
||||
path: "photo_alt",
|
||||
label: "Photo description",
|
||||
full: true,
|
||||
help: "What the photo shows, for people who can't see it, eg. Campers around the fire at the 2025 retreat. Default: none (read as decoration).",
|
||||
},
|
||||
{
|
||||
path: "card_image",
|
||||
label: "Card background",
|
||||
widget: "image",
|
||||
resolve: mediaUrl,
|
||||
full: true,
|
||||
help: "A photo behind the event's card, faded so the text stays readable.",
|
||||
help: "Only behind the event's card, faded so the text stays readable and cropped to the card's shape (about square). Keep the subject centered and leave words out.",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -133,8 +133,11 @@ export type EventRecord = {
|
|||
org_logo?: string | null
|
||||
event_logo?: string | null
|
||||
color?: string | null
|
||||
/** Behind the card. See 029_event_card_image.sql. */
|
||||
/** Behind the card only, cropped. See 029_event_card_image.sql. */
|
||||
card_image?: string | null
|
||||
/** The event's own 16:9 photo, shown whole. See 061_event_photo.sql. */
|
||||
photo?: string | null
|
||||
photo_alt?: string | null
|
||||
/* In billing order. The first is the one `color` and `org_logo`
|
||||
fell back to when the event set neither. */
|
||||
hosts: EventHost[]
|
||||
|
|
|
|||
|
|
@ -111,7 +111,8 @@ export type FeaturedCard = {
|
|||
/** The countdown's event plus what the hero's event card draws. */
|
||||
export type HeroEvent = CountdownEvent & {
|
||||
tagline?: string | null
|
||||
card_image?: string | null
|
||||
photo?: string | null
|
||||
photo_alt?: string | null
|
||||
org_logo?: string | null
|
||||
links: Link[]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,15 @@ export default function EventDetail() {
|
|||
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
||||
<Facts event={event} accent={accent} />
|
||||
|
||||
{/* The event's own 16:9 photo (not the card's background). */}
|
||||
{event.photo && (
|
||||
<img
|
||||
src={mediaUrl(event.photo) ?? ''}
|
||||
alt={event.photo_alt ?? ''}
|
||||
className="aspect-video w-full max-w-3xl object-cover"
|
||||
/>
|
||||
)}
|
||||
|
||||
{event.description.map((paragraph, index) => (
|
||||
<p key={index} className="leading-relaxed max-w-3xl" style={{ color: BODY }}>
|
||||
{paragraph}
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ export default function AdminNewsletter() {
|
|||
.filter(Boolean)
|
||||
.join(', '),
|
||||
text: event.tagline ?? event.description?.[0] ?? null,
|
||||
image: imageFor(event.card_image),
|
||||
image: imageFor(event.photo),
|
||||
href: siteUrl(eventHref(event.id)),
|
||||
cta: PICK_DEFAULTS.events.cta,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ function VideoFrame({
|
|||
it's usually Register. */
|
||||
function EventPanel({ event }: { event: HeroEvent }) {
|
||||
const color = event.color || 'var(--color-action)'
|
||||
const photo = mediaUrl(event.card_image)
|
||||
const photo = mediaUrl(event.photo)
|
||||
const when = seriesLabel(event.series, event.starts_on) ?? event.date_label
|
||||
const where = event.is_online && !event.location_label ? 'Online' : event.location_label
|
||||
|
||||
|
|
@ -473,11 +473,11 @@ function EventPanel({ event }: { event: HeroEvent }) {
|
|||
style={{ boxShadow: '0 24px 48px -24px rgba(0, 16, 17, 0.6)' }}
|
||||
>
|
||||
{photo ? (
|
||||
<img src={photo} alt="" className="aspect-[16/7] w-full object-cover" />
|
||||
<img src={photo} alt={event.photo_alt ?? ''} className="aspect-video w-full object-cover" />
|
||||
) : (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="aspect-[16/7] w-full"
|
||||
className="aspect-video w-full"
|
||||
style={{ background: `color-mix(in srgb, ${color} 35%, #001011)` }}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue