import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { LayersIcon, EyeIcon, EyeOffIcon, ShieldAlertIcon } from "@/components/ui/phosphor-icons"; import { LAND_MARKER_LABELS, LAND_MARKER_COLORS } from "@/lib/map-data"; import type { UserMarker } from "@/components/leaflet-map"; import { calcLineLength, calcPolygonArea } from "@/components/land/shape-placement-dialog"; function formatDate(iso?: string): string { if (!iso) return "—"; return new Date(iso).toLocaleDateString("id-ID", { year: "numeric", month: "short", day: "numeric" }); } interface LandInspectorTopProps { selectedItem: UserMarker | null; visibilityFilters: Record; toggleFilter: (type: string) => void; } export function LandInspectorTop({ selectedItem, visibilityFilters, toggleFilter }: LandInspectorTopProps) { if (!selectedItem) { return ( Boundary Inspector Reviewing border registries.

Belum ada item dipilih. Buka peta atau pilih item dari direktori.

); } const color = LAND_MARKER_COLORS[selectedItem.type] ?? "#6b7280"; const label = LAND_MARKER_LABELS[selectedItem.type] ?? selectedItem.type; const coordinates = selectedItem.meta?.coordinates ?? []; const radius = selectedItem.meta?.radius ?? 0; const length = selectedItem.type === "line" ? calcLineLength(coordinates) : 0; return ( Boundary Inspector Reviewing border registries.

{selectedItem.name}

{label}
{selectedItem.type === "polygon" && coordinates.length > 0 && (
Luas Terdaftar: {(calcPolygonArea(coordinates) / 10000).toFixed(2)} Ha
)} {selectedItem.type === "line" && coordinates.length > 0 && (
Panjang: {length >= 1000 ? `${(length / 1000).toFixed(2)} km` : `${length.toFixed(1)} m`}
)} {selectedItem.type === "circle" && (
Radius: {radius.toFixed(1)} m
)} {(selectedItem.type === "line" || selectedItem.type === "polygon") && selectedItem.meta?.poi_type && (
Status: {selectedItem.meta.poi_type}
)}
Created By: {selectedItem.meta?.created_by_username ?? "—"}
Created: {formatDate(selectedItem.meta?.created_at)}
Visibility filter status:
); } interface LandInspectorBottomProps { recentFlags: UserMarker[]; } export function LandInspectorBottom({ recentFlags }: LandInspectorBottomProps) { return ( Surveyor Logs {recentFlags.length > 0 ? ( recentFlags.map((flag) => (
{flag.name}
{flag.meta?.notes && (

{flag.meta.notes}

)} Reported: {formatDate(flag.meta?.created_at)}
)) ) : (

Belum ada tengara lahan tercatat.

)}
); }