import type React from "react"; import { useState } from "react"; import { useDevice } from "@app/core/providers/useDevice.js"; import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/outline"; export const Drawer = (): JSX.Element => { const [drawerOpen, setDrawerOpen] = useState(false); const tabs = [{ title: "Notifications" }, { title: "Debug" }]; const { config, moduleConfig, hardware, nodes, waypoints, connection } = useDevice(); const [serialLogs, setSerialLogs] = useState(""); connection?.onDeviceDebugLog.subscribe((packet) => { setSerialLogs(serialLogs + new TextDecoder().decode(packet)); }); return (
{ setDrawerOpen(!drawerOpen); }} className="ml-auto flex px-2 hover:cursor-pointer hover:bg-slate-100" >
{drawerOpen ? ( ) : ( )}
{serialLogs.split("\n").map((line, index) => (
{line}
))}
); };