Zum Inhalt springen

Bühnenplanung für ein Festival

Ein Linecheck ragt in den Puffer vor einem Auftritt. Auf fünf Minuten zoomen, kürzen und sehen, welche Räume und Crews am Act hängen.

  • Live-Veranstaltungen
  • Aurora Live
  • Summenzeilen
  • Minimap
  • Abhängigkeiten
  • Minutenraster
  • Fadenkreuz
  • Stufenloser Zoom
  • Aktive Bereiche
  • Zeilenspalten
  • Theming
  • Demo mit synthetischen Daten
Quellcode laden.zip

Aufgabe

0 von 3 Schritten erledigt

Samstag, 18:25: Saltwater Choir spielt im Zelt, aber der Linecheck endet nur zehn Minuten vorher.

  1. Klicken Sie auf den Auftritt von Saltwater Choir im Zelt. — Offen

    Das Seitenpanel zeigt Check, Puffer und Räume; die verbundenen Zeilen werden im Board hervorgehoben.

  2. Wechseln Sie auf die 5-Minuten-Skala. — Offen

    Bei 15 Minuten könnte der Check nur um 18:00 enden und wäre kürzer als die nötigen 20 Minuten.

  3. Ziehen Sie das Ende des Linechecks zurück auf 18:05. — Offen

    Die rote Verknüpfung wird neutral, sobald 20 Minuten bleiben. Früher beginnen kann der Check nicht: Northern Hum spielt bis 17:45.

Etwa 30 Sekunden. Erledigte Schritte werden abgehakt.

Tastatur: Raster fokussieren, dann Pfeiltasten, Eingabe und Alt+Pfeile zum Verschieben.

Aurora Live
BühnenAurora-Bühne8.000Zelt2.500Club600RäumeBackstage A14Backstage B10Presseraum24CrewsTon-Crew A6Ton-Crew B5Licht-Crew8Bühnentechnik12Lumen Arc60 Min.Glass OrchardLinecheck · 20 Min.Glass Orchard60 Min. · Puffer 25 Min.Nova TideHeadliner · 90 Min.Northern Hum45 Min.Saltwater ChoirLinecheck · 30 Min.Saltwater ChoirPuffer 10 Min.Velvet StaticLinecheck · 25 Min.Velvet Static50 Min. · Puffer 20 Min.Kilo BloomLinecheck · 30 Min.Ora Lux60 Min.Glass Orchardauf der Bühne 18:30Nova Tideauf der Bühne 21:00Northern Humauf der Bühne 17:00Saltwater Choirauf der Bühne 18:25Velvet Staticauf der Bühne 20:00Ora Luxauf der Bühne 22:00Saltwater ChoirInterviews · 25 Min.Lumen ArcInterviews · 30 Min.Nova TideInterviews · 30 Min.Tagschicht2 Auftritte · 6hNachtschicht2 Auftritte · 5hTagschicht2 Auftritte · 5hNachtschicht4 Auftritte · 5h 30 Min.Showschicht8 Auftritte · 8hUmbauLumen Arc → Glass OrchardUmbauGlass Orchard → Nova TideBühnen live2 von 3 liveSamstag, 24. Oktober16:3016:4517:0017:1517:3017:4518:0018:1518:3018:4519:0019:1519:3019:4520:0020:1520:3020:4521:0021:1521:3021:4522:0022:1522:30

Vorschau des ersten BildesLive: die echte Pro-Engine, in Ihrem BrowserEtwa 30 Sekunden. Erledigte Schritte werden abgehakt. Tastatur: Raster fokussieren, dann Pfeiltasten, Eingabe und Alt+Pfeile zum Verschieben.

Die Ausgangslage.

Aurora Live ist ein fiktives Eintagesfestival mit drei Bühnen, zwei Backstage-Räumen, einem Presseraum und vier Crews. Die Running Order steht Wochen vorher fest; was die Produktion am Tag selbst noch plant, sind die Linechecks, eingeklemmt zwischen Auftritten und jeweils mit einem Puffer, bevor der Act auf die Bühne geht.

In einer Tabelle verschwinden fünf Minuten: Ein Check, der zehn Minuten vor einem Auftritt endet, sieht auf Stundenbasis gut aus. Das Board muss bis auf die Minute zoomen, jeden Check mit seinem Auftritt verbinden, unsinnige Verschiebungen ablehnen (ein Check auf einer fremden Bühne, ein veröffentlichter Auftritt) und zeigen, welche Räume und Crews ein Act betrifft.

