-
-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathpanel.tsx
More file actions
70 lines (65 loc) · 2.08 KB
/
Copy pathpanel.tsx
File metadata and controls
70 lines (65 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { render } from "preact";
import { useSignal } from "@preact/signals";
import { EmptyState } from "./components/EmptyState";
import { Header } from "./components/Header";
import { SettingsPanel } from "./components/SettingsPanel";
import { GraphVisualization } from "./components/Graph";
import { updatesStore } from "./models/UpdatesModel";
import { UpdatesContainer } from "./components/UpdatesContainer";
import { connectionStore } from "./models/ConnectionModel";
import { settingsStore } from "./models/SettingsModel";
function SignalsDevToolsPanel() {
const activeTab = useSignal<"updates" | "graph">("updates");
return (
<div id="app">
<Header onToggleSettings={settingsStore.toggleSettings} />
<SettingsPanel
isVisible={settingsStore.showSettings}
onApply={settingsStore.applySettings}
onCancel={settingsStore.hideSettings}
/>
<main className="main-content">
<div className="tabs">
<button
className={`tab ${activeTab.value === "updates" ? "active" : ""}`}
onClick={() => (activeTab.value = "updates")}
>
Updates
</button>
<button
className={`tab ${activeTab.value === "graph" ? "active" : ""}`}
onClick={() => (activeTab.value = "graph")}
>
Dependency Graph
</button>
</div>
<div className="tab-content">
{!connectionStore.isConnected ? (
<EmptyState onRefresh={connectionStore.refreshConnection} />
) : (
<>
{activeTab.value === "updates" && (
<UpdatesContainer
updates={updatesStore.updates.value}
signalCounts={updatesStore.signalCounts.value}
/>
)}
{activeTab.value === "graph" && (
<GraphVisualization updates={updatesStore.updates} />
)}
</>
)}
</div>
</main>
</div>
);
}
// Initialize the panel when DOM is loaded
document.addEventListener("DOMContentLoaded", () => {
const container = document.getElementById("app");
if (container) {
// Clear existing content since we're taking over with Preact
container.innerHTML = "";
render(<SignalsDevToolsPanel />, container);
}
});