"use client"; import { Target, TriangleAlert, X } from "lucide-react"; import { useMemo } from "react"; import type { DetailFeature } from "../types"; import { formatFeaturePropertyValue, getLocalizedFeatureProperties } from "../utils/feature-properties"; type FeatureInsightPanelProps = { feature: DetailFeature | null; onClose: () => void; }; export function FeatureInsightPanel({ feature, onClose }: FeatureInsightPanelProps) { const metrics = useMemo(() => { if (!feature) { return []; } if (feature.layer === "pipes") { return [ ["管径", formatFeaturePropertyValue("diameter", feature.properties.diameter)], ["长度", formatFeaturePropertyValue("length", feature.properties.length)], ["粗糙系数", formatFeaturePropertyValue("roughness", feature.properties.roughness)], ["状态", formatFeaturePropertyValue("status", feature.properties.status)] ]; } return [ ["高程", formatFeaturePropertyValue("elevation", feature.properties.elevation)], ["需水量", formatFeaturePropertyValue("demand", feature.properties.demand)], ["对象类型", "管网节点"], ["状态", "在线"] ]; }, [feature]); const propertyEntries = useMemo(() => { if (!feature) { return []; } return getLocalizedFeatureProperties(feature.properties); }, [feature]); return ( ); }