Was Sie tun werden

Sie öffnen das Ablaufblatt eines Acts im Seitenpanel, zoomen auf Fünf-Minuten-Zellen und kürzen einen Linecheck, bis seine Verknüpfung zum Auftritt wieder neutral ist.

Wo die Bibliothek endet und Ihre Anwendung beginnt.

SuperScheduler liefert

  • Zeitachse innerhalb eines Tages ohne die Nacht (Geschäftszeiten, Samstag eingeschlossen) und zoomLevels von Stunden bis zu 15- und 5-Minuten-Zellen, animiert über control.zoom.animateTo.
  • Gruppierte Zeilen mit drei rowHeaderColumns (Name, Kapazität, nächster Block) und emptyHeight pro Ressource für die Gruppenzeilen.
  • Eine Übersichtszeile mit frozen: 'top', gezeichnet in onBeforeCellRender: eine Spur pro Bühne, pro Zelle leuchtend, gestreift oder schraffiert.
  • Badges aus onBeforeTimeHeaderRender als Header-Areas (Einlass, Sperrzeit, Showuhr), separators für dieselben drei Zeiten und crosshairType: 'Full'.
  • Karten aus onBeforeEventRender (Ticket, Streifen, Schraffur), Hover-Areas (visibility: 'Hover', action: 'None', onClick), die einen Linecheck verschieben, und geschwungene Ende-Anfang-Verknüpfungen.
  • Ziehen und Dauer ändern im Raster der aktiven Zelle, keine Überschneidung, Ablehnungen auf der dragCard, conflictHighlight, Rückgängig und Wiederholen mit createHistory, keyboardMode: 'Full', die API rows.selection, eventHover-Karten (super-scheduler/react-render) und ein Kontextmenü im Look des Produkts.
  • Unter der Tafel die Minimap aus super-scheduler/minimap, gespeist mit der Bühnenzeit pro Viertelstunde über die Öffnungszeit (eine Float32Array-Reihe über einen festen Zeitraum), einem Ton pro Viertelstunde und übersetzten Beschriftungen; die Crew-Schichten tragen zeitlich platzierte Areas (start und end) für die Auftritte, die sie betreuen.

Der Code dieses Beispiels entscheidet

  • Welche Blöcke sich bewegen (nur Linechecks), auf welcher Bühne und wie kurz ein Check sein darf.
  • Der 20-Minuten-Puffer zwischen Check und Auftritt, wann seine Verknüpfung rot wird und welche Verknüpfungen gezeichnet werden (zu kurze Puffer und der gewählte Act, oder alle).
  • Was jede Bühne in jeder Zelle tut (Auftritt, Linecheck, Umbau oder dunkel), die Showuhr und der Streifen, der sagt, was gerade läuft und was als Nächstes kommt.
  • Welche Räume und Crews zu einem Act gehören, der eigene Ablaufplan des Acts im Seitenpanel und die Legende, die eine Bühne hervorhebt.
  • Was die Karten sagen, das Fünf-Minuten-Lineal im Drag-Urteil, die Menü- und Hover-Aktionen (Puffer halten, einen Check um fünf Minuten verschieben) und alle Texte dieser Seite.
  • Die Bühnenzeit pro Viertelstunde (Auftritte und Checks gemessen an der Zeit der drei Bühnen), die Viertelstunden mit zu knappem Puffer, die vollste Viertelstunde und die Auftritte jeder Crew-Schicht.

Der Code hinter dieser Demo.

Das sind die Dateien, die diese Seite ausführt, keine vereinfachte Kopie. Sie kompilieren gegen die öffentlichen Exporte von SuperScheduler Pro.

tsx.zip

Die Integration: Zoomstufen, ausgeblendete Nachtstunden, rowHeaderColumns, die fixierte Übersichtszeile, Header-Badges und separators, das volle Fadenkreuz, das Hervorheben von Zeilen über rows.selection, die Hover-Karte, das Drag-Urteil, das Kontextmenü, die Verschiebe-Areas, die zeitlich platzierten Areas der Crew-Schichten und die Callbacks, in denen die Regeln eine Verschiebung oder Änderung der Dauer ablehnen.

