v1.14.2-present: event schedules, venues and map blocks, Present mode and its phone remote #33

Merged
ngu-git-admin merged 40 commits from event-schedule into main 2026-11-21 23:02:06 +00:00
8 changed files with 209 additions and 12 deletions
Showing only changes of commit b76f2a5707 - Show all commits

View file

@ -1,4 +1,4 @@
import { text, int, bool, date, time, enumeration, placeColumns, timelineExtension, linksChild, blocksChild, hostsChild } from "./columns.js"; import { text, int, real, bool, date, time, enumeration, placeColumns, timelineExtension, linksChild, blocksChild, hostsChild } from "./columns.js";
import { tagsChild } from "./tags.js"; import { tagsChild } from "./tags.js";
/* ── Events ──────────────────────────────────────────────────── */ /* ── Events ──────────────────────────────────────────────────── */
@ -77,6 +77,18 @@ export const events = {
text("present_accent"), text("present_accent"),
text("present_text_color"), text("present_text_color"),
text("present_logo"), text("present_logo"),
// The same in the dark theme (096), null the above.
text("present_background_dark"),
text("present_background_color_dark"),
int("present_dim_dark"),
text("present_accent_dark"),
text("present_text_color_dark"),
text("present_logo_dark"),
// Room clear at each edge, eg. inside a frame picture (097).
real("present_inset_top"),
real("present_inset_right"),
real("present_inset_bottom"),
real("present_inset_left"),
// A repeating schedule. Columns rather than a side table: the // A repeating schedule. Columns rather than a side table: the
// schedule is always exactly one per event, and the public view // schedule is always exactly one per event, and the public view

View file

@ -0,0 +1,24 @@
-- ═══════════════════════════════════════════════════════════════
-- 096 PRESENTATION SETTINGS IN THE DARK THEME
--
-- The same as 095's, for a screen in the dark theme (the device's
-- setting, or the setup's Theme pick). Each one null takes the
-- light theme's (095), so only what differs needs setting.
--
-- present_background_dark the image behind every slide
-- present_background_color_dark the slides' background color
-- present_dim_dark percent of the color over the
-- image, 0 to 90
-- present_accent_dark in place of the accent
-- present_text_color_dark the slides' text
-- present_logo_dark the bottom-right logo, eg. a
-- light version
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE events ADD COLUMN present_background_dark TEXT;
ALTER TABLE events ADD COLUMN present_background_color_dark TEXT;
ALTER TABLE events ADD COLUMN present_dim_dark INTEGER
CHECK (present_dim_dark BETWEEN 0 AND 90);
ALTER TABLE events ADD COLUMN present_accent_dark TEXT;
ALTER TABLE events ADD COLUMN present_text_color_dark TEXT;
ALTER TABLE events ADD COLUMN present_logo_dark TEXT;

View file

@ -0,0 +1,20 @@
-- ═══════════════════════════════════════════════════════════════
-- 097 PRESENTATION CONTENT INSET
--
-- Room kept clear at each edge of a presented slide, so its content
-- sits inside a background image that is a frame (eg. a 1920x1080
-- picture with a border drawn in it). Percent of the screen: top
-- and bottom of its height, left and right of its width, 0 to 45.
-- Null is 0. With any set, the background image is stretched to the
-- screen rather than cropped, so the frame stays where the inset
-- expects it. Both themes share them.
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE events ADD COLUMN present_inset_top REAL
CHECK (present_inset_top BETWEEN 0 AND 45);
ALTER TABLE events ADD COLUMN present_inset_right REAL
CHECK (present_inset_right BETWEEN 0 AND 45);
ALTER TABLE events ADD COLUMN present_inset_bottom REAL
CHECK (present_inset_bottom BETWEEN 0 AND 45);
ALTER TABLE events ADD COLUMN present_inset_left REAL
CHECK (present_inset_left BETWEEN 0 AND 45);

View file

@ -604,6 +604,24 @@ content.get("/events/:id", (c) => {
accent: row.present_accent, accent: row.present_accent,
text_color: row.present_text_color, text_color: row.present_text_color,
logo: row.present_logo, logo: row.present_logo,
// Room clear at each edge, percent of the screen (097).
inset: [row.present_inset_top, row.present_inset_right, row.present_inset_bottom, row.present_inset_left].some((n) => n)
? {
top: row.present_inset_top ?? 0,
right: row.present_inset_right ?? 0,
bottom: row.present_inset_bottom ?? 0,
left: row.present_inset_left ?? 0,
}
: null,
// In the dark theme (096); null takes the above.
dark: {
background: row.present_background_dark,
background_color: row.present_background_color_dark,
dim: row.present_dim_dark,
accent: row.present_accent_dark,
text_color: row.present_text_color_dark,
logo: row.present_logo_dark,
},
}, },
blocks: body, blocks: body,
people, people,

View file

@ -226,6 +226,17 @@ export const events = {
], ],
blankLabel: "Default: a bar on top, the title line and the timer", blankLabel: "Default: a bar on top, the title line and the timer",
}, },
...([
["top", "Inset top", "of the screen's height"],
["right", "Inset right", "of the screen's width"],
["bottom", "Inset bottom", "of the screen's height"],
["left", "Inset left", "of the screen's width"],
] as const).map(([side, label, of]) => ({
path: `present_inset_${side}`,
label,
widget: "number",
help: `Room kept clear at this edge, in percent ${of} (0 to 45), eg. to keep the slides inside a frame drawn in the background image. With any inset the image is stretched to the screen, not cropped. Default: 0.`,
})),
{ path: "present_accent", label: "Accent", widget: "color", help: "Default: the event's color" }, { path: "present_accent", label: "Accent", widget: "color", help: "Default: the event's color" },
{ {
path: "present_text_color", path: "present_text_color",
@ -244,6 +255,34 @@ export const events = {
}, },
], ],
}, },
{
legend: "Presentation, dark theme",
note: "For a screen in the dark theme (its own setting, or the Theme picked when presenting). Each one left blank uses the one above.",
fields: [
{
path: "present_background_dark",
label: "Background image",
widget: "image",
crop: "free",
resolve: mediaUrl,
full: true,
help: "Default: the background image above",
},
{ path: "present_background_color_dark", label: "Background color", widget: "color", help: "Default: the one above, else the site's dark background" },
{ path: "present_dim_dark", label: "Dim", widget: "number", help: "0 to 90 percent. Default: the one above" },
{ path: "present_accent_dark", label: "Accent", widget: "color", help: "Default: the accent above" },
{ path: "present_text_color_dark", label: "Text color", widget: "color", help: "Default: the one above" },
{
path: "present_logo_dark",
label: "Logo",
widget: "image",
folder: "logos",
resolve: mediaUrl,
full: true,
help: "eg. a light version of the logo. Default: the logo above",
},
],
},
timelineGroup("event"), timelineGroup("event"),
timelineDetailGroup("event"), timelineDetailGroup("event"),
{ legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] }, { legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] },

