WitNote / dashboard /src /components /atoms /DebugPanel.tsx
AUXteam's picture
Upload folder using huggingface_hub
6a7089a verified
import { useState } from "react";
import { useAppStore } from "../../stores/useAppStore";
export default function DebugPanel() {
const [open, setOpen] = useState(false);
const store = useAppStore();
if (!open) {
return (
<button
onClick={() => setOpen(true)}
className="fixed bottom-2 right-2 z-50 rounded bg-yellow-500 px-2 py-1 text-xs text-black"
>
๐Ÿ› Debug
</button>
);
}
return (
<div className="fixed bottom-2 right-2 z-50 max-h-96 w-80 overflow-auto rounded border border-yellow-500 bg-black/90 p-2 text-xs text-green-400 font-mono">
<div className="flex justify-between mb-2">
<span className="text-yellow-500 font-bold">Debug Panel</span>
<button onClick={() => setOpen(false)} className="text-white">
โœ•
</button>
</div>
<div className="space-y-1">
<div>instances: {store.instances?.length ?? "null"}</div>
<div>profiles: {store.profiles?.length ?? "null"}</div>
<div>agents: {store.agents?.length ?? "null"}</div>
<div>tabsChartData: {store.tabsChartData?.length ?? "null"}</div>
<div>serverChartData: {store.serverChartData?.length ?? "null"}</div>
<div>memoryChartData: {store.memoryChartData?.length ?? "null"}</div>
<div>selectedAgentId: {store.selectedAgentId ?? "null"}</div>
<div>profilesLoading: {String(store.profilesLoading)}</div>
<div>instancesLoading: {String(store.instancesLoading)}</div>
<div className="mt-2 text-yellow-500">Instances:</div>
{store.instances?.map((i) => (
<div key={i.id} className="ml-2 text-gray-400">
{i.id}: {i.status} ({i.profileName})
</div>
))}
</div>
</div>
);
}