"use client" import { Button } from "@/app/_components/ui/button" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/app/_components/ui/tooltip" import { AlertTriangle, Building, Car, Thermometer, History } from "lucide-react" import type { ITooltipsControl } from "./tooltips" import { IconChartBubble, IconClock } from "@tabler/icons-react" // Define the primary crime data controls const crimeTooltips = [ // { id: "incidents" as ITooltipsControl, icon: , label: "All Incidents" }, { id: "heatmap" as ITooltipsControl, icon: , label: "Density Heatmap" }, { id: "units" as ITooltipsControl, icon: , label: "Police Units" }, { id: "clusters" as ITooltipsControl, icon: , label: "Clustered Incidents" }, { id: "patrol" as ITooltipsControl, icon: , label: "Patrol Areas" }, { id: "timeline" as ITooltipsControl, icon: , label: "Time Analysis" }, ] interface CrimeTooltipsProps { activeControl?: string onControlChange?: (controlId: ITooltipsControl) => void sourceType?: string } export default function CrimeTooltips({ activeControl, onControlChange, sourceType = "cbt" }: CrimeTooltipsProps) { const handleControlClick = (controlId: ITooltipsControl) => { // If control is disabled, don't do anything if (isDisabled(controlId)) { return } // Force the value to be set when clicking if (onControlChange) { onControlChange(controlId) console.log("Control changed to:", controlId) } } // Determine which controls should be disabled based on source type const isDisabled = (controlId: ITooltipsControl) => { return sourceType === "cbu" && controlId !== "clusters" } return (
{crimeTooltips.map((control) => { const isButtonDisabled = isDisabled(control.id) return (

{isButtonDisabled ? "Not available for CBU data" : control.label}

) })}
) }