diff --git a/src/pages/SchedulePresent.css b/src/pages/SchedulePresent.css index f5bfd7e..4155ca2 100644 --- a/src/pages/SchedulePresent.css +++ b/src/pages/SchedulePresent.css @@ -38,3 +38,25 @@ width: 100%; } } + +/* 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. */ +.present-scroll { + animation: present-scroll ease-in-out both; +} +@keyframes present-scroll { + 0%, + 15% { + transform: none; + } + 85%, + 100% { + transform: translateY(var(--present-scroll)); + } +} +@media (prefers-reduced-motion: reduce) { + .present-scroll { + animation: none !important; + } +} diff --git a/src/pages/SchedulePresent.tsx b/src/pages/SchedulePresent.tsx index c3c786a..bedaf99 100644 --- a/src/pages/SchedulePresent.tsx +++ b/src/pages/SchedulePresent.tsx @@ -21,7 +21,8 @@ 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. "Only entries tagged" (`only=`) cuts every slide + spotlight. A slide with more than the screen holds scrolls through + it over its seconds. "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 @@ -29,7 +30,7 @@ ═══════════════════════════════════════════════════════════════ */ import { ArrowsOut, CaretLeft, CaretRight, Gear, Pause, Play } from '@phosphor-icons/react' -import { useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react' +import { 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' @@ -584,6 +585,35 @@ function Rise({ order = 0, from = 'below', className = '', children }: { ) } +/* A slide's part that may not fit: when its content is taller than + the room it has, it holds, scrolls to the end over the slide's + `seconds`, then holds again. `center` puts short content in the + middle (and still starts long content at the top). */ +function Scroll({ seconds, center = false, className = '', children }: { + seconds: number + center?: boolean + className?: string + children: ReactNode +}) { + const box = useRef(null) + const [by, setBy] = useState(0) + useLayoutEffect(() => { + const outer = box.current + const inner = outer?.firstElementChild as HTMLElement | null + if (outer && inner) setBy(Math.max(0, inner.offsetHeight - outer.clientHeight)) + }, []) + return ( +
+
+ {children} +
+
+ ) +} + /* An overview's rows: each entry, a block's sub-items under it. `start` is the first row's place in the slide's entrance. */ function OverviewEntries({ entries, accent, start = 1 }: { entries: ContentBlockItem[]; accent: string; start?: number }) { @@ -673,9 +703,11 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) { {slide.day.name || 'Schedule'} -
    - -
+ +
    + +
+
) } @@ -693,24 +725,26 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) { {tag.name} -
    - {tagDays.map((day, d) => { - const start = order - order += day.entries.length + 1 - return ( -
  • - {day.name && ( - -

    {day.name}

    -
    - )} -
      - -
    -
  • - ) - })} -
+ +
    + {tagDays.map((day, d) => { + const start = order + order += day.entries.length + 1 + return ( +
  • + {day.name && ( + +

    {day.name}

    +
    + )} +
      + +
    +
  • + ) + })} +
+
) } @@ -745,38 +779,40 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {

)} -
    - {items.map((item, i) => ( -
  • - - - {item.time} - - - - {item.featured && ( - - + +
      + {items.map((item, i) => ( +
    • + + + {item.time} + + + + {item.featured && ( + + + + )} + {item.text} + + {(item.location || item.detail) && ( + + {[item.location, item.detail].filter(Boolean).join(' · ')} )} - {item.text} - {(item.location || item.detail) && ( - - {[item.location, item.detail].filter(Boolean).join(' · ')} + {item.person && ( + + + {item.person.name} )} - - {item.person && ( - - - {item.person.name} - - )} - -
    • - ))} -
    +
    +
  • + ))} +
+ ) } @@ -814,7 +850,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) { )} )} -
+

{[slide.day.name, slide.parent?.text, entry.time].filter(Boolean).join(' · ')} @@ -849,12 +885,12 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) { )} {entry.description && ( -

+
)} -
+
) }