Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
feat: use dsfr theme and navigation
Browse files- frontend/src/App.jsx +10 -8
- frontend/src/components/Navigation/Navigation.jsx +159 -456
frontend/src/App.jsx
CHANGED
@@ -8,6 +8,7 @@ import {
|
|
8 |
} from "react-router-dom";
|
9 |
import { ThemeProvider } from "@mui/material/styles";
|
10 |
import { Box, CssBaseline } from "@mui/material";
|
|
|
11 |
import Navigation from "./components/Navigation/Navigation";
|
12 |
import LeaderboardPage from "./pages/LeaderboardPage/LeaderboardPage";
|
13 |
import AddModelPage from "./pages/AddModelPage/AddModelPage";
|
@@ -15,11 +16,10 @@ import QuotePage from "./pages/QuotePage/QuotePage";
|
|
15 |
import VoteModelPage from "./pages/VoteModelPage/VoteModelPage";
|
16 |
import { Header } from "@codegouvfr/react-dsfr/Header";
|
17 |
import { Footer } from "@codegouvfr/react-dsfr/Footer";
|
18 |
-
import
|
19 |
-
import {
|
20 |
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
21 |
import LeaderboardProvider from "./pages/LeaderboardPage/components/Leaderboard/context/LeaderboardContext";
|
22 |
-
|
23 |
const queryClient = new QueryClient({
|
24 |
defaultOptions: {
|
25 |
queries: {
|
@@ -67,8 +67,6 @@ function UrlHandler() {
|
|
67 |
}
|
68 |
|
69 |
function App() {
|
70 |
-
const { mode, toggleTheme } = useThemeMode();
|
71 |
-
const theme = getTheme(mode);
|
72 |
|
73 |
return (
|
74 |
<div
|
@@ -81,7 +79,7 @@ function App() {
|
|
81 |
}}
|
82 |
>
|
83 |
<QueryClientProvider client={queryClient}>
|
84 |
-
<
|
85 |
<CssBaseline />
|
86 |
<Router>
|
87 |
<LeaderboardProvider>
|
@@ -101,11 +99,15 @@ function App() {
|
|
101 |
href: '/',
|
102 |
title: 'Accueil - Nom de l’entité (ministère, secrétariat d‘état, gouvernement)'
|
103 |
}}
|
|
|
|
|
|
|
|
|
104 |
id="fr-header-simple-header-with-service-title-and-tagline"
|
105 |
serviceTagline="baseline - précisions sur l'organisation"
|
106 |
serviceTitle="Nom du site / service"
|
|
|
107 |
/>
|
108 |
-
<Navigation onToggleTheme={toggleTheme} mode={mode} />
|
109 |
<Box
|
110 |
sx={{
|
111 |
flex: 1,
|
@@ -151,7 +153,7 @@ function App() {
|
|
151 |
</Box>
|
152 |
</LeaderboardProvider>
|
153 |
</Router>
|
154 |
-
</
|
155 |
</QueryClientProvider>
|
156 |
</div>
|
157 |
);
|
|
|
8 |
} from "react-router-dom";
|
9 |
import { ThemeProvider } from "@mui/material/styles";
|
10 |
import { Box, CssBaseline } from "@mui/material";
|
11 |
+
// import Navigation from "./components/Navigation/Navigation";
|
12 |
import Navigation from "./components/Navigation/Navigation";
|
13 |
import LeaderboardPage from "./pages/LeaderboardPage/LeaderboardPage";
|
14 |
import AddModelPage from "./pages/AddModelPage/AddModelPage";
|
|
|
16 |
import VoteModelPage from "./pages/VoteModelPage/VoteModelPage";
|
17 |
import { Header } from "@codegouvfr/react-dsfr/Header";
|
18 |
import { Footer } from "@codegouvfr/react-dsfr/Footer";
|
19 |
+
import MuiDsfrThemeProvider from "@codegouvfr/react-dsfr/mui";
|
20 |
+
import { headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display";
|
21 |
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
22 |
import LeaderboardProvider from "./pages/LeaderboardPage/components/Leaderboard/context/LeaderboardContext";
|
|
|
23 |
const queryClient = new QueryClient({
|
24 |
defaultOptions: {
|
25 |
queries: {
|
|
|
67 |
}
|
68 |
|
69 |
function App() {
|
|
|
|
|
70 |
|
71 |
return (
|
72 |
<div
|
|
|
79 |
}}
|
80 |
>
|
81 |
<QueryClientProvider client={queryClient}>
|
82 |
+
<MuiDsfrThemeProvider>
|
83 |
<CssBaseline />
|
84 |
<Router>
|
85 |
<LeaderboardProvider>
|
|
|
99 |
href: '/',
|
100 |
title: 'Accueil - Nom de l’entité (ministère, secrétariat d‘état, gouvernement)'
|
101 |
}}
|
102 |
+
quickAccessItems={[
|
103 |
+
// other quick access items...
|
104 |
+
headerFooterDisplayItem
|
105 |
+
]}
|
106 |
id="fr-header-simple-header-with-service-title-and-tagline"
|
107 |
serviceTagline="baseline - précisions sur l'organisation"
|
108 |
serviceTitle="Nom du site / service"
|
109 |
+
navigation={<Navigation />}
|
110 |
/>
|
|
|
111 |
<Box
|
112 |
sx={{
|
113 |
flex: 1,
|
|
|
153 |
</Box>
|
154 |
</LeaderboardProvider>
|
155 |
</Router>
|
156 |
+
</MuiDsfrThemeProvider>
|
157 |
</QueryClientProvider>
|
158 |
</div>
|
159 |
);
|
frontend/src/components/Navigation/Navigation.jsx
CHANGED
@@ -1,55 +1,12 @@
|
|
1 |
import React, { useState } from "react";
|
2 |
-
import {
|
3 |
-
AppBar,
|
4 |
-
Toolbar,
|
5 |
-
Box,
|
6 |
-
Link as MuiLink,
|
7 |
-
IconButton,
|
8 |
-
Tooltip,
|
9 |
-
ButtonBase,
|
10 |
-
Typography,
|
11 |
-
} from "@mui/material";
|
12 |
import { useLocation, useNavigate, useSearchParams } from "react-router-dom";
|
13 |
-
import
|
14 |
-
import LightModeOutlinedIcon from "@mui/icons-material/LightModeOutlined";
|
15 |
-
import DarkModeOutlinedIcon from "@mui/icons-material/DarkModeOutlined";
|
16 |
-
import { alpha } from "@mui/material/styles";
|
17 |
-
import MenuIcon from "@mui/icons-material/Menu";
|
18 |
-
import { Menu, MenuItem, useMediaQuery, useTheme } from "@mui/material";
|
19 |
|
20 |
-
const Navigation = (
|
21 |
const location = useLocation();
|
22 |
const navigate = useNavigate();
|
|
|
23 |
const [searchParams] = useSearchParams();
|
24 |
-
const [anchorEl, setAnchorEl] = useState(null);
|
25 |
-
const theme = useTheme();
|
26 |
-
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
|
27 |
-
const [hasChanged, setHasChanged] = useState(false);
|
28 |
-
|
29 |
-
const handleThemeToggle = () => {
|
30 |
-
setHasChanged(true);
|
31 |
-
onToggleTheme();
|
32 |
-
};
|
33 |
-
|
34 |
-
const iconStyle = {
|
35 |
-
fontSize: "1.125rem",
|
36 |
-
...(hasChanged && {
|
37 |
-
animation: "rotateIn 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
38 |
-
"@keyframes rotateIn": {
|
39 |
-
"0%": {
|
40 |
-
opacity: 0,
|
41 |
-
transform:
|
42 |
-
mode === "light"
|
43 |
-
? "rotate(-90deg) scale(0.8)"
|
44 |
-
: "rotate(90deg) scale(0.8)",
|
45 |
-
},
|
46 |
-
"100%": {
|
47 |
-
opacity: 1,
|
48 |
-
transform: "rotate(0) scale(1)",
|
49 |
-
},
|
50 |
-
},
|
51 |
-
}),
|
52 |
-
};
|
53 |
|
54 |
// Function to sync URL with parent HF page
|
55 |
const syncUrlWithParent = (queryString, hash) => {
|
@@ -72,54 +29,7 @@ const Navigation = ({ onToggleTheme, mode }) => {
|
|
72 |
}
|
73 |
};
|
74 |
|
75 |
-
const
|
76 |
-
textDecoration: "none",
|
77 |
-
color: isActive ? "text.primary" : "text.secondary",
|
78 |
-
fontSize: "0.8125rem",
|
79 |
-
opacity: isActive ? 1 : 0.8,
|
80 |
-
display: "flex",
|
81 |
-
alignItems: "center",
|
82 |
-
gap: 0.5,
|
83 |
-
paddingBottom: "2px",
|
84 |
-
cursor: "pointer",
|
85 |
-
position: "relative",
|
86 |
-
"&:hover": {
|
87 |
-
opacity: 1,
|
88 |
-
color: "text.primary",
|
89 |
-
},
|
90 |
-
"&::after": isActive
|
91 |
-
? {
|
92 |
-
content: '""',
|
93 |
-
position: "absolute",
|
94 |
-
bottom: "-4px",
|
95 |
-
left: "0",
|
96 |
-
width: "100%",
|
97 |
-
height: "2px",
|
98 |
-
backgroundColor: (theme) =>
|
99 |
-
alpha(
|
100 |
-
theme.palette.text.primary,
|
101 |
-
theme.palette.mode === "dark" ? 0.3 : 0.2
|
102 |
-
),
|
103 |
-
borderRadius: "2px",
|
104 |
-
}
|
105 |
-
: {},
|
106 |
-
});
|
107 |
-
|
108 |
-
const Separator = () => (
|
109 |
-
<Box
|
110 |
-
sx={(theme) => ({
|
111 |
-
width: "4px",
|
112 |
-
height: "4px",
|
113 |
-
borderRadius: "100%",
|
114 |
-
backgroundColor: alpha(
|
115 |
-
theme.palette.text.primary,
|
116 |
-
theme.palette.mode === "dark" ? 0.2 : 0.15
|
117 |
-
),
|
118 |
-
})}
|
119 |
-
/>
|
120 |
-
);
|
121 |
-
|
122 |
-
const handleNavigation = (path) => (e) => {
|
123 |
e.preventDefault();
|
124 |
const searchString = searchParams.toString();
|
125 |
const queryString = searchString ? `?${searchString}` : "";
|
@@ -132,373 +42,166 @@ const Navigation = ({ onToggleTheme, mode }) => {
|
|
132 |
if (window.location !== window.parent.location) {
|
133 |
syncUrlWithParent(queryString, newPath);
|
134 |
}
|
135 |
-
|
136 |
-
|
137 |
-
const handleMenuOpen = (event) => {
|
138 |
-
setAnchorEl(event.currentTarget);
|
139 |
-
};
|
140 |
-
|
141 |
-
const handleMenuClose = () => {
|
142 |
-
setAnchorEl(null);
|
143 |
};
|
144 |
|
145 |
return (
|
146 |
-
<
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
<Toolbar sx={{ justifyContent: "center" }}>
|
155 |
-
{isMobile ? (
|
156 |
-
<Box
|
157 |
-
sx={{
|
158 |
-
display: "flex",
|
159 |
-
width: "100%",
|
160 |
-
justifyContent: "space-between",
|
161 |
-
alignItems: "center",
|
162 |
-
}}
|
163 |
-
>
|
164 |
-
<IconButton
|
165 |
-
onClick={handleMenuOpen}
|
166 |
-
sx={{ color: "text.secondary" }}
|
167 |
-
>
|
168 |
-
<MenuIcon />
|
169 |
-
</IconButton>
|
170 |
-
|
171 |
-
<Menu
|
172 |
-
anchorEl={anchorEl}
|
173 |
-
open={Boolean(anchorEl)}
|
174 |
-
onClose={handleMenuClose}
|
175 |
-
PaperProps={{
|
176 |
-
elevation: 3,
|
177 |
-
sx: {
|
178 |
-
mt: 1.5,
|
179 |
-
minWidth: 220,
|
180 |
-
borderRadius: "12px",
|
181 |
-
border: (theme) =>
|
182 |
-
`1px solid ${alpha(theme.palette.divider, 0.1)}`,
|
183 |
-
backgroundColor: (theme) =>
|
184 |
-
theme.palette.mode === "dark"
|
185 |
-
? alpha(theme.palette.background.paper, 0.8)
|
186 |
-
: theme.palette.background.paper,
|
187 |
-
backdropFilter: "blur(20px)",
|
188 |
-
"& .MuiList-root": {
|
189 |
-
py: 1,
|
190 |
-
},
|
191 |
-
"& .MuiMenuItem-root": {
|
192 |
-
px: 2,
|
193 |
-
py: 1,
|
194 |
-
fontSize: "0.8125rem",
|
195 |
-
color: "text.secondary",
|
196 |
-
transition: "all 0.2s ease-in-out",
|
197 |
-
position: "relative",
|
198 |
-
"&:hover": {
|
199 |
-
backgroundColor: (theme) =>
|
200 |
-
alpha(
|
201 |
-
theme.palette.text.primary,
|
202 |
-
theme.palette.mode === "dark" ? 0.1 : 0.06
|
203 |
-
),
|
204 |
-
color: "text.primary",
|
205 |
-
},
|
206 |
-
"&.Mui-selected": {
|
207 |
-
backgroundColor: "transparent",
|
208 |
-
color: "text.primary",
|
209 |
-
"&::after": {
|
210 |
-
content: '""',
|
211 |
-
position: "absolute",
|
212 |
-
left: "8px",
|
213 |
-
width: "4px",
|
214 |
-
height: "100%",
|
215 |
-
top: "0",
|
216 |
-
backgroundColor: (theme) =>
|
217 |
-
alpha(
|
218 |
-
theme.palette.text.primary,
|
219 |
-
theme.palette.mode === "dark" ? 0.3 : 0.2
|
220 |
-
),
|
221 |
-
borderRadius: "2px",
|
222 |
-
},
|
223 |
-
"&:hover": {
|
224 |
-
backgroundColor: (theme) =>
|
225 |
-
alpha(
|
226 |
-
theme.palette.text.primary,
|
227 |
-
theme.palette.mode === "dark" ? 0.1 : 0.06
|
228 |
-
),
|
229 |
-
},
|
230 |
-
},
|
231 |
-
},
|
232 |
},
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
selected={location.pathname === "/add"}
|
258 |
-
>
|
259 |
-
Submit model
|
260 |
-
</MenuItem>
|
261 |
-
<MenuItem
|
262 |
-
onClick={(e) => {
|
263 |
-
handleNavigation("/vote")(e);
|
264 |
-
handleMenuClose();
|
265 |
-
}}
|
266 |
-
selected={location.pathname === "/vote"}
|
267 |
-
>
|
268 |
-
Vote for next model
|
269 |
-
</MenuItem>
|
270 |
-
<MenuItem
|
271 |
-
onClick={(e) => {
|
272 |
-
handleNavigation("/quote")(e);
|
273 |
-
handleMenuClose();
|
274 |
-
}}
|
275 |
-
selected={location.pathname === "/quote"}
|
276 |
-
>
|
277 |
-
Citations
|
278 |
-
</MenuItem>
|
279 |
-
|
280 |
-
{/* Separator */}
|
281 |
-
<Box
|
282 |
-
sx={{
|
283 |
-
my: 1,
|
284 |
-
borderTop: (theme) =>
|
285 |
-
`1px solid ${alpha(theme.palette.divider, 0.1)}`,
|
286 |
-
}}
|
287 |
-
/>
|
288 |
-
|
289 |
-
{/* External Links Section */}
|
290 |
-
<Box sx={{ px: 2, pb: 1.5 }}>
|
291 |
-
<Typography variant="caption" sx={{ color: "text.disabled" }}>
|
292 |
-
External links
|
293 |
-
</Typography>
|
294 |
-
</Box>
|
295 |
-
<MenuItem
|
296 |
-
component={MuiLink}
|
297 |
-
href="https://huggingface.co/spaces/open-llm-leaderboard/comparator"
|
298 |
-
target="_blank"
|
299 |
-
sx={{
|
300 |
-
"& svg": {
|
301 |
-
ml: "auto",
|
302 |
-
fontSize: "0.875rem",
|
303 |
-
opacity: 0.6,
|
304 |
-
},
|
305 |
-
}}
|
306 |
-
>
|
307 |
-
Compare models
|
308 |
-
<OpenInNewIcon />
|
309 |
-
</MenuItem>
|
310 |
-
<MenuItem
|
311 |
-
component={MuiLink}
|
312 |
-
href="https://huggingface.co/docs/leaderboards/open_llm_leaderboard/about"
|
313 |
-
target="_blank"
|
314 |
-
sx={{
|
315 |
-
"& svg": {
|
316 |
-
ml: "auto",
|
317 |
-
fontSize: "0.875rem",
|
318 |
-
opacity: 0.6,
|
319 |
-
},
|
320 |
-
}}
|
321 |
-
>
|
322 |
-
About
|
323 |
-
<OpenInNewIcon />
|
324 |
-
</MenuItem>
|
325 |
-
</Menu>
|
326 |
-
|
327 |
-
<Tooltip
|
328 |
-
title={
|
329 |
-
mode === "light"
|
330 |
-
? "Switch to dark mode"
|
331 |
-
: "Switch to light mode"
|
332 |
-
}
|
333 |
-
>
|
334 |
-
<ButtonBase
|
335 |
-
onClick={handleThemeToggle}
|
336 |
-
sx={(theme) => ({
|
337 |
-
color: "text.secondary",
|
338 |
-
borderRadius: "100%",
|
339 |
-
padding: 0,
|
340 |
-
width: "36px",
|
341 |
-
height: "36px",
|
342 |
-
display: "flex",
|
343 |
-
alignItems: "center",
|
344 |
-
justifyContent: "center",
|
345 |
-
transition: "all 0.2s ease-in-out",
|
346 |
-
"&:hover": {
|
347 |
-
color: "text.primary",
|
348 |
-
backgroundColor: alpha(
|
349 |
-
theme.palette.text.primary,
|
350 |
-
theme.palette.mode === "dark" ? 0.1 : 0.06
|
351 |
-
),
|
352 |
-
},
|
353 |
-
"&.MuiButtonBase-root": {
|
354 |
-
overflow: "hidden",
|
355 |
-
},
|
356 |
-
"& .MuiTouchRipple-root": {
|
357 |
-
color: alpha(theme.palette.text.primary, 0.3),
|
358 |
-
},
|
359 |
-
})}
|
360 |
-
>
|
361 |
-
{mode === "light" ? (
|
362 |
-
<DarkModeOutlinedIcon sx={iconStyle} />
|
363 |
-
) : (
|
364 |
-
<LightModeOutlinedIcon sx={iconStyle} />
|
365 |
-
)}
|
366 |
-
</ButtonBase>
|
367 |
-
</Tooltip>
|
368 |
-
</Box>
|
369 |
-
) : (
|
370 |
-
// Desktop version
|
371 |
-
<Box
|
372 |
-
sx={{
|
373 |
-
display: "flex",
|
374 |
-
gap: 2.5,
|
375 |
-
alignItems: "center",
|
376 |
-
padding: "0.5rem 0",
|
377 |
-
}}
|
378 |
-
>
|
379 |
{/* Internal navigation */}
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
};
|
503 |
|
504 |
export default Navigation;
|
|
|
1 |
import React, { useState } from "react";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import { useLocation, useNavigate, useSearchParams } from "react-router-dom";
|
3 |
+
import {MainNavigation} from "@codegouvfr/react-dsfr/MainNavigation";
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
const Navigation = () => {
|
6 |
const location = useLocation();
|
7 |
const navigate = useNavigate();
|
8 |
+
const [active, setActive] = useState(0);
|
9 |
const [searchParams] = useSearchParams();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
// Function to sync URL with parent HF page
|
12 |
const syncUrlWithParent = (queryString, hash) => {
|
|
|
29 |
}
|
30 |
};
|
31 |
|
32 |
+
const handleNavigation = (index, path) => (e) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
e.preventDefault();
|
34 |
const searchString = searchParams.toString();
|
35 |
const queryString = searchString ? `?${searchString}` : "";
|
|
|
42 |
if (window.location !== window.parent.location) {
|
43 |
syncUrlWithParent(queryString, newPath);
|
44 |
}
|
45 |
+
setActive(index);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
};
|
47 |
|
48 |
return (
|
49 |
+
<MainNavigation
|
50 |
+
items={[
|
51 |
+
{
|
52 |
+
isActive: active === 0,
|
53 |
+
linkProps: {
|
54 |
+
href: "/",
|
55 |
+
target: '_self',
|
56 |
+
onClick: handleNavigation(0, "/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
},
|
58 |
+
text: "Leaderboard",
|
59 |
+
},
|
60 |
+
{
|
61 |
+
isActive: active === 1,
|
62 |
+
linkProps: {
|
63 |
+
href: "/add",
|
64 |
+
target: '_self',
|
65 |
+
onClick: handleNavigation(1, "/add")
|
66 |
+
},
|
67 |
+
text: "Submit model",
|
68 |
+
},
|
69 |
+
{
|
70 |
+
isActive: active === 2,
|
71 |
+
linkProps: {
|
72 |
+
href: "/vote",
|
73 |
+
target: '_self',
|
74 |
+
onClick: handleNavigation(2, "/vote")
|
75 |
+
},
|
76 |
+
text: "Vote for next model",
|
77 |
+
},
|
78 |
+
]}
|
79 |
+
/>
|
80 |
+
);
|
81 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
{/* Internal navigation */}
|
83 |
+
// <Box sx={{ display: "flex", gap: 2.5, alignItems: "center" }}>
|
84 |
+
// <Box
|
85 |
+
// onClick={handleNavigation("/")}
|
86 |
+
// sx={linkStyle(location.pathname === "/")}
|
87 |
+
// >
|
88 |
+
// Leaderboard
|
89 |
+
// </Box>
|
90 |
+
// <Box
|
91 |
+
// onClick={handleNavigation("/add")}
|
92 |
+
// sx={linkStyle(location.pathname === "/add")}
|
93 |
+
// >
|
94 |
+
// Submit model
|
95 |
+
// </Box>
|
96 |
+
// <Box
|
97 |
+
// onClick={handleNavigation("/vote")}
|
98 |
+
// sx={linkStyle(location.pathname === "/vote")}
|
99 |
+
// >
|
100 |
+
// Vote for next model
|
101 |
+
// </Box>
|
102 |
+
// <Box
|
103 |
+
// onClick={handleNavigation("/quote")}
|
104 |
+
// sx={linkStyle(location.pathname === "/quote")}
|
105 |
+
// >
|
106 |
+
// Citations
|
107 |
+
// </Box>
|
108 |
+
// </Box>
|
109 |
+
|
110 |
+
// <Separator />
|
111 |
+
|
112 |
+
// {/* External links */}
|
113 |
+
// <Box sx={{ display: "flex", gap: 2.5, alignItems: "center" }}>
|
114 |
+
// <MuiLink
|
115 |
+
// href="https://huggingface.co/spaces/open-llm-leaderboard/comparator"
|
116 |
+
// target="_blank"
|
117 |
+
// rel="noopener noreferrer"
|
118 |
+
// sx={{
|
119 |
+
// ...linkStyle(),
|
120 |
+
// "& svg": {
|
121 |
+
// fontSize: "0.75rem",
|
122 |
+
// ml: 0.5,
|
123 |
+
// opacity: 0.6,
|
124 |
+
// transition: "opacity 0.2s ease-in-out",
|
125 |
+
// },
|
126 |
+
// "&:hover svg": {
|
127 |
+
// opacity: 0.8,
|
128 |
+
// },
|
129 |
+
// }}
|
130 |
+
// >
|
131 |
+
// Compare models
|
132 |
+
// <OpenInNewIcon />
|
133 |
+
// </MuiLink>
|
134 |
+
// <MuiLink
|
135 |
+
// href="https://huggingface.co/docs/leaderboards/open_llm_leaderboard/about"
|
136 |
+
// target="_blank"
|
137 |
+
// rel="noopener noreferrer"
|
138 |
+
// sx={{
|
139 |
+
// ...linkStyle(),
|
140 |
+
// "& svg": {
|
141 |
+
// fontSize: "0.75rem",
|
142 |
+
// ml: 0.5,
|
143 |
+
// opacity: 0.6,
|
144 |
+
// transition: "opacity 0.2s ease-in-out",
|
145 |
+
// },
|
146 |
+
// "&:hover svg": {
|
147 |
+
// opacity: 0.8,
|
148 |
+
// },
|
149 |
+
// }}
|
150 |
+
// >
|
151 |
+
// About
|
152 |
+
// <OpenInNewIcon />
|
153 |
+
// </MuiLink>
|
154 |
+
// </Box>
|
155 |
+
|
156 |
+
// <Separator />
|
157 |
+
|
158 |
+
// {/* Dark mode toggle */}
|
159 |
+
// <Tooltip
|
160 |
+
// title={
|
161 |
+
// mode === "light"
|
162 |
+
// ? "Switch to dark mode"
|
163 |
+
// : "Switch to light mode"
|
164 |
+
// }
|
165 |
+
// >
|
166 |
+
// <ButtonBase
|
167 |
+
// onClick={handleThemeToggle}
|
168 |
+
// sx={(theme) => ({
|
169 |
+
// color: "text.secondary",
|
170 |
+
// borderRadius: "100%",
|
171 |
+
// padding: 0,
|
172 |
+
// width: "36px",
|
173 |
+
// height: "36px",
|
174 |
+
// display: "flex",
|
175 |
+
// alignItems: "center",
|
176 |
+
// justifyContent: "center",
|
177 |
+
// transition: "all 0.2s ease-in-out",
|
178 |
+
// "&:hover": {
|
179 |
+
// color: "text.primary",
|
180 |
+
// backgroundColor: alpha(
|
181 |
+
// theme.palette.text.primary,
|
182 |
+
// theme.palette.mode === "dark" ? 0.1 : 0.06
|
183 |
+
// ),
|
184 |
+
// },
|
185 |
+
// "&.MuiButtonBase-root": {
|
186 |
+
// overflow: "hidden",
|
187 |
+
// },
|
188 |
+
// "& .MuiTouchRipple-root": {
|
189 |
+
// color: alpha(theme.palette.text.primary, 0.3),
|
190 |
+
// },
|
191 |
+
// })}
|
192 |
+
// >
|
193 |
+
// {mode === "light" ? (
|
194 |
+
// <DarkModeOutlinedIcon sx={iconStyle} />
|
195 |
+
// ) : (
|
196 |
+
// <LightModeOutlinedIcon sx={iconStyle} />
|
197 |
+
// )}
|
198 |
+
// </ButtonBase>
|
199 |
+
// </Tooltip>
|
200 |
+
// </Box>
|
201 |
+
// )}
|
202 |
+
// </Toolbar>
|
203 |
+
// </AppBar>
|
204 |
+
// );
|
205 |
};
|
206 |
|
207 |
export default Navigation;
|