"use client"; import { useTheme } from "~/hooks/useTheme.js"; import type { AccentColor, ThemeMode } from "~/hooks/useTheme.js"; import { useAppPreferences, type HeatmapColorScheme } from "~/hooks/useAppPreferences.js"; import { motion } from "framer-motion"; import { clsx } from "clsx"; interface PreferencesModalProps { onClose: () => void; } const ACCENT_OPTIONS: { value: AccentColor; label: string; swatch: string }[] = [ { value: "sky", label: "Sky", swatch: "#0284c7" }, { value: "indigo", label: "Indigo", swatch: "#4f46e5" }, { value: "violet", label: "Violet", swatch: "#7c3aed" }, { value: "emerald", label: "Emerald", swatch: "#059669" }, { value: "rose", label: "Rose", swatch: "#e11d48" }, { value: "amber", label: "Amber", swatch: "#d97706" }, ]; export function PreferencesModal({ onClose }: PreferencesModalProps) { const { prefs, setMode, setAccent } = useTheme(); const { prefs: appPrefs, setHideCompletedProjects, setTimelineDisplayMode, setHeatmapColorScheme, setShowDemandProjects, setBlinkOverbookedDays } = useAppPreferences(); return (
{ if (e.target === e.currentTarget) onClose(); }} > {/* Header */}

Preferences

{/* Theme mode */}
{(["light", "dark"] as ThemeMode[]).map((mode) => ( ))}
{/* Accent color */}
{ACCENT_OPTIONS.map((opt) => ( ))}
{/* Timeline defaults */}
{/* Display mode */}

Row display style

{([ { value: "strip", label: "Strips", desc: "Classic Gantt blocks" }, { value: "bar", label: "Bars", desc: "Daily stacked hours" }, { value: "heatmap", label: "Heatmap", desc: "Utilisation colours" }, ] as const).map((opt) => ( ))}
{/* Heatmap color scheme */}

Heatmap color scale

{([ { value: "green-red" as HeatmapColorScheme, label: "Green → Red", stops: ["#22c55e","#84cc16","#facc15","#f97316","#ef4444"], }, { value: "blue-orange" as HeatmapColorScheme, label: "Blue → Orange", stops: ["#38bdf8","#3b82f6","#fbbf24","#f97316","#ef4444"], }, { value: "purple-yellow" as HeatmapColorScheme, label: "Purple → Yellow", stops: ["#a78bfa","#8b5cf6","#facc15","#f59e0b","#ef4444"], }, { value: "mono" as HeatmapColorScheme, label: "Monochrome", stops: ["#9ca3af","#6b7280","#4b5563","#374151","#111827"], }, ]).map((opt) => ( ))}
{/* Overbooked blink */}