muthuk1 commited on
Commit
760f595
·
verified ·
1 Parent(s): 79e7b4f

Add DashboardTabs controller + 4 tab panels

Browse files
web/src/components/DashboardTabs.tsx ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+
3
+ import { useState } from "react";
4
+ import { LiveCompare } from "./tabs/LiveCompare";
5
+ import { Benchmark } from "./tabs/Benchmark";
6
+ import { CostAnalysis } from "./tabs/CostAnalysis";
7
+ import { GraphExplorer } from "./tabs/GraphExplorer";
8
+
9
+ const TABS = [
10
+ { id: "live", label: "Live Compare", icon: "🔴", color: "#FF6B00" },
11
+ { id: "benchmark", label: "Benchmark", icon: "📊", color: "#0072CE" },
12
+ { id: "cost", label: "Cost Analysis", icon: "💰", color: "#cc785c" },
13
+ { id: "graph", label: "Graph Explorer", icon: "🕸️", color: "#5db8a6" },
14
+ ] as const;
15
+
16
+ type TabId = (typeof TABS)[number]["id"];
17
+
18
+ export function DashboardTabs() {
19
+ const [active, setActive] = useState<TabId>("live");
20
+
21
+ return (
22
+ <section className="section-sm" style={{ background: "var(--color-surface-soft)" }}>
23
+ <div className="container">
24
+ {/* Tab bar */}
25
+ <div className="tab-bar mb-8">
26
+ {TABS.map((tab) => (
27
+ <button
28
+ key={tab.id}
29
+ id={tab.id}
30
+ className={`tab-item ${active === tab.id ? "tab-item-active" : ""}`}
31
+ onClick={() => setActive(tab.id)}
32
+ style={
33
+ active === tab.id
34
+ ? { borderBottom: `2px solid ${tab.color}` }
35
+ : undefined
36
+ }
37
+ >
38
+ <span className="mr-2">{tab.icon}</span>
39
+ {tab.label}
40
+ </button>
41
+ ))}
42
+ </div>
43
+
44
+ {/* Tab content */}
45
+ <div>
46
+ {active === "live" && <LiveCompare />}
47
+ {active === "benchmark" && <Benchmark />}
48
+ {active === "cost" && <CostAnalysis />}
49
+ {active === "graph" && <GraphExplorer />}
50
+ </div>
51
+ </div>
52
+ </section>
53
+ );
54
+ }