3import axios from "axios";
5import Datasets from "./pages/Datasets";
12function App() {
0968553routingJeremy Magland 13 const [benchmarkData, setBenchmarkData] = useState<BenchmarkData | null>(
14 null,
15 );
16 const [isLoading, setIsLoading] = useState(true);
17 const [error, setError] = useState<string | null>(null);
19 useEffect(() => {
20 const fetchData = async () => {
21 try {
22 setIsLoading(true);
23 setError(null);
24 const response = await axios.get(
25 "https://raw.githubusercontent.com/magland/zia/benchmark-results/benchmark_results/results.json",
26 );
27 setBenchmarkData(response.data);
28 } catch (error) {
29 const message =
30 error instanceof Error ? error.message : "Failed to fetch data";
31 setError(message);
32 console.error("Error fetching benchmark data:", error);
33 } finally {
34 setIsLoading(false);
35 }
36 };
38 fetchData();
39 }, []);
44 style={{
45 paddingTop: "5rem",
46 paddingLeft: "2rem",
47 paddingRight: "2rem",
48 paddingBottom: "2rem",
49 }}
50 >
51 <nav
52 style={{
53 position: "fixed",
54 top: 0,
55 left: 0,
56 right: 0,
57 padding: "1rem 2rem",
58 backgroundColor: "white",
59 borderBottom: "1px solid #eaeaea",
60 zIndex: 1000,
61 boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
62 }}
63 >
65 style={{
66 listStyle: "none",
67 padding: 0,
68 margin: 0,
69 display: "flex",
70 gap: "1.5rem",
71 }}
72 >
74 <Link
77 color: "#0066cc",
78 textDecoration: "none",
81 >
82 Home
83 </Link>
84 </li>
85 <li>
86 <Link
87 to="/datasets"
88 style={{
89 color: "#0066cc",
90 textDecoration: "none",
93 >
94 Datasets
95 </Link>
96 </li>
97 <li>
98 <Link
99 to="/algorithms"
100 style={{
101 color: "#0066cc",
102 textDecoration: "none",
105 >
106 Algorithms
107 </Link>
108 </li>
110 <Link
111 to="/about"
112 style={{
113 color: "#0066cc",
114 textDecoration: "none",
115 fontWeight: "500",
116 }}
117 >
118 About
119 </Link>
120 </li>
122 </nav>
123 <main>
125 <div>Loading benchmark data...</div>
126 ) : error ? (
127 <div>Error: {error}</div>
128 ) : (
129 <Routes>
130 <Route
131 path="/home"
132 element={<Home benchmarkData={benchmarkData} />}
133 />
134 <Route
135 path="/"
136 element={<Home benchmarkData={benchmarkData} />}
137 />
138 <Route
139 path="/datasets"
140 element={<Datasets datasets={benchmarkData?.datasets || []} />}
141 />
142 <Route
143 path="/algorithms"
144 element={
145 <Algorithms algorithms={benchmarkData?.algorithms || []} />
146 }
147 />
149 path="/dataset/:datasetName"
151 <Dataset
152 datasets={benchmarkData?.datasets || []}
153 benchmarkData={benchmarkData}
154 />
155 }
158 path="/algorithm/:algorithmName"
159 element={
161 algorithms={benchmarkData?.algorithms || []}
162 benchmarkData={benchmarkData}
163 />
165 />
168 )}
170 </div>
171 </BrowserRouter>
173}
175export default App;