import React from "react"; import { Ban, Globe, Moon, Sun, Users } from "lucide-react"; import { GradientIcon } from "~/components/ui/GradientIcon"; import { Input } from "~/components/ui/input"; import { Label } from "~/components/ui/label"; import { TimezoneSelect } from "~/components/league/TimezoneSelect"; import { cn } from "~/lib/utils"; export interface OvernightPauseSettingsProps { show: boolean; mode: "none" | "league" | "per_user"; onModeChange: (v: "none" | "league" | "per_user") => void; start: string; onStartChange: (v: string) => void; end: string; onEndChange: (v: string) => void; timezone: string; onTimezoneChange: (v: string) => void; commishTimezone?: string | null; disabled?: boolean; } const PAUSE_MODES = [ { value: "none" as const, icon: Ban, label: "No Pause", sub: "Timer always runs" }, { value: "league" as const, icon: Globe, label: "League", sub: "Same pause for everyone" }, { value: "per_user" as const, icon: Users, label: "Per Player", sub: "Pauses in each player's timezone" }, ]; export function OvernightPauseSettings({ show, mode, onModeChange, start, onStartChange, end, onEndChange, timezone, onTimezoneChange, commishTimezone, disabled, }: OvernightPauseSettingsProps) { if (!show) return null; const PAUSE_VALUES = PAUSE_MODES.map((m) => m.value); function handleGroupKeyDown(e: React.KeyboardEvent) { if (disabled) return; if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"].includes(e.key)) return; e.preventDefault(); const idx = PAUSE_VALUES.indexOf(mode); const next = e.key === "ArrowDown" || e.key === "ArrowRight" ? (idx + 1) % PAUSE_VALUES.length : (idx - 1 + PAUSE_VALUES.length) % PAUSE_VALUES.length; const nextValue = PAUSE_VALUES[next]; onModeChange(nextValue); e.currentTarget.querySelector(`[data-radio-value="${nextValue}"]`)?.focus(); } return (
{PAUSE_MODES.map(({ value, icon: Icon, label, sub }) => { const selected = mode === value; return ( ); })}
{mode !== "none" && (
onStartChange(e.target.value)} />
onEndChange(e.target.value)} />
{mode === "per_user" && (

Each player's profile timezone is used. Players without one fall back to the timezone below. {!commishTimezone && ( <> You haven't set your timezone yet — set it in your profile. )}

)}
)}
); }