Physiotherapy clinic appointments
A patient cannot make 10:00 AM. Find the next slot that respects breaks and room cleaning.
- Healthcare
- Forma
- Minute scale
- Summary rows
- Minimap
- Live search
- Active areas
- Move rules
- Blocked time
- Row columns
- Theming
- Demo with synthetic data
Mission
0 of 3 steps doneThursday, 9:40 AM: Owen Hart (F-2318, knee rehab at 10:00 AM with Alba R.) calls to ask for a later time.
Drag F-2318 onto Marc D.’s row at 12:00 PM, while his room is being cleaned. — To do
Striped slots are blocked. The drag card shows the reason and the drop is refused.
Drop it at 12:30 PM on Marc D.’s row, right after the cleaning. — To do
Any free slot works if the practitioner delivers knee rehab. The osteopath’s row refuses it.
Switch to 15-minute slots and extend an appointment by a quarter of an hour. — To do
Choose “15 min” in the bar, then drag the right edge of a card. From the keyboard, Alt+Shift+arrow keys change its length.
About 30 seconds. Steps tick off as you complete them.
Keyboard: focus the grid, then use arrow keys, Enter and Alt+arrows to move.
Preview of the first frameLive: the real Pro engine, running in your browserAbout 30 seconds. Steps tick off as you complete them. Keyboard: focus the grid, then use arrow keys, Enter and Alt+arrows to move.
The situation.
Forma is a fictional clinic with three physiotherapists, an osteopath and a sports massage therapist. Appointments last 15 to 60 minutes, each practitioner works in one room, and the day is cut by breaks, a case-review meeting and room cleaning between sessions.
When a patient calls to move an appointment, the front desk has seconds to find a slot while the waiting room fills up. A paper grid or a generic calendar lets them book over a break or give an osteopathy session to a physiotherapist. The board has to refuse those slots and say why, out loud for screen reader users too. Patients, staff and appointments here are all invented.
What you will do
You will try to put an appointment into a cleaning slot, hear why it is refused, move it to the first free slot after the cleaning, and fine-tune its length in 15-minute steps.
Where the library ends and your application begins.
SuperScheduler provides
- Minute scales as zoomLevels (30- and 15-minute cells) with snapping and night hours hidden (showNonBusiness: false).
- A frozen summary row (frozen: ‘top’, cellsDisabled) filled by onBeforeCellRender, and practitioner headers with live load meters from rowHeaderColumns.
- Rich cards from onBeforeEventRender with areas: the patient’s avatar as a clickable status chip (action: ‘None’, onClick) and a time-anchored room reset (start, end).
- Patient search with events.filter and onEventFilter, the viewport from super-scheduler/hooks (useSchedulerState) for the day navigator, and the clinic’s now as a separator.
- Disabled cells and per-frame vetoes (allowed, message) while dragging or resizing, the drag card, the event hover card, keyboard moves and controlled events (onEventsChange).
- The minimap (super-scheduler/minimap) over a fixed range of both clinic days, fed with the application’s own series; its brush is a slider from the keyboard too.
This example’s code decides
- Which disciplines may deliver each treatment, and the clinic’s breaks, meeting and room cleaning.
- The visit statuses and their order, the rooms in use, each practitioner’s load and the front desk’s figures.
- One sentence per refusal reason, announced in a polite live region when a drop is refused.
- The detail panel, the mission and every label on this page.
- The booked share of each hour drawn by the minimap, the busiest hour, and the busy and full thresholds it shares with the load meters.
The code behind this demo.
These are the files this page runs, not a simplified copy. They compile against the public SuperScheduler Pro exports.
The integration: slot sizes, the frozen row, cards with areas, disabled cells from the block list, the event filter and the callbacks where the rules refuse a slot.
/**
* Forma appointment board: practitioners over two clinic days in 30- or 15-minute slots, a frozen
* "rooms in use" row on top and the clinic's now.
*
* Library: minute-scale zoom levels, a frozen summary row (frozen: 'top', cellsDisabled) filled by
* onBeforeCellRender, row header columns with a live load meter, rich cards from
* onBeforeEventRender with areas (a clickable status chip, a time-anchored room reset), disabled
* cells, a separator for "now", the event filter (events.filter + onEventFilter) behind the
* patient search, drag/resize with per-frame vetoes, the drag card, the event hover card
* (super-scheduler/react-render), conflict highlighting, a context menu and keyboard moves.
* Application: who may deliver which treatment, the clinic's fixed blocks, the status cycle and
* the sentence that explains every refusal. Those rules live in ./rules.
*/
import { useCallback, useEffect, useMemo, type RefObject } from 'react'
import type { SchedulerEventsChangeArgs, SuperScheduler } from 'super-scheduler'
import type { SchedulerHistory } from 'super-scheduler/history'
import { SuperSchedulerComponent, type SchedulerRenderProps } from 'super-scheduler/react-render'
import { format, plural } from '~/i18n/format'
import { DAY, HOUR, MINUTE, civil, parseCivil } from '../../scheduler/civil'
import { headerLabel } from '../../scheduler/header-format'
import { unitOfSpan } from '../../scheduler/live-headers'
import { createEventMenu } from '../kit/context-menu'
import { formatClock, formatDay, formatSpan, formatWhen } from '../kit/format'
import { defaultHints } from '../kit/hover-card'
import { KEYS } from '../kit/keys'
import { useDropRefusal } from '../kit/use-drop-refusal'
import { createDragCard } from '../kit/verdict'
import type { DemoCommon } from '../types'
import {
CARD_HEIGHT,
CARD_INSET,
HEADER_ROW,
PRACTITIONER_COLUMNS,
SLOT_WIDTH,
civilOf,
isAppointmentEvent,
practitionerOf,
readAppointmentFields,
toResources,
type AppointmentEvent,
} from './adapter'
import {
blockHtml,
cardHtml,
createHtmlCache,
dayHtml,
loadHtml,
nowTagHtml,
practitionerHtml,
roomsCellHtml,
slotHtml,
statusChipHtml,
summaryHeadHtml,
teamHtml,
} from './cards'
import {
BLOCKS,
CLINIC_DAYS,
NOW,
OPENING_HOURS,
PRACTITIONERS,
PRACTITIONER_NAMES,
RESET_MINUTES,
TODAY,
type Appointment,
} from './model'
import {
TREATMENT_DISCIPLINES,
blockAt,
initials,
matchesSearch,
nextFreeSlot,
nextStatus,
roomsInUse,
shortName,
slotRefusal,
utilisation,
type Refusal,
} from './rules'
import { ZOOM_IDS, type FormaText, type ZoomId } from './text'
import { useVisitHover, type VisitCardModel } from './visit-card'
import './tokens.css'
import './forma.css'
/** What the board asks the demo to do (context menu, status chip). */
export type AppointmentAction = 'details' | 'cycle-status' | 'next-slot'
export interface FormaSchedulerProps {
readonly events: AppointmentEvent[]
/** The same appointments in model form: cards, figures and the menu read them. */
readonly appointments: readonly Appointment[]
readonly text: FormaText
readonly common: DemoCommon
/** BCP 47 tag for labels, and the scheduler locale id. */
readonly tag: string
readonly schedulerLocale: string
/** Slot size on mount. Later changes go through control.zoom so the view animates. */
readonly initialZoom: ZoomId
/** The appointment shown in the detail sheet: it gets the selection ring. */
readonly selected: string | null
/** The patient search ('' shows everyone): applied with events.filter. */
readonly query: string
/** Narrow stage: a slimmer practitioner column. */
readonly narrow: boolean
/** The product skin: a class for the scheduler root (hover cards copy it) and the menu theme. */
readonly skin: { readonly cssClass: string; readonly menuTheme: string }
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, refusal: Refusal) => void
readonly onAction: (action: AppointmentAction, id: string) => void
readonly onZoomLevel: (level: ZoomId) => void
}
/** Where an appointment could go next, by the clinic's rules (menu and sheet share it). */
export function nextSlotOf(
appointment: Appointment,
appointments: readonly Appointment[],
): { start: string; end: string } | null {
const practitioner = practitionerOf(appointment.practitioner)
if (practitioner === null) return null
return nextFreeSlot(
appointment,
practitioner,
BLOCKS,
appointments,
{ first: CLINIC_DAYS.start, count: CLINIC_DAYS.count },
OPENING_HOURS,
)
}
/** Slot sizes: snapping follows the cell, so 15-minute cells move appointments by quarters. */
const SLOT_LEVELS: Readonly<Record<ZoomId, SuperScheduler.ZoomLevelProperties>> = {
fifteen: { scale: 'CellDuration', cellDuration: 15, cellWidth: SLOT_WIDTH.fifteen },
thirty: { scale: 'CellDuration', cellDuration: 30, cellWidth: SLOT_WIDTH.thirty },
}
// Same order as ZOOM_IDS, so onZoom's level index maps back to an id.
const ZOOM_LEVELS: SuperScheduler.ZoomLevel[] = ZOOM_IDS.map((id) => ({
id,
properties: SLOT_LEVELS[id],
}))
const NOW_TICKS = parseCivil(NOW)
/** The avatar (and status chip) on a card, in px. */
const AVATAR = 28
const TODAY_TICKS = parseCivil(TODAY)
const ROOMS_TOTAL = PRACTITIONERS.length
/** Every appointment the control holds right now, in the shape the rules read. */
function appointmentsIn(
control: SuperScheduler.Scheduler,
): Pick<Appointment, 'id' | 'practitioner' | 'start' | 'end'>[] {
return control.events.list.flatMap((event) => {
const practitioner = event.resource === undefined ? null : practitionerOf(event.resource)
if (practitioner === null || !isAppointmentEvent(event)) return []
return [
{
id: String(event.id),
practitioner: practitioner.id,
start: civilOf(event.start),
end: civilOf(event.end),
},
]
})
}
/** Checks one proposed slot of an appointment against the clinic's rules. */
function refusalFor(
control: SuperScheduler.Scheduler | null,
data: object,
id: string,
resource: SuperScheduler.ResourceId,
start: SuperScheduler.Date,
end: SuperScheduler.Date,
): Refusal | null {
const fields = readAppointmentFields(data)
const practitioner = practitionerOf(resource)
if (control === null || fields === null || practitioner === null) return null
return slotRefusal(
{ id, treatment: fields.treatment, start: civil(start.ticks), end: civil(end.ticks) },
practitioner,
BLOCKS,
appointmentsIn(control),
)
}
export function FormaScheduler(props: FormaSchedulerProps) {
const {
events,
appointments,
text,
common,
tag,
schedulerLocale,
initialZoom,
selected,
query,
narrow,
skin,
history,
controlRef,
} = props
const { onEventsChange, onSelect, onMoved, onResized, onRefused, onAction, onZoomLevel } = props
const resources = useMemo(() => toResources(text), [text])
const byId = useMemo(
() => new Map(appointments.map((appointment) => [appointment.id, appointment])),
[appointments],
)
// The drag card shows a refusal while the shadow sits on a forbidden slot; the hook announces
// the last reason when the pointer is released without a drop, so it is heard, not only seen.
const refusal = useDropRefusal(onRefused)
// Visit card: the patient, the care, when and where, how it was booked, and who may deliver it.
const card = useCallback(
(event: SuperScheduler.Event): VisitCardModel | null => {
const appointment = byId.get(String(event.id()))
const practitioner =
appointment === undefined ? null : practitionerOf(appointment.practitioner)
// The appointment open in the sheet needs no card.
if (appointment === undefined || practitioner === null || appointment.id === selected)
return null
const start = parseCivil(appointment.start)
const end = parseCivil(appointment.end)
const day = start - (start % DAY)
const who = new Intl.ListFormat(tag, { type: 'conjunction' }).format(
TREATMENT_DISCIPLINES[appointment.treatment].map(
(discipline) => text.disciplines[discipline],
),
)
const reset = RESET_MINUTES[appointment.treatment]
return {
id: appointment.id,
initials: initials(appointment.patient),
patient: appointment.patient,
code: appointment.id,
treatment: appointment.treatment,
treatmentLabel: text.treatments[appointment.treatment],
status: appointment.status,
statusLabel: text.statuses[appointment.status],
time: {
start,
end,
day: formatDay(start, tag),
startLabel: formatClock(start, tag),
endLabel: formatClock(end, tag),
span: formatSpan(end - start, tag),
window: { start: day + OPENING_HOURS.begin * HOUR, end: day + OPENING_HOURS.end * HOUR },
},
facts: [
{
label: text.fields.practitioner,
value: `${PRACTITIONER_NAMES[practitioner.id]} · ${text.rooms[practitioner.room]}`,
},
{ label: text.fields.channel, value: text.channels[appointment.channel] },
...(reset === 0
? []
: [{ label: text.card.resetLabel, value: plural(text.minutes, reset, tag) }]),
],
rule: format(text.card.deliveredBy, { who }),
hints: defaultHints(common),
}
},
[byId, selected, text, common, tag],
)
const { eventHover, closeHover, suppressHover } = useVisitHover(card)
// Drag verdict: practitioner, the new slot, minutes, and the clinic's reason when it refuses.
const dragCard = useMemo(
() =>
createDragCard({
tag,
common,
rowName: (id) => {
const practitioner = practitionerOf(id)
return practitioner === null
? null
: `${PRACTITIONER_NAMES[practitioner.id]} · ${text.rooms[practitioner.room]}`
},
}),
[tag, common, text],
)
// Context menu: rebuilt when the day changes, so its labels name the real slot and status.
const contextMenu = useMemo(
() =>
createEventMenu({
theme: skin.menuTheme,
title: (event) => format(common.kit.menuTitle, { name: String(event.id()) }),
onOpenChange: (open) => suppressHover(open),
entries: (event) => {
const id = String(event.id())
const appointment = byId.get(id)
if (appointment === undefined) return []
const slot = nextSlotOf(appointment, appointments)
const next = nextStatus(appointment.status)
return [
{
label: common.kit.openDetails,
icon: 'details',
keys: KEYS.details,
run: () => onAction('details', id),
},
{
label: format(text.actions.markAs, { status: text.statuses[next] }),
icon: next === 'done' ? 'confirm' : 'pending',
primary: true,
run: () => onAction('cycle-status', id),
},
'separator',
{
label:
slot === null
? text.actions.noSlot
: format(text.actions.nextSlot, { time: formatWhen(slot.start, tag) }),
icon: 'slot',
disabled: slot === null,
run: () => onAction('next-slot', id),
},
]
},
}),
[byId, appointments, skin, common, text, tag, onAction, suppressHover],
)
// Narrow stages keep the practitioner column only: the load meter steps aside.
const columns = useMemo<SuperScheduler.RowHeaderColumnData[]>(
() =>
narrow
? [
{
name: text.columns.practitioner,
width: PRACTITIONER_COLUMNS.narrowPractitioner,
nonresizable: true,
},
]
: [
{
name: text.columns.practitioner,
width: PRACTITIONER_COLUMNS.practitioner,
nonresizable: true,
},
{ name: text.columns.load, width: PRACTITIONER_COLUMNS.load, nonresizable: true },
],
[narrow, text],
)
const config = useMemo<SchedulerRenderProps>(() => {
const cards = createHtmlCache()
const cells = createHtmlCache(1200)
const rows = createHtmlCache(200)
const headers = createHtmlCache(400)
// Today's load per practitioner, for the meters in their headers.
const loads = new Map(
PRACTITIONERS.map((practitioner) => [
practitioner.id,
utilisation(appointments, BLOCKS, practitioner.id, TODAY, OPENING_HOURS),
]),
)
return {
locale: schedulerLocale,
cssClass: skin.cssClass,
startDate: CLINIC_DAYS.start,
days: CLINIC_DAYS.count,
timeHeaders: [{ groupBy: 'Day' }, { groupBy: 'Cell' }],
headerHeight: HEADER_ROW,
zoomLevels: ZOOM_LEVELS,
zoom: initialZoom,
zoomPosition: 'left',
// The clinic is closed at night: only opening hours are drawn.
businessBeginsHour: OPENING_HOURS.begin,
businessEndsHour: OPENING_HOURS.end,
showNonBusiness: false,
useEventBoxes: 'Never',
height: '100%',
treeEnabled: true,
treePreventParentUsage: true,
treeIndent: 0,
rowHeaderColumns: columns,
rowHeaderColumnsMergeParents: true,
rowHeaderWidth: narrow
? PRACTITIONER_COLUMNS.narrowPractitioner
: PRACTITIONER_COLUMNS.practitioner + PRACTITIONER_COLUMNS.load,
rowHeaderWidthAutoFit: false,
eventHeight: CARD_HEIGHT,
rowMarginTop: CARD_INSET,
rowMarginBottom: CARD_INSET,
eventBorderRadius: 12,
durationBarVisible: false,
// The clinic's now: a calm line through the day, its time in the slot header.
separators: [{ location: NOW, layer: 'AboveEvents', width: 2, cssClass: 'fm-nowline' }],
allowEventOverlap: false,
conflictHighlight: true,
showToolTip: false,
keyboardEnabled: true,
keyboardTarget: 'component',
keyboardMode: 'Full',
history,
controlRef,
onEventsChange,
// The search: an appointment shows when its patient or code matches.
onEventFilter: (args) => {
const param = args.filterParam
const fields = readAppointmentFields(args.e.data)
if (typeof param !== 'string' || fields === null) return
args.visible = matchesSearch({ id: String(args.e.id()), patient: fields.patient }, param)
},
onBeforeTimeHeaderRender: (args) => {
const header = args.header
const start = header.start.ticks
const span = header.end.ticks - start
if (header.level === 0) {
const today = start - (start % DAY) === TODAY_TICKS
header.html = headers(`d:${start}:${span}`, () =>
span <= DAY
? dayHtml(headerLabel(start, 'day', tag, 'group'), today ? text.day.today : null)
: slotHtml(headerLabel(start, unitOfSpan(span, 'group'), tag, 'group'), true),
)
return
}
const minutes = new Date(start).getUTCMinutes()
header.html = headers(`c:${start}:${span}`, () =>
slotHtml(
headerLabel(start, unitOfSpan(span, 'cell'), tag, 'cell', args.control.cellWidth),
minutes === 0,
),
)
header.cssClass = minutes === 0 ? 'fm-slot-cell fm-slot-cell--hour' : 'fm-slot-cell'
if (NOW_TICKS >= start && NOW_TICKS < start + span) {
header.cssClass += ' fm-slot-cell--now'
header.areas = [
{
left: `${((NOW_TICKS - start) / span) * 100}%`,
top: 0,
bottom: 0,
width: 64,
cssClass: 'fm-now-area',
html: headers(`now:${tag}`, () => nowTagHtml(formatClock(NOW_TICKS, tag))),
},
]
}
},
onBeforeRowHeaderRender: (args) => {
const row = args.row
const [first, second] = row.columns
if (row.id === 'rooms') {
row.cssClass = 'fm-rh fm-rh--summary'
const html = rows(`s:${text.summary.label}`, () =>
summaryHeadHtml(text.summary.label, format(text.summary.meta, { total: ROOMS_TOTAL })),
)
row.html = html
if (first !== undefined) first.html = html
return
}
const practitioner = practitionerOf(row.id)
if (practitioner === null) {
row.cssClass = 'fm-rh fm-rh--team'
const count = PRACTITIONERS.filter((candidate) => candidate.team === row.id).length
const html = rows(`t:${String(row.id)}:${row.name}`, () => teamHtml(row.name, count))
row.html = html
if (first !== undefined) first.html = html
return
}
row.cssClass = 'fm-rh fm-rh--person'
const name = PRACTITIONER_NAMES[practitioner.id]
if (first !== undefined)
first.html = rows(`p:${practitioner.id}:${text.roles[practitioner.discipline]}`, () =>
practitionerHtml(initials(name), name, text.roles[practitioner.discipline]),
)
if (second !== undefined) {
const percent = loads.get(practitioner.id) ?? 0
const label = format(text.load, { percent })
second.html = rows(`l:${practitioner.id}:${percent}:${label}`, () =>
loadHtml(percent, label),
)
}
},
// The frozen row counts rooms in use per slot; breaks, meetings and cleaning become disabled
// cells (the library refuses drops on them); the past is quieter.
onBeforeCellRender: (args) => {
const cell = args.cell
const start = cell.start.ticks
const end = cell.end.ticks
if (cell.resource === 'rooms') {
const used = roomsInUse(appointments, civil(start), civil(end))
const label = format(text.summary.cell, { count: used, total: ROOMS_TOTAL })
cell.properties.html = cells(`r:${used}:${label}`, () =>
roomsCellHtml(used, ROOMS_TOTAL, label),
)
cell.properties.cssClass =
start <= NOW_TICKS && NOW_TICKS < end ? 'fm-sum fm-sum--now' : 'fm-sum'
return
}
const practitioner = practitionerOf(cell.resource)
if (practitioner === null) {
cell.properties.cssClass = 'fm-team-cell'
return
}
const past = end <= NOW_TICKS ? 'fm-past' : ''
const cellStart = civil(start)
const block = blockAt(BLOCKS, practitioner.id, cellStart, civil(end))
if (block === null) {
cell.properties.cssClass = past
return
}
cell.properties.disabled = true
cell.properties.cssClass = `fm-block fm-block--${block.kind}${cellStart === block.start ? ' fm-block--first' : ''} ${past}`
if (cellStart === block.start)
cell.properties.html = cells(`b:${block.kind}:${text.blocks[block.kind]}`, () =>
blockHtml(text.blocks[block.kind]),
)
},
onBeforeEventRender: (args) => {
const data = args.data
const fields = readAppointmentFields(data)
if (fields === null) return
const id = String(data.id)
const practitioner = data.resource === undefined ? null : practitionerOf(data.resource)
const room = practitioner === null ? '' : text.rooms[practitioner.room]
const classes = ['fm-ev', `fm-ev--${fields.status}`]
if (id === selected) classes.push('fm-ev--selected')
data.cssClass = classes.join(' ')
data.html = cards(
`${id}:${fields.patient}:${fields.treatment}:${room}:${text.treatments[fields.treatment]}`,
() =>
cardHtml({
patient: fields.patient,
short: shortName(fields.patient),
treatment: fields.treatment,
treatmentLabel: text.treatments[fields.treatment],
room,
}),
)
data.ariaLabel = `${id}, ${fields.patient}, ${text.treatments[fields.treatment]}, ${text.statuses[fields.status]}`
const next = nextStatus(fields.status)
const who = initials(fields.patient)
const areas: SuperScheduler.AreaData[] = [
// The patient's avatar is the status chip: one click moves the visit on (booked →
// arrived → in treatment → done).
{
left: 8,
top: (CARD_HEIGHT - AVATAR) / 2,
width: AVATAR,
height: AVATAR,
action: 'None',
cssClass: `fm-who fm-who--${fields.status}`,
html: cards(`who:${who}:${fields.status}`, () => statusChipHtml(who, fields.status)),
toolTip: format(text.card.statusHint, {
status: text.statuses[fields.status],
next: text.statuses[next],
}),
onClick: () => {
closeHover()
onAction('cycle-status', id)
},
},
]
// The room reset at the end of the slot, anchored in time.
const reset = RESET_MINUTES[fields.treatment]
if (reset > 0) {
const end = data.end.ticks
areas.push({
start: civil(end - reset * MINUTE),
end: civil(end),
top: 0,
bottom: 0,
cssClass: 'fm-reset',
action: 'Default',
toolTip: format(text.card.reset, { minutes: reset }),
})
}
data.areas = areas
},
onEventMoving: (args) => {
const id = String(args.e.id())
const reason = refusalFor(
controlRef.current,
args.e.data,
id,
args.resource,
args.start,
args.end,
)
refusal.track(id, reason)
if (reason !== null) {
args.allowed = false
args.message = text.rules[reason]
}
},
// Final check before the commit; keyboard moves (Alt+arrows) arrive here without a drag.
onEventMove: (args) => {
const id = String(args.e.id())
const reason = refusalFor(
args.control,
args.e.data,
id,
args.newResource,
args.newStart,
args.newEnd,
)
if (reason !== null) {
args.preventDefault()
refusal.clear()
onRefused(id, reason)
}
},
onEventResizing: (args) => {
const id = String(args.e.id())
const resource = args.e.resource()
const reason =
resource === undefined
? null
: refusalFor(controlRef.current, args.e.data, id, resource, args.start, args.end)
refusal.track(id, reason)
if (reason !== null) {
args.allowed = false
args.message = text.rules[reason]
}
},
onEventResize: (args) => {
const id = String(args.e.id())
const resource = args.e.resource()
const reason =
resource === undefined
? null
: refusalFor(args.control, args.e.data, id, resource, args.newStart, args.newEnd)
if (reason !== null) {
args.preventDefault()
refusal.clear()
onRefused(id, reason)
}
},
onEventMoved: (args) => {
refusal.clear()
onMoved(String(args.e.id()))
},
onEventResized: (args) => {
refusal.clear()
onResized(String(args.e.id()))
},
// A click (or Enter) docks the appointment into the detail sheet; the hover card steps aside.
onEventClick: (args) => {
closeHover()
onSelect(String(args.e.id()))
},
onZoom: (args) => {
if (args.phase !== 'end') return
const level = ZOOM_IDS[args.level]
if (level !== undefined) onZoomLevel(level)
},
}
}, [
appointments,
columns,
controlRef,
history,
initialZoom,
narrow,
selected,
skin,
closeHover,
onAction,
onEventsChange,
onMoved,
onRefused,
onResized,
onSelect,
onZoomLevel,
refusal,
schedulerLocale,
tag,
text,
])
// The search goes through the library's event filter; the predicate is onEventFilter above.
useEffect(() => {
controlRef.current?.events.filter(query.trim() === '' ? null : query)
}, [controlRef, query, config])
return (
<SuperSchedulerComponent
{...config}
resources={resources}
events={events}
eventHover={eventHover}
dragCard={dragCard}
contextMenu={contextMenu}
/>
)
}The archive contains this example’s files and a README. It does not include SuperScheduler Pro or any download key.