import { Swords, CalendarIcon } from "lucide-react"; import { useLocalTimezone } from "~/hooks/useLocalTimezone"; import { format } from "date-fns"; import { Label } from "~/components/ui/label"; import { Input } from "~/components/ui/input"; import { Button } from "~/components/ui/button"; import { Badge } from "~/components/ui/badge"; import { Calendar } from "~/components/ui/calendar"; import { Popover, PopoverContent, PopoverTrigger } from "~/components/ui/popover"; import { cn } from "~/lib/utils"; import { TimerModeSelector } from "~/components/league/TimerModeSelector"; import { DraftSpeedPicker } from "~/components/league/DraftSpeedPicker"; import { OvernightPauseSettings } from "~/components/league/OvernightPauseSettings"; import { StepperInput } from "~/components/league/StepperInput"; import { Checkbox } from "~/components/ui/checkbox"; import { SettingsSection, SettingsStatusPill } from "./SettingsSection"; export function DraftSetupSection({ active, canEditDraftRounds, minRounds, recommendedRounds, flexSpots, draftRounds, onDraftRoundsChange, draftDate, onDraftDateChange, draftTime, onDraftTimeChange, autoStartDraft, onAutoStartDraftChange, timerMode, onTimerModeChange, draftSpeed, onDraftSpeedChange, overnightMode, onOvernightModeChange, overnightStart, onOvernightStartChange, overnightEnd, onOvernightEndChange, overnightTimezone, onOvernightTimezoneChange, commishTimezone, }: { active: boolean; canEditDraftRounds: boolean; minRounds: number; recommendedRounds: number; flexSpots: number; draftRounds: number; onDraftRoundsChange: (v: number) => void; draftDate: Date | undefined; onDraftDateChange: (v: Date | undefined) => void; draftTime: string; onDraftTimeChange: (v: string) => void; autoStartDraft: boolean; onAutoStartDraftChange: (v: boolean) => void; timerMode: "chess_clock" | "standard"; onTimerModeChange: (v: "chess_clock" | "standard") => void; draftSpeed: string; onDraftSpeedChange: (v: string) => void; overnightMode: "none" | "league" | "per_user"; onOvernightModeChange: (v: "none" | "league" | "per_user") => void; overnightStart: string; onOvernightStartChange: (v: string) => void; overnightEnd: string; onOvernightEndChange: (v: string) => void; overnightTimezone: string; onOvernightTimezoneChange: (v: string) => void; commishTimezone: string | null; }) { const localTz = useLocalTimezone(); return ( {canEditDraftRounds ? "Editable" : "Locked"}} className={active ? undefined : "hidden"} > {draftDate && draftTime ? ( ) : ( )}

Minimum {minRounds}; recommended {recommendedRounds}.

{flexSpots} flex
{!canEditDraftRounds && (

Round count cannot be changed after draft starts.

)}
onDraftDateChange(date)} disabled={(date) => date < new Date(new Date().setHours(0, 0, 0, 0))} /> onDraftTimeChange(e.target.value)} disabled={!canEditDraftRounds} />

Set this before starting the draft room. {localTz && <> Times are in your local timezone ({localTz}).}

{draftDate && draftTime && (
onAutoStartDraftChange(v === true)} disabled={!canEditDraftRounds} />
)}
); }