/**
 * Aurora Live run sheet: stages, rooms and crews over one festival day, down to five minutes.
 *
 * Library: timeline with hidden night, zoom levels from hours to 5-minute cells, tree rows with
 * three row-header columns (rowHeaderColumns), a frozen summary row ("Stages live", frozen: 'top')
 * painted by onBeforeCellRender, time-header badges through onBeforeTimeHeaderRender areas,
 * separators for doors, curfew and the show clock, the full crosshair, row selection (related
 * rows), dependency links, drag/resize with overlap prevention and conflict highlighting, hover
 * areas on line checks, time-placed areas on crew calls (the sets they work), undo history, keyboard, the event hover card and the drag card
 * (super-scheduler/react-render), a context menu, and the skin (./tokens.css, ./festival.css).
 * Application: which blocks can move, the line-check buffer before each set, the shortest check,
 * which rows relate to an act, what each stage is doing per cell and what the cards say. Those
 * rules live in ./rules and run inside the callbacks below.
 */
import {
  useCallback,
  useEffect,
  useMemo,
  useState,
  useSyncExternalStore,
  type RefObject,
} from 'react'
import { SuperScheduler } from 'super-scheduler'
import type {
  SchedulerBeforeTimeHeaderRenderArgs,
  SchedulerEventsChangeArgs,
} from 'super-scheduler'
import type { SchedulerHistory } from 'super-scheduler/history'
import { SuperSchedulerComponent, type SchedulerRenderProps } from 'super-scheduler/react-render'
import { format } from '~/i18n/format'
import { HOUR, MINUTE, parseCivil } from '../../scheduler/civil'
import { toneClass } from '../../scheduler/tones'
import { headerLabel, usesTwelveHours } from '../../scheduler/header-format'
import { createHeaderHook } from '../../scheduler/live-headers'
import { createEventMenu, type MenuEntry } from '../kit/context-menu'
import { formatClock } from '../kit/format'
import { useEventHover, type HoverCardModel } from '../kit/hover-card'
import { KEYS } from '../kit/keys'
import { useDropRefusal } from '../kit/use-drop-refusal'
import { createDragCard } from '../kit/verdict'
import { skinClass, skinMenuTheme } from '../registry'
import type { DemoCommon } from '../types'
import {
  CELL_WIDTH,
  GEOMETRY,
  LIVE_ROW,
  STAGE_TONES,
  actName,
  civilOf,
  isRowId,
  readSlotFields,
  slotLabel,
  toResources,
  type SlotEvent,
} from './adapter'
import { CLOSE_BUFFER } from './card-text'
import {
  cardClasses,
  createCardHtml,
  createLiveCell,
  headerMarkers,
  markerAreas,
  minuteLabel,
  rowHeaderHtml,
} from './board-html'
import {
  CURFEW,
  DOORS,
  FESTIVAL_DAY,
  INITIAL_VIEW_START,
  OPEN_HOURS,
  SHOW_CLOCK,
  type ActId,
  type RowId,
  type Slot,
} from './model'
import {
  BUFFER_NEEDED,
  actSlots,
  bufferFix,
  changeoverSets,
  checkTooShort,
  crewStages,
  isStage,
  moveProblem,
  nudgeCheck,
  setsDuring,
  type MoveProblem,
  type NudgeResult,
} from './rules'
import { bufferAt, bufferRuler, slotCard } from './slot-card'
import type { AuroraText, ZoomId } from './text'
import './tokens.css'
import './festival.css'

/** What the board asks the demo to do (context menu, keyboard). */
export type SlotAction = 'details' | 'keep-buffer' | 'earlier' | 'later' | 'go-check' | 'go-set'

/** Five-minute steps: the finest cell of the board. */
export const NUDGE_MINUTES = 5
const FIVE_MINUTES = 5 * MINUTE

export interface AuroraSchedulerProps {
  readonly events: SlotEvent[]
  readonly slots: readonly Slot[]
  /** Acts whose line check ends too close to their set. */
  readonly shortBuffers: readonly ActId[]
  /** Rows that relate to the act in the side panel (highlighted). */
  readonly relatedRows: readonly RowId[]
  readonly text: AuroraText
  readonly common: DemoCommon
  /** BCP 47 tag for labels, and the scheduler locale id. */
  readonly tag: string
  readonly schedulerLocale: string
  /** Level on mount. Later changes go through control.zoom so the view animates from where it is. */
  readonly initialZoom: ZoomId
  /** Every check-to-set link, or only those of the selected act and of short buffers. */
  readonly showAllLinks: boolean
  readonly selectedAct: ActId | null
  /** The slot shown in the side sheet: it gets the selection ring. */
  readonly selected: string | null
  readonly history: SchedulerHistory
  readonly controlRef: RefObject<SuperScheduler.Scheduler | null>
  readonly onEventsChange: (args: SchedulerEventsChangeArgs) => void
  readonly onSelect: (id: string) => void
  readonly onMoved: (id: string) => void
  readonly onResized: (id: string) => void
  readonly onRefused: (id: string, message: string) => void
  readonly onAction: (action: SlotAction, id: string) => void
  readonly onToggleLinks: () => void
  readonly onZoomLevel: (level: ZoomId) => void
}

