diff --git a/frontend/src/routes/_layout/index.tsx b/frontend/src/routes/_layout/index.tsx index f85ab3e..583bae7 100644 --- a/frontend/src/routes/_layout/index.tsx +++ b/frontend/src/routes/_layout/index.tsx @@ -1,6 +1,8 @@ import { createFileRoute } from "@tanstack/react-router" import L from "leaflet" import { + ChevronDown, + ChevronUp, Clock, Layers, Maximize, @@ -15,13 +17,7 @@ import "leaflet/dist/leaflet.css" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@/components/ui/card" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { DropdownMenu, DropdownMenuContent, @@ -445,6 +441,7 @@ function Dashboard() { const { snapshot, status, disconnectedAt } = useTelemetryWS() const [baseMap, setBaseMap] = useState("amap") const [activeDeviceId, setActiveDeviceId] = useState("") + const [isPanelExpanded, setIsPanelExpanded] = useState(true) const activeDeviceIdRef = useRef(activeDeviceId) activeDeviceIdRef.current = activeDeviceId @@ -637,89 +634,113 @@ function Dashboard() { })} - - {/* Selected Device Panel — placed at bottom, compact */} - - - - Selected Device - {activeDevice?.signal_health && - signalHealthBadge(activeDevice.signal_health)} - - - Click a marker on the map to view detailed device info - - - -
-

Device ID

-

- {activeDevice?.device_id ?? "-"} -

-
-
-

Latitude

-

- {formatCoord(activeDevice?.lat ?? null)} -

-
-
-

Longitude

-

- {formatCoord(activeDevice?.lon ?? null)} -

-
-
-

- - Altitude -

-

- {activeDevice?.alt_m !== null && activeDevice?.alt_m !== undefined - ? `${activeDevice.alt_m.toFixed(1)} m` - : "-"} -

-
-
-

Fix Status

-

+ + setIsPanelExpanded(!isPanelExpanded)} > - {getFixStatusLabel(activeDevice?.fix_status ?? null)} -

-
-
-

- - Satellites -

-

- {activeDevice?.satellites_used ?? "-"} -

-
-
-

- - Signal Score -

-

- {activeDevice?.signal_health - ? `${activeDevice.signal_health.score}%` - : "-"} -

-
-
-

- - Last Seen -

-

- {timeAgo(activeDevice?.last_event_time ?? null)} -

-
-
-
+ + Selected Device + {activeDevice?.signal_health && + !isPanelExpanded && + signalHealthBadge(activeDevice.signal_health)} + +
+ {activeDevice?.signal_health && + isPanelExpanded && + signalHealthBadge(activeDevice.signal_health)} + +
+ + {isPanelExpanded && ( + +
+

Device ID

+

+ {activeDevice?.device_id ?? "-"} +

+
+
+

Latitude

+

+ {formatCoord(activeDevice?.lat ?? null)} +

+
+
+

Longitude

+

+ {formatCoord(activeDevice?.lon ?? null)} +

+
+
+

+ + Altitude +

+

+ {activeDevice?.alt_m !== null && + activeDevice?.alt_m !== undefined + ? `${activeDevice.alt_m.toFixed(1)} m` + : "-"} +

+
+
+

Fix Status

+

+ {getFixStatusLabel(activeDevice?.fix_status ?? null)} +

+
+
+

+ + Satellites +

+

+ {activeDevice?.satellites_used ?? "-"} +

+
+
+

+ + SNR +

+

+ {activeDevice?.signal_health + ? `${activeDevice.signal_health.score}%` + : "-"} +

+
+
+

+ + Last Seen +

+

+ {timeAgo(activeDevice?.last_event_time ?? null)} +

+
+
+ )} + + + ) }