bde0876rearrange tabsJeremy Magland 1import { BrowserRouter, Routes, Route, Link, Navigate } from "react-router-dom";
3import axios from "axios";
11function App() {
0968553routingJeremy Magland 12 const [benchmarkData, setBenchmarkData] = useState<BenchmarkData | null>(
13 null,
14 );
15 const [isLoading, setIsLoading] = useState(true);
16 const [error, setError] = useState<string | null>(null);
18 useEffect(() => {
19 const fetchData = async () => {
20 try {
21 setIsLoading(true);
22 setError(null);
23 const response = await axios.get(
7884e06rename to benchcompressJeremy Magland 24 "https://raw.githubusercontent.com/magland/benchcompress/benchmark-results/benchmark_results/results.json",
26 setBenchmarkData(response.data);
27 } catch (error) {
28 const message =
29 error instanceof Error ? error.message : "Failed to fetch data";
30 setError(message);
31 console.error("Error fetching benchmark data:", error);
32 } finally {
33 setIsLoading(false);
34 }
35 };
37 fetchData();
38 }, []);
44 style={{
46 padding: "3rem 2rem 2rem 2rem",
48 >
49 <nav
50 style={{
51 position: "fixed",
52 top: 0,
53 left: 0,
54 right: 0,
61 >
63 style={{
64 display: "flex",
65 justifyContent: "space-between",
66 alignItems: "center",
67 minHeight: "32px",
68 }}
69 >
70 <Link
71 to="/datasets"
72 style={{
73 display: "flex",
74 alignItems: "center",
75 textDecoration: "none",
76 minWidth: 0,
77 maxWidth: "calc(100% - 80px)",
78 }}
79 >
80 <img
81 src="/benchcompress/logo.svg"
82 alt="Benchcompress Logo"
83 style={{
84 width: "28px",
85 height: "28px",
86 marginRight: "10px",
87 flexShrink: 0,
88 }}
89 />
90 <span
91 style={{
92 minWidth: 0,
93 whiteSpace: "nowrap",
94 overflow: "hidden",
95 textOverflow: "ellipsis",
96 }}
97 >
98 <span
99 style={{
100 fontSize: "1rem",
101 fontWeight: "500",
102 color: "#2c2c2c",
103 }}
104 >
105 Benchcompress
106 </span>
107 <span className="app-header-subtitle">
108 {" · "}
109 <span style={{ fontSize: "1rem", color: "#777" }}>
111 data
113 </span>
114 </span>
115 </Link>
117 <Link
118 to="/paper"
119 style={{
120 color: "#0066cc",
121 textDecoration: "none",
122 fontWeight: "500",
123 }}
124 >
125 Paper
126 </Link>
127 <Link
128 to="/about"
129 style={{
130 color: "#0066cc",
131 textDecoration: "none",
132 fontWeight: "500",
133 }}
134 >
135 About
136 </Link>
137 </div>
140 <main>
142 <div>Loading benchmark data...</div>
143 ) : error ? (
144 <div>Error: {error}</div>
145 ) : (
146 <Routes>
bde0876rearrange tabsJeremy Magland 147 <Route path="/" element={<Navigate to="/datasets" replace />} />
149 path="/datasets"
152 <Route
153 path="/algorithms"
157 path="/dataset/:datasetName"
161 path="/algorithm/:algorithmName"
167 )}
169 </div>
170 </BrowserRouter>
172}
174export default App;