const ZOOM_LEVELS: SuperScheduler.ZoomLevel[] = [
  {
    id: 'hours',
    properties: {
      scale: 'Hour',
      cellWidth: CELL_WIDTH.hours,
      timeHeaders: [{ groupBy: 'Day' }, { groupBy: 'Hour' }],
    },
  },
  {
    id: 'quarter',
    properties: {
      scale: 'CellDuration',
      cellDuration: 15,
      cellWidth: CELL_WIDTH.quarter,
      timeHeaders: [{ groupBy: 'Day' }, { groupBy: 'Cell' }],
    },
  },
  {
    id: 'five',
    properties: {
      scale: 'CellDuration',
      cellDuration: 5,
      cellWidth: CELL_WIDTH.five,
      timeHeaders: [{ groupBy: 'Hour' }, { groupBy: 'Cell' }],
    },
  },
]

const ZOOM_IDS: readonly ZoomId[] = ['hours', 'quarter', 'five']

/**
 * Time headers: the shared Intl labels, except at five minutes where the hour sits above and the
 * minutes (":05") below, so 26 px cells stay readable. The upper row carries the run sheet's
 * badges (doors, the show clock, curfew) as areas placed inside the cell that holds them.
 */
function festivalHeaders(
  tag: string,
  text: AuroraText,
): (args: SchedulerBeforeTimeHeaderRenderArgs) => void {
  const shared = createHeaderHook(tag)
  const markers = headerMarkers(text, tag)
  return (args) => {
    const start = args.header.start.getTime()
    const end = args.header.end.getTime()
    // The cell's own span tells the level (control.cellDuration lags during an animated zoom and
    // keeps its last value on the hour level).
    const span = end - start
    if (args.header.level !== 0 && span === FIVE_MINUTES) args.header.html = minuteLabel(start)
    else if (args.header.level === 0 && span === HOUR)
      args.header.html = SuperScheduler.Util.escapeHtml(headerLabel(start, 'hour', tag, 'group'))
    else shared(args)
    if (args.header.level === 0) args.header.areas = markerAreas(markers, start, end)
  }
}

/** The label of a five-minute nudge in the menu: the new time, or why it cannot happen. */
export function nudgeLabel(
  direction: 'earlier' | 'later',
  result: NudgeResult,
  text: AuroraText,
  tag: string,
): string {
  if (result.ok) return format(text.actions[direction], { time: formatClock(result.start, tag) })
  const reason =
    result.reason === 'closed'
      ? text.actions.closed
      : format(text.actions.blockedBy, {
          name:
            result.other.act === undefined
              ? slotLabel(result.other, text)
              : actName(result.other.act),
        })
  return format(direction === 'earlier' ? text.actions.earlierBlocked : text.actions.laterBlocked, {
    reason,
  })
}