15
src/lib/darkTheme.ts Normal file
View file

@ -0,0 +1,15 @@
/* Whether the site is in its dark theme: <html data-theme="dark">,
set before the first paint (index.html) and by ThemeToggle. A
hook, so a page redraws the moment it changes. */
import { useSyncExternalStore } from 'react'
const read = () => document.documentElement.dataset.theme === 'dark'
function subscribe(onChange: () => void) {
const observer = new MutationObserver(onChange)
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] })
return () => observer.disconnect()
}
export const useDarkTheme = (): boolean => useSyncExternalStore(subscribe, read, () => false)

View file

@ -99,6 +99,11 @@ export type EventPresentLook = {
accent: string | null accent: string | null
text_color: string | null text_color: string | null
logo: string | null logo: string | null
/** Room clear at each edge (097): percent of the screen's height
* (top, bottom) and width (left, right); null none. */
inset?: { top: number; right: number; bottom: number; left: number } | null
/** In the dark theme (096); a null one takes the above. */
dark?: Partial<Omit<EventPresentLook, 'frame' | 'dark' | 'inset'>>
} }
export type MapSection = { name: string; keys: string[] } export type MapSection = { name: string; keys: string[] }

View file

@ -54,7 +54,9 @@
give its Presentation text, leave it out, and say how a map is give its Presentation text, leave it out, and say how a map is
shown. The blocks themselves are drawn for a screen (Presenting): shown. The blocks themselves are drawn for a screen (Presenting):
links as their text, people as round photos and names, links as their text, people as round photos and names,
organizations as their logos. their logos. In the dark theme the event's dark settings (096)
take the place of any they set (lookFor); the setup's Theme
(`theme=light|dark`) holds a screen in one theme while it plays.
Keys while playing: arrows step, Space pauses, Escape leaves full Keys while playing: arrows step, Space pauses, Escape leaves full
screen (the browser's), S goes back to the setup. screen (the browser's), S goes back to the setup.
@ -94,6 +96,7 @@ import {
import { mediaUrl } from '../lib/media.ts' import { mediaUrl } from '../lib/media.ts'
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts' import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
import { documentTitle } from '../lib/site.ts' import { documentTitle } from '../lib/site.ts'
import { useDarkTheme } from '../lib/darkTheme.ts'
import './EventPresent.css' import './EventPresent.css'
/* Each kind of slide, its address key and seconds when unset. */ /* Each kind of slide, its address key and seconds when unset. */
@ -126,6 +129,16 @@ const STARTS_SECTION = new Set(['heading', 'tab'])
const FILLER = new Set(['subheading', 'divider']) const FILLER = new Set(['subheading', 'divider'])
/* Percent of the background color over the background image, unset. */ /* Percent of the background color over the background image, unset. */
const DIM = 60 const DIM = 60
/* The themes a screen can be held in (`theme`). */
const THEMES = ['light', 'dark'] as const
/* The event's look in the theme shown: in the dark one, its dark
settings (096) over the light ones. */
function lookFor(look: EventPresentLook | undefined, dark: boolean): EventPresentLook | undefined {
if (!look || !dark || !look.dark) return look
const picked = Object.entries(look.dark).filter(([, value]) => value != null && value !== '')
return { ...look, ...Object.fromEntries(picked) }
}
/* Seconds a long slide takes to scroll one screenful, when unset. */ /* Seconds a long slide takes to scroll one screenful, when unset. */
const PER_SCREEN = 8 const PER_SCREEN = 8
@ -206,6 +219,7 @@ function readSettings(params: URLSearchParams) {
screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN, screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN,
only: params.get('only') || null, only: params.get('only') || null,
order: list(params.get('order')), order: list(params.get('order')),
theme: THEMES.find((theme) => theme === params.get('theme')) ?? null,
} }
} }
type Settings = ReturnType<typeof readSettings> type Settings = ReturnType<typeof readSettings>
@ -387,6 +401,19 @@ export default function EventPresent() {
if (event) document.title = documentTitle(`${event.title}: present`) if (event) document.title = documentTitle(`${event.title}: present`)
}, [event]) }, [event])
// The setup's Theme, while playing; the device's again after.
const held = params.get('play') === '1' ? params.get('theme') : null
useEffect(() => {
if (held !== 'light' && held !== 'dark') return
const root = document.documentElement
const was = root.dataset.theme
root.dataset.theme = held
return () => {
if (was) root.dataset.theme = was
}
}, [held])
const dark = useDarkTheme()
if (!event) { if (!event) {
return ( return (
<PageState <PageState
@ -401,7 +428,7 @@ export default function EventPresent() {
) )
} }
const look = event.present const look = lookFor(event.present, dark)
const accent = look?.accent || event.color || BRAND const accent = look?.accent || event.color || BRAND
const back = `/events/${encodeURIComponent(event.id)}` const back = `/events/${encodeURIComponent(event.id)}`
@ -452,6 +479,7 @@ export default function EventPresent() {
// Not 'tag': that's the tag slides' seconds. // Not 'tag': that's the tag slides' seconds.
if (next.only) out.set('only', next.only) if (next.only) out.set('only', next.only)
if (next.order?.length) out.set('order', next.order.join(',')) if (next.order?.length) out.set('order', next.order.join(','))
if (next.theme) out.set('theme', next.theme)
out.set('play', '1') out.set('play', '1')
setParams(out) setParams(out)
}} }}
@ -484,6 +512,7 @@ function Setup({
const [only, setOnly] = useState(settings.only) const [only, setOnly] = useState(settings.only)
const [screen, setScreen] = useState(settings.screen) const [screen, setScreen] = useState(settings.screen)
const [order, setOrder] = useState(settings.order) const [order, setOrder] = useState(settings.order)
const [theme, setTheme] = useState(settings.theme)
const [dragging, setDragging] = useState<number | null>(null) const [dragging, setDragging] = useState<number | null>(null)
const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only }), order) const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only }), order)
const count = slides.length const count = slides.length
@ -567,6 +596,28 @@ function Setup({
<p className="mt-2 text-sm text-muted">0 leaves that kind of slide out.</p> <p className="mt-2 text-sm text-muted">0 leaves that kind of slide out.</p>
</section> </section>
<section>
<h2 className="mb-4 text-2xl font-bold text-ink">Theme</h2>
<label className="flex flex-wrap items-center gap-4 bg-raised p-4 shadow-sm">
<span className="flex-1">
<span className="block font-semibold text-ink">Light or dark</span>
<span className="text-sm text-muted">
The slides in this theme whatever the screen is set to. The event's Presentation, dark theme settings
apply in the dark one.
</span>
</span>
<select
value={theme ?? ''}
onChange={(e) => setTheme(THEMES.find((t) => t === e.target.value) ?? null)}
className="border border-muted/25 bg-surface px-2 py-1"
>
<option value="">Default: the screen's own</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label>
</section>
{tags.length > 0 && ( {tags.length > 0 && (
<section> <section>
<h2 className="mb-4 text-2xl font-bold text-ink">Tags</h2> <h2 className="mb-4 text-2xl font-bold text-ink">Tags</h2>
@ -720,7 +771,7 @@ function Setup({
<button <button
type="button" type="button"
disabled={count === 0} disabled={count === 0}
onClick={() => onPlay({ skipped, hidden, seconds, screen, only, order })} onClick={() => onPlay({ skipped, hidden, seconds, screen, only, order, theme })}
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50" className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
style={{ background: accent, color: readableOn(accent) }} style={{ background: accent, color: readableOn(accent) }}
> >
@ -889,15 +940,25 @@ function Player({
const frame = look?.frame ?? null const frame = look?.frame ?? null
const background = mediaUrl(look?.background) const background = mediaUrl(look?.background)
const label = slide.label === title || slide.label === slide.title ? '' : slide.label const label = slide.label === title || slide.label === slide.title ? '' : slide.label
// Room clear at each edge, eg. inside a frame picture (097).
const inset = look?.inset
return ( return (
<main <main
onMouseMove={wake} onMouseMove={wake}
style={lookTokens(look)} style={{
...lookTokens(look),
...(inset ? { padding: `${inset.top}vh ${inset.right}vw ${inset.bottom}vh ${inset.left}vw` } : {}),
}}
className={`present relative isolate flex h-screen flex-col overflow-hidden bg-surface text-body ${controls ? '' : 'cursor-none'}`} className={`present relative isolate flex h-screen flex-col overflow-hidden bg-surface text-body ${controls ? '' : 'cursor-none'}`}
> >
{/* The background image, the background color over it at Dim. */} {/* The background image, the background color over it at Dim. */}
{background && ( {background && (
<div aria-hidden="true" className="absolute inset-0 -z-10 bg-cover bg-center" style={{ backgroundImage: `url("${background}")` }}> <div
aria-hidden="true"
// Stretched with an inset, so a frame in it meets the inset.
className={`absolute inset-0 -z-10 bg-center ${inset ? 'bg-[length:100%_100%]' : 'bg-cover'}`}
style={{ backgroundImage: `url("${background}")` }}
>
<div className="absolute inset-0 bg-surface" style={{ opacity: (look?.dim ?? DIM) / 100 }} /> <div className="absolute inset-0 bg-surface" style={{ opacity: (look?.dim ?? DIM) / 100 }} />
</div> </div>
)} )}
@ -944,12 +1005,15 @@ function Player({
)} )}
{look?.logo && ( {look?.logo && (
<Logo <span
src={mediaUrl(look.logo)} className="pointer-events-none absolute"
className={`pointer-events-none absolute right-[3vw] h-[8vh] w-auto max-w-[16vw] object-contain ${ style={{
frame === 'border' ? 'bottom-[4vh]' : 'bottom-[3vh]' right: `calc(3vw + ${inset?.right ?? 0}vw)`,
}`} bottom: `calc(${frame === 'border' ? 4 : 3}vh + ${inset?.bottom ?? 0}vh)`,
/> }}
>
<Logo src={mediaUrl(look.logo)} className="block h-[8vh] w-auto max-w-[16vw] object-contain" />
</span>
)} )}
<div <div