import type {
  PublicTruckEvent,
  PublicTruckRecurrence,
} from "@/lib/truck-schedule-shared";
import { WeekScheduleCalendar } from "./WeekScheduleCalendar";

type Props = {
  events: PublicTruckEvent[];
  recurrences: PublicTruckRecurrence[];
  intro: string;
};

export function ScheduleSection({ events, recurrences, intro }: Props) {
  return (
    <section
      id="ou-me-trouver"
      className="scroll-mt-24 border-t border-chocolat/8 bg-cream px-4 py-20 sm:px-6"
    >
      <div className="mx-auto max-w-6xl">
        <div className="text-center">
          <h2 className="text-3xl font-bold text-chocolat sm:text-4xl">
            Où me trouver
          </h2>
          {intro.trim() ? (
            <p className="mx-auto mt-3 max-w-2xl text-muted">{intro}</p>
          ) : (
            <p className="mx-auto mt-3 max-w-2xl text-muted">
              Retrouvez le food truck Gaufrement Bon sur les marchés et événements
              de la semaine.
            </p>
          )}
        </div>
        <WeekScheduleCalendar events={events} recurrences={recurrences} />
      </div>
    </section>
  );
}