export function AuroraScheduler(props: AuroraSchedulerProps) {
  const {
    events,
    slots,
    shortBuffers,
    relatedRows,
    selectedAct,
    selected,
    text,
    common,
    tag,
    schedulerLocale,
    initialZoom,
    showAllLinks,
    history,
    controlRef,
  } = props
  const {
    onEventsChange,
    onSelect,
    onMoved,
    onResized,
    onRefused,
    onAction,
    onToggleLinks,
    onZoomLevel,
  } = props

  const resources = useMemo(() => toResources(text), [text])
  // Phones keep the name column only; capacity and the next block are in the cards and the panel.
  const compact = useNarrowScreen()
  const rowHeaderColumns = useMemo<SuperScheduler.RowHeaderColumnData[]>(
    () => [
      { title: text.columns.name, width: compact ? 150 : GEOMETRY.rowHeader.name },
      {
        title: text.columns.capacity,
        width: GEOMETRY.rowHeader.capacity,
        toolTip: text.columns.capacityTip,
        hidden: compact,
      },
      {
        title: text.columns.next,
        width: GEOMETRY.rowHeader.next,
        toolTip: text.columns.nextTip,
        hidden: compact,
      },
    ],
    [text, compact],
  )
  // Header labels follow the active level. An animated zoom renders the new level's headers before
  // control.cellDuration reports it, so the hook is rebuilt (headers repainted) once a zoom lands.
  const [headerHook, setHeaderHook] = useState(() => festivalHeaders(tag, text))

  // Doors and curfew are fixed lines of the day; the show clock is the run sheet's "now".
  const separators = useMemo<SuperScheduler.SeparatorData[]>(
    () => [
      {
        location: DOORS,
        cssClass: 'al-sep al-sep--doors',
        layer: 'BelowEvents',
        width: 1,
        toolTip: text.markers.doors,
      },
      {
        location: CURFEW,
        cssClass: 'al-sep al-sep--curfew',
        layer: 'BelowEvents',
        width: 1,
        toolTip: text.markers.curfew,
      },
      {
        location: SHOW_CLOCK,
        cssClass: 'al-sep al-sep--clock',
        layer: 'AboveEvents',
        width: 2,
        toolTip: text.markers.onAir,
      },
    ],
    [text],
  )

  // What the grid paints, rebuilt when the plan changes and cached inside.
  const paint = useMemo(() => {
    const context = { slots, text, tag }
    return {
      card: createCardHtml(context),
      row: rowHeaderHtml(context),
      live: createLiveCell(slots, text),
    }
  }, [slots, text, tag])

  // A refused drop (wrong stage, published set, short check, overlap) is said on release.
  const refusal = useDropRefusal(onRefused)

  // Each act's line check leads to its set: a finish-to-start link, red when the buffer is short.
  // Morning checks would cross a whole stage row, so by default only the selected act and the
  // short buffers show theirs.
  const links = useMemo<SuperScheduler.LinkData[]>(() => {
    const short = new Set(shortBuffers)
    return slots.flatMap((check) => {
      const set =
        check.kind === 'check'
          ? slots.find((slot) => slot.kind === 'set' && slot.act === check.act)
          : undefined
      if (set === undefined || check.act === undefined) return []
      if (!showAllLinks && !short.has(check.act) && check.act !== selectedAct) return []
      return [
        {
          id: `${check.act}-buffer`,
          from: check.id,
          to: set.id,
          type: 'FinishToStart' as const,
          ...(short.has(check.act) ? { cssClass: 'ss-link--late' } : {}),
        },
      ]
    })
  }, [slots, shortBuffers, showAllLinks, selectedAct])

  // Hover card: buffer, rooms and crews of the act, or what a crew block sits between.
  const card = useCallback(
    (event: SuperScheduler.Event): HoverCardModel | null => {
      const slot = slots.find((candidate) => candidate.id === String(event.id()))
      return slot === undefined ? null : slotCard(slot, slots, text, common, tag)
    },
    [slots, text, common, tag],
  )
  const { eventHover, closeHover, suppressHover } = useEventHover(card)

  // Drag verdict: clock times (one festival day), the stage rules, and for line checks the
  // buffer they would leave, drawn as five-minute pips so it reads at the finest zoom.
  const dragCard = useMemo<SuperScheduler.DragCardOptions>(() => {
    const pattern = usesTwelveHours(tag) ? 'h:mm tt' : 'HH:mm'
    const sets = new Map(
      slots.flatMap((slot) =>
        slot.kind === 'set' && slot.act !== undefined ? [[slot.act, slot]] : [],
      ),
    )
    const checkOf = (id: SuperScheduler.EventId | null) =>
      slots.find((slot) => slot.id === String(id) && slot.kind === 'check')
    const base = createDragCard({
      tag,
      common,
      rowName: (id) => (isRowId(id) ? text.rows[id] : null),
      warn: (info) => {
        const check = checkOf(info.eventId)
        const set = check?.act === undefined ? undefined : sets.get(check.act)
        if (check?.act === undefined || set === undefined) return null
        const minutes = bufferAt(set.start, info.end.getTime())
        return minutes >= BUFFER_NEEDED
          ? null
          : format(text.card.early, {
              minutes,
              act: actName(check.act),
              needed: BUFFER_NEEDED,
            })
      },
    })
    return {
      ...base,
      markerFormat: pattern,
      html: (info) => {
        const html = base.html?.(info) ?? null
        const check = checkOf(info.eventId)
        const set = check?.act === undefined ? undefined : sets.get(check.act)
        if (html === null || check === undefined || set === undefined) return html
        if (String(info.resource) !== check.row || info.forbidden || info.overlapping) return html
        // A check hours before its set needs no ruler; near the set it shows the buffer left.
        const minutes = bufferAt(set.start, info.end.getTime())
        if (minutes > CLOSE_BUFFER) return html
        // The ruler goes inside the verdict, after its pills and before the reason line.
        const ruler = bufferRuler(minutes, text)
        const reason = html.indexOf('<div class="ss-vd__reason">')
        return reason === -1
          ? `${html.slice(0, -'</div>'.length)}${ruler}</div>`
          : `${html.slice(0, reason)}${ruler}${html.slice(reason)}`
      },
    }
  }, [slots, text, common, tag])

  // Context menu: rebuilt when the plan changes, so its labels name the real consequence.
  const contextMenu = useMemo(
    () =>
      createEventMenu({
        theme: skinMenuTheme('festival-stages'),
        title: (event) => format(common.kit.menuTitle, { name: event.text() }),
        onOpenChange: (open) => suppressHover(open),
        entries: (event) => {
          const id = String(event.id())
          const slot = slots.find((candidate) => candidate.id === id)
          if (slot === undefined) return []
          const entries: MenuEntry[] = [
            {
              label: common.kit.openDetails,
              icon: 'details',
              keys: KEYS.details,
              run: () => onAction('details', id),
            },
          ]
          const act = slot.act
          if (act !== undefined && (slot.kind === 'set' || slot.kind === 'check')) {
            const fix = bufferFix(act, slots)
            if (fix !== null)
              entries.push({
                label: format(text.actions.keepBuffer, {
                  needed: BUFFER_NEEDED,
                  time: formatClock(fix.end, tag),
                }),
                icon: 'slot',
                primary: true,
                run: () => onAction('keep-buffer', id),
              })
          }
          if (slot.kind === 'check') {
            const earlier = nudgeCheck(slot, slots, -NUDGE_MINUTES)
            const later = nudgeCheck(slot, slots, NUDGE_MINUTES)
            entries.push(
              'separator',
              {
                label: nudgeLabel('earlier', earlier, text, tag),
                icon: 'after',
                disabled: !earlier.ok,
                run: () => onAction('earlier', id),
              },
              {
                label: nudgeLabel('later', later, text, tag),
                icon: 'after',
                disabled: !later.ok,
                run: () => onAction('later', id),
              },
            )
          } else if (slot.kind === 'set' && act !== undefined) {
            const check = actSlots(act, slots).check
            if (check !== undefined)
              entries.push('separator', {
                label: `${text.actions.goToCheck} · ${formatClock(check.start, tag)}`,
                icon: 'focus',
                run: () => onAction('go-check', id),
              })
          } else {
            // Rooms and crews follow the running order: the menu leads to the set that decides.
            const next =
              slot.kind === 'changeover'
                ? changeoverSets(slot, slots).after
                : act === undefined
                  ? undefined
                  : actSlots(act, slots).set
            if (next?.act !== undefined)
              entries.push('separator', {
                label: `${format(text.actions.goToAct, { act: actName(next.act) })} · ${formatClock(next.start, tag)}`,
                icon: 'focus',
                run: () => onAction('go-set', id),
              })
          }
          entries.push('separator', {
            label: showAllLinks ? text.actions.hideLinks : text.actions.showLinks,
            icon: 'link',
            run: onToggleLinks,
          })
          return entries
        },
      }),
    [slots, showAllLinks, common, text, tag, onAction, onToggleLinks, suppressHover],
  )

  const config = useMemo<SchedulerRenderProps>(() => {
    const short = new Set<string>(shortBuffers)
    const related = new Set<string>(relatedRows)
    const problemText = (problem: MoveProblem) =>
      problem === 'published'
        ? text.rules.published
        : problem === 'follows'
          ? text.rules.follows
          : text.rules.wrongStage
    const overlapText = (conflicts: readonly SuperScheduler.Event[]) => {
      const first = conflicts[0]
      return first === undefined ? null : format(common.kit.overlaps, { name: first.text() })
    }
    const byId = new Map(slots.map((slot) => [slot.id, slot]))
    // Hover buttons of a line check: five minutes earlier or later, named by their result.
    const nudgeAreas = (slot: Slot): SuperScheduler.AreaData[] =>
      (['earlier', 'later'] as const).map((direction, index) => {
        const result = nudgeCheck(
          slot,
          slots,
          direction === 'earlier' ? -NUDGE_MINUTES : NUDGE_MINUTES,
        )
        const label = nudgeLabel(direction, result, text, tag)
        return {
          right: index === 0 ? 30 : 4,
          top: 4,
          width: 24,
          height: 18,
          visibility: 'Hover',
          action: 'None',
          cssClass: `al-nudge${result.ok ? '' : ' al-nudge--off'}`,
          html: `<span aria-hidden="true">${direction === 'earlier' ? '−5' : '+5'}</span>`,
          toolTip: label,
          onClick: () => {
            if (result.ok) onAction(direction, slot.id)
            else onRefused(slot.id, label)
          },
        }
      })

    // A crew call shows when its stages are lit: one segment per set it works, placed by time (the
    // library positions areas from `start` and `end`) in that stage's light.
    const shiftAreas = (slot: Slot): SuperScheduler.AreaData[] =>
      setsDuring(slot, slots).flatMap((set) =>
        set.act === undefined || !isStage(set.row)
          ? []
          : [
              {
                // The set, clipped to the call.
                start: parseCivil(set.start) > parseCivil(slot.start) ? set.start : slot.start,
                end: parseCivil(set.end) < parseCivil(slot.end) ? set.end : slot.end,
                // One lane per stage the crew works, stacked along the foot.
                bottom: 1 + 2 * Math.max(0, crewStages(slot.row).indexOf(set.row)),
                height: 2,
                nonFloating: true,
                cssClass: `al-call ${toneClass(STAGE_TONES[set.row])}`,
                toolTip: `${actName(set.act)} · ${formatClock(set.start, tag)}`,
              },
            ],
      )

    return {
      locale: schedulerLocale,
      startDate: FESTIVAL_DAY,
      days: 1,
      zoomLevels: ZOOM_LEVELS,
      zoom: initialZoom,
      zoomPosition: 'left',
      // The site opens at noon: the morning stays hidden. A Saturday is a working day here.
      businessBeginsHour: OPEN_HOURS.begin,
      businessEndsHour: OPEN_HOURS.end,
      businessWeekends: true,
      showNonBusiness: false,
      useEventBoxes: 'Never',
      height: '100%',
      cssClass: `al-board ${skinClass('festival-stages')}`,
      treeEnabled: true,
      treePreventParentUsage: true,
      rowHeaderColumns,
      rowHeaderWidthAutoFit: false,
      eventHeight: GEOMETRY.eventHeight,
      rowMarginTop: GEOMETRY.rowMargin,
      rowMarginBottom: GEOMETRY.rowMargin,
      crosshairType: 'Full',
      separators,
      allowEventOverlap: false,
      conflictHighlight: true,
      linkLayer: 'Below',
      timeRangeSelectedHandling: 'Disabled',
      durationBarVisible: false,
      showToolTip: false,
      keyboardEnabled: true,
      keyboardTarget: 'component',
      keyboardMode: 'Full',
      history,
      controlRef,
      onEventsChange,

      onBeforeTimeHeaderRender: headerHook,

      onBeforeRowHeaderRender: (args) => {
        const id = String(args.row.id)
        const html = paint.row(id)
        if (html === null) return
        const [name, capacity, next] = args.row.columns
        if (name !== undefined) name.html = html.name
        if (capacity !== undefined) capacity.html = html.capacity
        if (next !== undefined) next.html = html.next
        args.row.cssClass =
          id === LIVE_ROW
            ? 'al-row--live'
            : args.row.data.children !== undefined
              ? 'al-row--group'
              : ''
      },

      // The frozen row sums up the stages per cell; the selected act's rows are tinted (their
      // headers come from rows.selection).
      onBeforeCellRender: (args) => {
        const cell = args.cell
        if (cell.resource === LIVE_ROW) {
          const live = paint.live(cell.start.getTime(), cell.end.getTime())
          cell.properties.html = live.html
          cell.properties.cssClass = `al-live-cell al-live-cell--${live.count}`
          return
        }
        if (related.has(String(cell.resource))) cell.properties.cssClass = 'al-related'
      },

      onBeforeEventRender: (args) => {
        const fields = readSlotFields(args.data)
        const id = String(args.data.id)
        const known = byId.get(id)
        if (fields === null || known === undefined) return
        // The control may hold newer times than React (a drop lands before onEventsChange).
        const slot: Slot = {
          ...known,
          start: civilOf(args.data.start),
          end: civilOf(args.data.end),
        }
        args.data.html = paint.card(slot)
        let classes = cardClasses(slot)
        if (fields.kind === 'set' && fields.act !== undefined && short.has(fields.act))
          classes += ' ss-ev--late'
        if (id === selected) classes += ' al-ev--selected'
        args.data.cssClass = classes
        if (fields.kind === 'check') args.data.areas = nudgeAreas(slot)
        else if (fields.kind === 'shift') args.data.areas = shiftAreas(slot)
      },

      // Only line checks move, and only on their act's stage; overlap is refused by the library.
      onEventMoving: (args) => {
        const id = String(args.e.id())
        const fields = readSlotFields(args.e.data)
        const problem = fields === null ? null : moveProblem(fields, String(args.resource))
        if (problem !== null) {
          const message = problemText(problem)
          args.allowed = false
          args.message = message
          refusal.track(id, message)
          return
        }
        refusal.track(id, overlapText(args.conflicts))
      },

      // Final check before the commit (also covers keyboard moves).
      onEventMove: (args) => {
        const fields = readSlotFields(args.e.data)
        const problem = fields === null ? null : moveProblem(fields, String(args.newResource))
        if (problem !== null) {
          args.preventDefault()
          refusal.clear()
          onRefused(String(args.e.id()), problemText(problem))
        }
      },

      onEventResizing: (args) => {
        const id = String(args.e.id())
        if (checkTooShort(args.start.value, args.end.value)) {
          args.allowed = false
          args.message = text.rules.tooShort
          refusal.track(id, text.rules.tooShort)
          return
        }
        refusal.track(id, overlapText(args.conflicts))
      },

      onEventResize: (args) => {
        if (checkTooShort(args.newStart.value, args.newEnd.value)) {
          args.preventDefault()
          refusal.clear()
          onRefused(String(args.e.id()), text.rules.tooShort)
        }
      },

      onEventMoved: (args) => {
        refusal.clear()
        onMoved(String(args.e.id()))
      },
      onEventResized: (args) => {
        refusal.clear()
        onResized(String(args.e.id()))
      },
      // A click (or Enter) docks the slot into the side sheet; the hover card steps aside.
      onEventClick: (args) => {
        closeHover()
        onSelect(String(args.e.id()))
      },

      onZoom: (args) => {
        if (args.phase !== 'end') return
        setHeaderHook(() => festivalHeaders(tag, text))
        const level = ZOOM_IDS[args.level]
        if (level !== undefined) onZoomLevel(level)
      },
    }
  }, [
    history,
    controlRef,
    slots,
    shortBuffers,
    relatedRows,
    selected,
    rowHeaderColumns,
    separators,
    paint,
    common,
    refusal,
    closeHover,
    onAction,
    onEventsChange,
    onMoved,
    onRefused,
    onResized,
    onSelect,
    onZoomLevel,
    schedulerLocale,
    headerHook,
    tag,
    text,
    initialZoom,
  ])

  // Highlighted rows are the control's row selection, driven by the act in the side panel.
  useEffect(() => {
    const control = controlRef.current
    if (control === null || control.disposed()) return
    control.rows.selection.clear()
    for (const id of relatedRows) {
      const row = control.rows.find(id)
      if (row !== null) control.rows.selection.add(row)
    }
  }, [controlRef, relatedRows])

  // Imperative and once: a scroll prop would be re-applied on every update.
  useEffect(() => {
    controlRef.current?.scrollTo(INITIAL_VIEW_START, false, 'left')
  }, [controlRef])

  return (
    <SuperSchedulerComponent
      {...config}
      resources={resources}
      events={events}
      links={links}
      eventHover={eventHover}
      dragCard={dragCard}
      contextMenu={contextMenu}
    />
  )
}

const NARROW = '(max-width: 639px)'

/** True on phone-sized screens (the stage is then too narrow for three header columns). */
function useNarrowScreen(): boolean {
  return useSyncExternalStore(
    (notify) => {
      const query = window.matchMedia(NARROW)
      query.addEventListener('change', notify)
      return () => query.removeEventListener('change', notify)
    },
    () => window.matchMedia(NARROW).matches,
    () => false,
  )
}

Das Archiv enthält die Dateien dieses Beispiels und eine README. SuperScheduler Pro und Download-Schlüssel sind nicht enthalten.