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
7 changed files with 41 additions and 8 deletions
Showing only changes of commit f46deac3cc - Show all commits

View file

@ -164,6 +164,8 @@ export const blocksChild = (ownerKind) => ({
), ),
text("text"), text("text"),
text("media"), text("media"),
// Image blocks (102): shown in place of media in the dark theme.
text("media_dark"),
url("href"), url("href"),
text("alt"), text("alt"),
text("cite"), text("cite"),

View file

@ -0,0 +1,13 @@
-- ═══════════════════════════════════════════════════════════════
-- 102 AN IMAGE BLOCK'S DARK THEME PICTURE
--
-- media_dark shown in place of media while the site is in its
-- dark theme (the visitor's setting, or a presentation
-- held dark), eg. a chart or a logo drawn light on
-- dark. Null shows media in both themes.
--
-- Image blocks only; other types ignore it. Its alt text and caption
-- are the block's, so it should show the same thing.
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE content_blocks ADD COLUMN media_dark TEXT;

View file

@ -86,7 +86,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
const blockRows = db const blockRows = db
.prepare( .prepare(
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id, `SELECT id, owner_id, type, text, media, media_dark, href, alt, cite, captions, team_id, venue_id,
word_motion, word_direction, word_seconds, list_style, image_size, org_kind, word_motion, word_direction, word_seconds, list_style, image_size, org_kind,
present_show, present_text, present_map_split, present_map_no_list, present_show, present_text, present_map_split, present_map_no_list,
present_map_no_details, present_places, present_place_keys present_map_no_details, present_places, present_place_keys
@ -105,6 +105,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
type: row.type, type: row.type,
text: row.text, text: row.text,
media: row.media, media: row.media,
media_dark: row.media_dark,
href: row.href, href: row.href,
alt: row.alt, alt: row.alt,
cite: row.cite, cite: row.cite,

View file

@ -73,6 +73,7 @@ import { useReadingMode } from '../lib/readingMode.ts'
import { WordMotion, Words } from './RotatingWords.tsx' import { WordMotion, Words } from './RotatingWords.tsx'
import OrgListCards, { OrgLogoRow } from '../pages/sections/OrgList-Card.tsx' import OrgListCards, { OrgLogoRow } from '../pages/sections/OrgList-Card.tsx'
import { usePresenting } from '../lib/presenting.ts' import { usePresenting } from '../lib/presenting.ts'
import { useDarkTheme } from '../lib/darkTheme.ts'
const BODY = 'var(--color-muted)' const BODY = 'var(--color-muted)'
@ -396,6 +397,8 @@ function Block({
// On a screen: links are their text, people and organizations // On a screen: links are their text, people and organizations
// just pictures and names (095). // just pictures and names (095).
const presenting = usePresenting() const presenting = usePresenting()
// An image block's dark theme picture (102).
const dark = useDarkTheme()
switch (block.type) { switch (block.type) {
// A blog post's tab marker (BlogPost.tsx splits the post at // A blog post's tab marker (BlogPost.tsx splits the post at
@ -560,7 +563,7 @@ function Block({
) )
case 'image': { case 'image': {
const src = mediaUrl(block.media) const src = mediaUrl((dark && block.media_dark) || block.media)
if (!src) return null if (!src) return null
// The reader leaves out a picture with no alt, and its link with it. // The reader leaves out a picture with no alt, and its link with it.
if (reading && block.href && !block.alt) { if (reading && block.href && !block.alt) {

View file

@ -659,6 +659,16 @@ export const blocksChild = {
when: { path: "type", value: "video" }, when: { path: "type", value: "video" },
help: "A WebVTT (.vtt) file, for an uploaded video; YouTube, Vimeo and Facebook show their own. Default: none.", help: "A WebVTT (.vtt) file, for an uploaded video; YouTube, Vimeo and Facebook show their own. Default: none.",
}, },
{
path: "media_dark",
label: "Dark theme image",
widget: "image",
crop: "free",
resolve: mediaUrl,
full: true,
when: { path: "type", value: "image" },
help: "Shown in place of the image while the site is dark, eg. a chart drawn light on dark. Same alt text and caption. Default: the image above in both themes.",
},
{ {
path: "image_size", path: "image_size",
label: "Size", label: "Size",

View file

@ -57,6 +57,8 @@ export type ContentBlock = {
cite?: string | null cite?: string | null
/** A list block's style (092): null bold text, 'plain' the old look. */ /** A list block's style (092): null bold text, 'plain' the old look. */
list_style?: 'plain' | null list_style?: 'plain' | null
/** An image block's picture for the dark theme (102). */
media_dark?: string | null
/** An image block's size (101): null the column's width. */ /** An image block's size (101): null the column's width. */
image_size?: 'small' | 'medium' | 'large' | null image_size?: 'small' | 'medium' | 'large' | null
/** An organizations block's kind, listed when none are picked (093). */ /** An organizations block's kind, listed when none are picked (093). */

View file

@ -1434,7 +1434,7 @@ function Scroll({ center = false, className = '', children }: {
zoomed down until its content is no taller than its box (a few zoomed down until its content is no taller than its box (a few
passes, since text narrower in zoom wraps less). Again whenever passes, since text narrower in zoom wraps less). Again whenever
its size changes, eg. a picture loading. */ its size changes, eg. a picture loading. */
function Fit({ className = '', children }: { className?: string; children: ReactNode }) { function Fit({ center = false, className = '', children }: { center?: boolean; className?: string; children: ReactNode }) {
const box = useRef<HTMLDivElement>(null) const box = useRef<HTMLDivElement>(null)
const inner = useRef<HTMLDivElement>(null) const inner = useRef<HTMLDivElement>(null)
useLayoutEffect(() => { useLayoutEffect(() => {
@ -1457,8 +1457,10 @@ function Fit({ className = '', children }: { className?: string; children: React
return () => watch.disconnect() return () => watch.disconnect()
}, []) }, [])
return ( return (
<div ref={box} className={`min-h-0 flex-1 overflow-hidden ${className}`}> <div ref={box} className={`min-h-0 flex-1 overflow-hidden ${center ? 'flex flex-col' : ''} ${className}`}>
<div ref={inner}>{children}</div> <div ref={inner} className={center ? 'my-auto' : undefined}>
{children}
</div>
</div> </div>
) )
} }
@ -1587,9 +1589,9 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
// The page's own blocks, zoomed up from the page's size. The // The page's own blocks, zoomed up from the page's size. The
// zoom is inside Scroll, so it measures what the screen shows. // zoom is inside Scroll, so it measures what the screen shows.
const zoom = Math.max(1, window.innerWidth / TEXT_WIDTH) const zoom = Math.max(1, window.innerWidth / TEXT_WIDTH)
// Only people: the title and their photos in the middle of the // Only people or pictures: the title and them in the middle of the
// slide, both ways. // slide, both ways.
if (slide.blocks!.every((block) => block.type === 'people' || FILLER.has(block.type))) { if (slide.blocks!.every((block) => block.type === 'people' || isPicture(block) || FILLER.has(block.type))) {
return ( return (
<div className="flex h-full flex-col text-center"> <div className="flex h-full flex-col text-center">
<Scroll center> <Scroll center>
@ -1620,7 +1622,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
<div className="flex h-full flex-col"> <div className="flex h-full flex-col">
<SlideTitle color={color}>{slide.label}</SlideTitle> <SlideTitle color={color}>{slide.label}</SlideTitle>
<Rise order={1} className="flex min-h-0 flex-1 flex-col"> <Rise order={1} className="flex min-h-0 flex-1 flex-col">
<Fit> <Fit center>
<div <div
className={`grid items-center gap-[3vw] ${left ? 'grid-cols-[2fr_3fr]' : 'grid-cols-[3fr_2fr]'}`} className={`grid items-center gap-[3vw] ${left ? 'grid-cols-[2fr_3fr]' : 'grid-cols-[3fr_2fr]'}`}
style={{ zoom }} style={{ zoom }}