import type { LucideIcon } from "lucide-react"; import { Download, ListChecks, MapPinned, Plus, Share2 } from "lucide-react"; import { cn } from "@/lib/utils"; import { MapActionRow, MapPanelSection } from "./control-panel"; import { MAP_READABLE_RADIUS_CLASS_NAME, MAP_READABLE_SURFACE_CLASS_NAME } from "./map-control-styles"; export type MapAnnotationItem = { id: string; label: string; description: string; icon?: LucideIcon; status?: string; selected?: boolean; muted?: boolean; onClick?: () => void; }; export type MapAnnotationShareAction = { id: string; label: string; description: string; icon?: LucideIcon; onClick?: () => void; }; export type MapAnnotationPanelProps = { annotations: MapAnnotationItem[]; shareActions?: MapAnnotationShareAction[]; emptyText?: string; }; export function MapAnnotationPanel({ annotations, shareActions = [], emptyText = "暂无标注" }: MapAnnotationPanelProps) { return (
{annotations.length > 0 ? ( annotations.map((annotation) => ( )) ) : (
{emptyText}
)}
{shareActions.length > 0 ? ( {shareActions.map((action) => ( ))} ) : null}
); } function getDefaultAnnotationIcon(status?: string) { if (status) { return ListChecks; } return MapPinned; } function getDefaultShareIcon(actionId: string) { if (actionId.includes("export") || actionId.includes("download")) { return Download; } if (actionId.includes("share")) { return Share2; } return Plus; }