diff --git a/src/pages/SchedulePresent.css b/src/pages/SchedulePresent.css index 4155ca2..de31f90 100644 --- a/src/pages/SchedulePresent.css +++ b/src/pages/SchedulePresent.css @@ -39,19 +39,18 @@ } } -/* A slide part taller than its room (Scroll): holds at the top, - moves up by --present-scroll, holds at the end. With reduced - motion it stays at the top. */ +/* A slide part taller than its room (Scroll): moves up by + --present-scroll at a steady pace; its wait at the top is the + inline animation-delay, and it stays at the end after. With + reduced motion it stays at the top. */ .present-scroll { - animation: present-scroll ease-in-out both; + animation: present-scroll linear both; } @keyframes present-scroll { - 0%, - 15% { + from { transform: none; } - 85%, - 100% { + to { transform: translateY(var(--present-scroll)); } } diff --git a/src/pages/SchedulePresent.tsx b/src/pages/SchedulePresent.tsx index bedaf99..29f9bde 100644 --- a/src/pages/SchedulePresent.tsx +++ b/src/pages/SchedulePresent.tsx @@ -21,8 +21,9 @@ tag after the days: each of the schedule's tags (087) and everything it's on, under each day's name A heading (086) is only a line on the overview; a break gets no - spotlight. A slide with more than the screen holds scrolls through - it over its seconds. "Only entries tagged" (`only=`) cuts every slide + spotlight. A slide with more than the screen holds waits half its + seconds, scrolls to the end at "Scroll" seconds a screenful + (`screen=`), then waits the other half. "Only entries tagged" (`only=`) cuts every slide to what one tag is on, eg. for a screen outside the youth room. Keys while playing: arrows step, Space pauses, Escape leaves full @@ -30,7 +31,7 @@ ═══════════════════════════════════════════════════════════════ */ import { ArrowsOut, CaretLeft, CaretRight, Gear, Pause, Play } from '@phosphor-icons/react' -import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react' +import { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react' import { useParams, useSearchParams } from 'react-router-dom' import PageState from '../components/PageState.tsx' @@ -64,6 +65,8 @@ const KINDS = [ ] as const type Kind = (typeof KINDS)[number]['key'] +/* Seconds a long slide takes to scroll one screenful, when unset. */ +const PER_SCREEN = 8 /* An overview with more entries than this goes to two columns. */ const ONE_COLUMN = 8 /* How long the controls stay up after the pointer last moved (ms). */ @@ -98,11 +101,22 @@ function readSettings(params: URLSearchParams, days: Day[]) { return [kind.key, Number.isFinite(value) && value > 0 ? value : 0] }), ) as Record - return { pickedDays: new Set(pickedDays), hidden, seconds, only: params.get('only') || null } + const screen = Number(params.get('screen') ?? PER_SCREEN) + return { + pickedDays: new Set(pickedDays), + hidden, + seconds, + screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN, + only: params.get('only') || null, + } } type Settings = ReturnType -function buildSlides(days: Day[], tags: ScheduleTag[], { pickedDays, hidden, seconds, only }: Settings): Slide[] { +function buildSlides( + days: Day[], + tags: ScheduleTag[], + { pickedDays, hidden, seconds, only }: Pick, +): Slide[] { const slides: Slide[] = [] const kept: Day[] = [] days.forEach((all, d) => { @@ -198,6 +212,7 @@ export default function SchedulePresent() { title={event.title} accent={accent} slides={buildSlides(days, tags, settings)} + screen={settings.screen} onSetup={() => { const next = new URLSearchParams(params) next.delete('play') @@ -222,6 +237,7 @@ export default function SchedulePresent() { if (next.pickedDays.size < days.length) out.set('days', [...next.pickedDays].sort((a, b) => a - b).join(',')) if (next.hidden.size) out.set('hide', [...next.hidden].join(',')) for (const kind of KINDS) out.set(kind.key, String(next.seconds[kind.key])) + out.set('screen', String(next.screen)) // Not 'tag': that's the tag slides' seconds. if (next.only) out.set('only', next.only) out.set('play', '1') @@ -254,6 +270,7 @@ function Setup({ const [hidden, setHidden] = useState(settings.hidden) const [seconds, setSeconds] = useState(settings.seconds) const [only, setOnly] = useState(settings.only) + const [screen, setScreen] = useState(settings.screen) const count = buildSlides(days, tags, { pickedDays, hidden, seconds, only }).length const toggle = (set: Set, value: T) => { @@ -301,6 +318,27 @@ function Setup({ ))} +

0 leaves that kind of slide out.

@@ -374,7 +412,7 @@ function Setup({