ProSchedulerSign in

Timeline · Drag & drop

Prevent event overlap

With eventOverlap={false} nobody can be double-booked: a bar dropped over another turns red and snaps back.

Live demo

Drop an assignment on someone already booked

Fullscreen
import { ProScheduler, type PschValidationFailure } from "@andreisaac/pro-scheduler"
import { studioAssignments, studioResources } from "./data/studio"
import { Log, useEvents, useLog } from "./kit"

function reason(failure: PschValidationFailure) {
  return failure.reason === "invalid"
    ? `blocked (${failure.invalid?.title ?? "unavailable"})`
    : `overlaps "${failure.overlapping?.title}"`
}

export function TimelineOverlapDemo() {
  const { events, handlers } = useEvents(studioAssignments)
  const { lines, log } = useLog()

  return (
    <div className="docs-demo__stack">
      <ProScheduler
        data={events}
        resources={studioResources}
        view={{ timeline: { type: "month" } }}
        eventOverlap={false}
        onEventUpdateFailed={(f) => log(`"${f.event.title}" ${reason(f)}`)}
        onEventCreateFailed={(f) => log(`New assignment ${reason(f)}`)}
        height={500}
        {...handlers}
      />
      <Log lines={lines} empty="Drop an assignment on someone who's already booked…" />
    </div>
  )
}

About this demo

With eventOverlap={false} nobody can be double-booked: a bar dropped over another turns red and snaps back.

Things to try

  • Drop an assignment on someone already booked

The props behind it are explained in Rules and backgrounds.

Use ProScheduler in your project