import type { LucideIcon } from "lucide-react"; import { Copy, Ruler, Trash2 } from "lucide-react"; import { cn } from "@/lib/utils"; import { MapActionRow, MapModeButton, MapPanelSection } from "./control-panel"; import { MAP_COMPACT_RADIUS_CLASS_NAME, MAP_READABLE_RADIUS_CLASS_NAME, MAP_READABLE_SURFACE_CLASS_NAME, MAP_READABLE_SURFACE_STRONG_CLASS_NAME } from "./map-control-styles"; export type MapMeasureMode = { id: string; label: string; icon: LucideIcon; disabled?: boolean; }; export type MapMeasureUnit = { id: string; label: string; }; export type MapMeasureResultMetric = { label: string; value: string; }; export type MapMeasureAction = { id: string; label: string; description: string; icon?: LucideIcon; strong?: boolean; variant?: "default" | "primary"; tone?: "default" | "danger"; disabled?: boolean; onClick?: () => void; }; export type MapMeasurePanelProps = { modes: MapMeasureMode[]; activeModeId: string; resultLabel: string; resultValue: string; resultUnit: string; metrics?: MapMeasureResultMetric[]; units: MapMeasureUnit[]; activeUnitId: string; actions: MapMeasureAction[]; onSelectMode?: (id: string) => void; onSelectUnit?: (id: string) => void; }; export function MapMeasurePanel({ modes, activeModeId, resultLabel, resultValue, resultUnit, metrics = [], units, activeUnitId, actions, onSelectMode, onSelectUnit }: MapMeasurePanelProps) { return (
{modes.map((mode) => ( onSelectMode?.(mode.id)} /> ))}
{resultLabel}
{resultValue} {resultUnit}
{metrics.length > 0 ? (
{metrics.map((metric) => (
{metric.label}
{metric.value}
))}
) : null}
{units.map((unit) => ( ))}
{actions.map((action) => ( ))}
); } function getDefaultActionIcon(actionId: string) { if (actionId.includes("copy")) { return Copy; } if (actionId.includes("clear") || actionId.includes("delete")) { return Trash2; } return Ruler; }