ProSchedulerSign in

Timeline · Use cases

Two synchronized schedules

Two terminals' gates, one date: a shared controlled refDate keeps them on the same day, and flights move between them with externalDrag + externalDrop.

Live demo

Move a flight to Terminal 2 · Page to tomorrow in either one

Fullscreen
import { useState } from "react"
import { ProScheduler, type SchedulerResource } from "@andreisaac/pro-scheduler"
import { flights, terminalOne, terminalTwo } from "./data/planning"
import { useEvents } from "./kit"

export function DualScheduleDemo() {
  const today = flights()
  const one = useEvents(() => today.filter((f) => String(f.resource).startsWith("a")))
  const two = useEvents(() => today.filter((f) => String(f.resource).startsWith("b")))
  // One date for both: navigating either moves the other.
  const [date, setDate] = useState(() => new Date())
  const terminal = (side: typeof one, gates: SchedulerResource[]) => (
    <ProScheduler
      data={side.events}
      resources={gates}
      refDate={date}
      onSelectedDateChange={setDate}
      view={{ timeline: { type: "day", startTime: "05:00", endTime: "16:00" } }}
      styleConfig={{ unitWidthPx: 70, fitToWidth: true }}
      externalDrag
      externalDrop
      height={240}
      {...side.handlers}
    />
  )
  return (
    <div className="flex flex-col gap-3">
      {terminal(one, terminalOne)}
      {terminal(two, terminalTwo)}
    </div>
  )
}

About this demo

Two terminals' gates, one date: a shared controlled refDate keeps them on the same day, and flights move between them with externalDrag + externalDrop.

Things to try

  • Move a flight to Terminal 2
  • Page to tomorrow in either one

The props behind it are explained in Selection, drag and drop, links.

Use ProScheduler in your project