// In file: src/app/page.tsx some basic changes in order to test gitea "use client"; import { useState, useEffect } from "react"; import dynamic from "next/dynamic"; import { getCommands, getLatestGPS, DeviceCommand, TelemetryPost, DeviceCommandType, postReceipt } from "~/lib/api"; // Assuming postCommand will be added later import { CommandManager } from "~/app/_components/CommandManager"; // Dynamically import the map component with SSR turned OFF to prevent "window is not defined" errors const DeviceMap = dynamic( () => import("~/app/_components/DynamicDeviceMap").then((mod) => mod.DeviceMap), { ssr: false, loading: () =>

Loading map...

, } ); const DEFAULT_IMEI = "sim7080g-01"; // Or make this dynamic later export default function Dashboard() { const [selectedImei, setSelectedImei] = useState(DEFAULT_IMEI); const [telemetry, setTelemetry] = useState(null); const [commands, setCommands] = useState([]); const [fence, setFence] = useState>([]); const [commandType, setCommandType] = useState("sleep"); const [payload, setPayload] = useState(""); useEffect(() => { const pollData = async () => { try { const latest = await getLatestGPS(selectedImei); setTelemetry(latest); const cmds = await getCommands(selectedImei); setCommands(cmds); } catch (e) { console.error("Poll error:", e); } }; pollData(); // Initial fetch const interval = setInterval(pollData, 5000); return () => clearInterval(interval); }, [selectedImei]); return (

Device Dashboard ({selectedImei})

Latest Telemetry

{telemetry ? (
{JSON.stringify(telemetry, null, 2)}
) : (

Loading telemetry...

)}

Map & Geo-Fence

{telemetry ? ( ) : (

Waiting for GPS data...

)}

Geo-fence points: {fence.length}

Queued Commands

{commands.length > 0 ? JSON.stringify(commands, null, 2) : "No commands queued."}
{commands.length > 0 && ( )}

Command Center

{/* <-- ADD THE NEW COMPONENT HERE */}
); }