ProSchedulerSign in

Timeline · Use cases

Restaurant shift management

Lunch and dinner services for the floor team, coloured by role; the restaurant is closed on Mondays.

Live demo

Move a dinner service · Find who covers Sunday lunch

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

const hhmm = (d: Date) => d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })

const roleColors: Record<string, string> = {
  Chef: "#dc2626",
  Waiter: "#2563eb",
  Bartender: "#db2777",
  Host: "#059669",
}

export function RestaurantShiftsDemo() {
  const { events, handlers } = useEvents(() =>
    restaurantShifts().map((service) => {
      const role = String(floorTeam.find((p) => p.id === service.resource)?.role)
      return { ...service, color: roleColors[role] }
    })
  )

  return (
    <ProScheduler
      data={events}
      resources={floorTeam}
      view={{ timeline: { type: "week", resolutionHorizontal: "hour", dragTimeStep: 30 } }}
      styleConfig={{ unitWidthPx: 16, fitToWidth: false, laneHeight: 30 }}
      renderResource={(person) => (
        <div className="flex items-center gap-2">
          <span className="size-2.5 rounded-full" style={{ background: roleColors[String(person.role)] }} />
          <span className="text-sm font-medium">{person.name}</span>
          <span className="text-xs text-muted-foreground">{String(person.role)}</span>
        </div>
      )}
      renderEventContent={({ original, start, end }) => (
        <span className="truncate">
          {original.title} {hhmm(start)}–{hhmm(end)}
        </span>
      )}
      height={460}
      {...handlers}
    />
  )
}

About this demo

Lunch and dinner services for the floor team, coloured by role; the restaurant is closed on Mondays.

Things to try

  • Move a dinner service
  • Find who covers Sunday lunch

The props behind it are explained in Resources.

Use ProScheduler in your project