ProSchedulerSign in

Scheduler · Use cases

24-hour crew rota

A warehouse crew on rotating morning, evening and night shifts. The grid runs from 06:00 to 06:00 the next morning (endTime: "30:00"), so a night shift draws in one piece instead of being cut at midnight.

Live demo

Find a night shift crossing midnight · Drag a shift by an hour · Page to next week

Fullscreen
import { ProScheduler } from "@andreisaac/pro-scheduler"
import { crew, crewShifts } from "./data/shifts"
import { useEvents } from "./kit"

export function CrewRotaDemo() {
  const { events, handlers } = useEvents(() =>
    crewShifts().map((shift) => ({
      ...shift,
      title: String(crew.find((person) => person.id === shift.resource)?.name ?? ""),
    }))
  )

  return (
    <ProScheduler
      data={events}
      resources={crew}
      // 06:00 to 06:00 the next morning: night shifts draw in one piece.
      view={{
        scheduler: { type: "week", startTime: "06:00", endTime: "30:00", timeLabelStep: 120, dragTimeStep: 60 },
      }}
      styleConfig={{ hourHeightPx: 36 }}
      renderEventContent={({ original, start, end }) => (
        <div className="grid text-[11px] leading-tight">
          <strong className="truncate">{original.title}</strong>
          <span className="truncate opacity-85">
            {String(original.shift)} · {start.getHours()}–{end.getHours()}h
          </span>
        </div>
      )}
      height={640}
      {...handlers}
    />
  )
}

About this demo

A warehouse crew on rotating morning, evening and night shifts. The grid runs from 06:00 to 06:00 the next morning (endTime: "30:00"), so a night shift draws in one piece instead of being cut at midnight.

Things to try

  • Find a night shift crossing midnight
  • Drag a shift by an hour
  • Page to next week

The props behind it are explained in Views.

Use ProScheduler in your project