Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
mobile fixes
Browse files
frontend/src/components/BenchmarkDisplay.jsx
CHANGED
@@ -10,6 +10,8 @@ import {
|
|
10 |
Link,
|
11 |
CircularProgress,
|
12 |
Tooltip,
|
|
|
|
|
13 |
} from "@mui/material";
|
14 |
import PlayArrowIcon from "@mui/icons-material/PlayArrow";
|
15 |
import AssessmentIcon from "@mui/icons-material/Assessment";
|
@@ -38,7 +40,9 @@ const BenchmarkDisplay = ({
|
|
38 |
}) => {
|
39 |
const [isDownloading, setIsDownloading] = useState(false);
|
40 |
const { mode } = useThemeMode();
|
41 |
-
const theme =
|
|
|
|
|
42 |
|
43 |
// Default questions if none provided
|
44 |
const questions =
|
@@ -95,8 +99,10 @@ const BenchmarkDisplay = ({
|
|
95 |
sx={{
|
96 |
mb: 4,
|
97 |
display: "flex",
|
|
|
98 |
justifyContent: "space-between",
|
99 |
-
alignItems: "center",
|
|
|
100 |
}}
|
101 |
>
|
102 |
<Box sx={{ display: "flex", alignItems: "center" }}>
|
@@ -104,7 +110,14 @@ const BenchmarkDisplay = ({
|
|
104 |
<Typography variant="h6">Benchmark Created Successfully</Typography>
|
105 |
</Box>
|
106 |
|
107 |
-
<Box
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
<Tooltip title="Download the complete benchmark">
|
109 |
<Button
|
110 |
variant="outlined"
|
@@ -118,6 +131,7 @@ const BenchmarkDisplay = ({
|
|
118 |
}
|
119 |
onClick={handleDownloadClick}
|
120 |
disabled={isDownloading || !sessionId}
|
|
|
121 |
>
|
122 |
{isDownloading ? "Downloading..." : "Download Benchmark"}
|
123 |
</Button>
|
@@ -128,6 +142,7 @@ const BenchmarkDisplay = ({
|
|
128 |
color="primary"
|
129 |
startIcon={<AssessmentIcon />}
|
130 |
onClick={handleEvaluationClick}
|
|
|
131 |
>
|
132 |
Start Evaluation
|
133 |
</Button>
|
@@ -145,8 +160,8 @@ const BenchmarkDisplay = ({
|
|
145 |
variant="outlined"
|
146 |
sx={{
|
147 |
mb: 2,
|
148 |
-
backgroundColor:
|
149 |
-
border: `1px solid ${
|
150 |
}}
|
151 |
>
|
152 |
<CardContent>
|
|
|
10 |
Link,
|
11 |
CircularProgress,
|
12 |
Tooltip,
|
13 |
+
useTheme,
|
14 |
+
useMediaQuery,
|
15 |
} from "@mui/material";
|
16 |
import PlayArrowIcon from "@mui/icons-material/PlayArrow";
|
17 |
import AssessmentIcon from "@mui/icons-material/Assessment";
|
|
|
40 |
}) => {
|
41 |
const [isDownloading, setIsDownloading] = useState(false);
|
42 |
const { mode } = useThemeMode();
|
43 |
+
const theme = useTheme();
|
44 |
+
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
45 |
+
const themeColors = getTheme(mode);
|
46 |
|
47 |
// Default questions if none provided
|
48 |
const questions =
|
|
|
99 |
sx={{
|
100 |
mb: 4,
|
101 |
display: "flex",
|
102 |
+
flexDirection: isMobile ? "column" : "row",
|
103 |
justifyContent: "space-between",
|
104 |
+
alignItems: isMobile ? "flex-start" : "center",
|
105 |
+
gap: isMobile ? 2 : 0,
|
106 |
}}
|
107 |
>
|
108 |
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
|
110 |
<Typography variant="h6">Benchmark Created Successfully</Typography>
|
111 |
</Box>
|
112 |
|
113 |
+
<Box
|
114 |
+
sx={{
|
115 |
+
display: "flex",
|
116 |
+
gap: 2,
|
117 |
+
width: isMobile ? "100%" : "auto",
|
118 |
+
flexDirection: isMobile ? "column" : "row",
|
119 |
+
}}
|
120 |
+
>
|
121 |
<Tooltip title="Download the complete benchmark">
|
122 |
<Button
|
123 |
variant="outlined"
|
|
|
131 |
}
|
132 |
onClick={handleDownloadClick}
|
133 |
disabled={isDownloading || !sessionId}
|
134 |
+
fullWidth={isMobile}
|
135 |
>
|
136 |
{isDownloading ? "Downloading..." : "Download Benchmark"}
|
137 |
</Button>
|
|
|
142 |
color="primary"
|
143 |
startIcon={<AssessmentIcon />}
|
144 |
onClick={handleEvaluationClick}
|
145 |
+
fullWidth={isMobile}
|
146 |
>
|
147 |
Start Evaluation
|
148 |
</Button>
|
|
|
160 |
variant="outlined"
|
161 |
sx={{
|
162 |
mb: 2,
|
163 |
+
backgroundColor: themeColors.palette.background.subtle,
|
164 |
+
border: `1px solid ${themeColors.palette.divider}`,
|
165 |
}}
|
166 |
>
|
167 |
<CardContent>
|
frontend/src/components/ExternalLinks.jsx
CHANGED
@@ -1,13 +1,26 @@
|
|
1 |
-
import React from "react";
|
2 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
4 |
import ShareIcon from "@mui/icons-material/Share";
|
5 |
import DarkModeOutlinedIcon from "@mui/icons-material/DarkModeOutlined";
|
6 |
import LightModeOutlinedIcon from "@mui/icons-material/LightModeOutlined";
|
|
|
7 |
import { useThemeMode } from "../hooks/useThemeMode";
|
8 |
|
9 |
const ExternalLinks = () => {
|
10 |
const { mode, toggleTheme } = useThemeMode();
|
|
|
|
|
|
|
11 |
|
12 |
const handleShare = async () => {
|
13 |
try {
|
@@ -21,6 +34,33 @@ const ExternalLinks = () => {
|
|
21 |
}
|
22 |
};
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
return (
|
25 |
<Box
|
26 |
sx={{
|
@@ -35,60 +75,97 @@ const ExternalLinks = () => {
|
|
35 |
zIndex: 1000,
|
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 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
>
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</Typography>
|
82 |
-
|
83 |
-
href="https://huggingface.co/spaces/yourbench/yourbench-demo"
|
84 |
-
target="_blank"
|
85 |
-
rel="noopener noreferrer"
|
86 |
-
style={{ textDecoration: "none", color: "inherit" }}
|
87 |
-
>
|
88 |
-
Full demo
|
89 |
-
<OpenInNewIcon sx={{ fontSize: "0.75rem", ml: 0.5, opacity: 0.6 }} />
|
90 |
-
</a>
|
91 |
-
</Typography>
|
92 |
<Box sx={{ display: "flex", alignItems: "center" }}>
|
93 |
<Tooltip title="Share">
|
94 |
<IconButton
|
|
|
1 |
+
import React, { useState } from "react";
|
2 |
+
import {
|
3 |
+
Box,
|
4 |
+
Typography,
|
5 |
+
IconButton,
|
6 |
+
Tooltip,
|
7 |
+
Menu,
|
8 |
+
MenuItem,
|
9 |
+
useTheme,
|
10 |
+
useMediaQuery,
|
11 |
+
} from "@mui/material";
|
12 |
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
13 |
import ShareIcon from "@mui/icons-material/Share";
|
14 |
import DarkModeOutlinedIcon from "@mui/icons-material/DarkModeOutlined";
|
15 |
import LightModeOutlinedIcon from "@mui/icons-material/LightModeOutlined";
|
16 |
+
import MenuIcon from "@mui/icons-material/Menu";
|
17 |
import { useThemeMode } from "../hooks/useThemeMode";
|
18 |
|
19 |
const ExternalLinks = () => {
|
20 |
const { mode, toggleTheme } = useThemeMode();
|
21 |
+
const [anchorEl, setAnchorEl] = useState(null);
|
22 |
+
const theme = useTheme();
|
23 |
+
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
24 |
|
25 |
const handleShare = async () => {
|
26 |
try {
|
|
|
34 |
}
|
35 |
};
|
36 |
|
37 |
+
const handleMenuOpen = (event) => {
|
38 |
+
setAnchorEl(event.currentTarget);
|
39 |
+
};
|
40 |
+
|
41 |
+
const handleMenuClose = () => {
|
42 |
+
setAnchorEl(null);
|
43 |
+
};
|
44 |
+
|
45 |
+
const externalLinks = [
|
46 |
+
{
|
47 |
+
name: "GitHub",
|
48 |
+
url: "https://github.com/huggingface/yourbench",
|
49 |
+
},
|
50 |
+
{
|
51 |
+
name: "Dataset",
|
52 |
+
url: "https://huggingface.co/datasets/sumuks/tempora",
|
53 |
+
},
|
54 |
+
{
|
55 |
+
name: "Documentation",
|
56 |
+
url: "https://github.com/huggingface/yourbench/tree/main/docs",
|
57 |
+
},
|
58 |
+
{
|
59 |
+
name: "Full demo",
|
60 |
+
url: "https://huggingface.co/spaces/yourbench/yourbench-demo",
|
61 |
+
},
|
62 |
+
];
|
63 |
+
|
64 |
return (
|
65 |
<Box
|
66 |
sx={{
|
|
|
75 |
zIndex: 1000,
|
76 |
}}
|
77 |
>
|
78 |
+
{isMobile ? (
|
79 |
+
<>
|
80 |
+
<IconButton
|
81 |
+
onClick={handleMenuOpen}
|
82 |
+
size="small"
|
83 |
+
sx={{
|
84 |
+
color: "inherit",
|
85 |
+
opacity: 0.7,
|
86 |
+
"&:hover": {
|
87 |
+
opacity: 1,
|
88 |
+
},
|
89 |
+
}}
|
90 |
+
>
|
91 |
+
<MenuIcon />
|
92 |
+
</IconButton>
|
93 |
+
<Menu
|
94 |
+
anchorEl={anchorEl}
|
95 |
+
open={Boolean(anchorEl)}
|
96 |
+
onClose={handleMenuClose}
|
97 |
+
PaperProps={{
|
98 |
+
sx: {
|
99 |
+
mt: 1,
|
100 |
+
minWidth: 200,
|
101 |
+
borderRadius: 2,
|
102 |
+
boxShadow: "0 4px 20px rgba(0, 0, 0, 0.1)",
|
103 |
+
},
|
104 |
+
}}
|
105 |
+
>
|
106 |
+
{externalLinks.map((link) => (
|
107 |
+
<MenuItem
|
108 |
+
key={link.name}
|
109 |
+
onClick={handleMenuClose}
|
110 |
+
sx={{
|
111 |
+
display: "flex",
|
112 |
+
alignItems: "center",
|
113 |
+
gap: 1,
|
114 |
+
py: 1.5,
|
115 |
+
px: 2,
|
116 |
+
}}
|
117 |
+
>
|
118 |
+
<a
|
119 |
+
href={link.url}
|
120 |
+
target="_blank"
|
121 |
+
rel="noopener noreferrer"
|
122 |
+
style={{
|
123 |
+
textDecoration: "none",
|
124 |
+
color: "inherit",
|
125 |
+
display: "flex",
|
126 |
+
alignItems: "center",
|
127 |
+
gap: 0.5,
|
128 |
+
width: "100%",
|
129 |
+
}}
|
130 |
+
>
|
131 |
+
{link.name}
|
132 |
+
<OpenInNewIcon sx={{ fontSize: "0.75rem", opacity: 0.6 }} />
|
133 |
+
</a>
|
134 |
+
</MenuItem>
|
135 |
+
))}
|
136 |
+
</Menu>
|
137 |
+
</>
|
138 |
+
) : (
|
139 |
+
<Typography
|
140 |
+
variant="body2"
|
141 |
+
sx={{
|
142 |
+
display: "flex",
|
143 |
+
gap: 2,
|
144 |
+
alignItems: "center",
|
145 |
+
}}
|
146 |
>
|
147 |
+
{externalLinks.map((link, index) => (
|
148 |
+
<React.Fragment key={link.name}>
|
149 |
+
<a
|
150 |
+
href={link.url}
|
151 |
+
target="_blank"
|
152 |
+
rel="noopener noreferrer"
|
153 |
+
style={{ textDecoration: "none", color: "inherit" }}
|
154 |
+
>
|
155 |
+
{link.name}
|
156 |
+
<OpenInNewIcon
|
157 |
+
sx={{ fontSize: "0.75rem", ml: 0.5, opacity: 0.6 }}
|
158 |
+
/>
|
159 |
+
</a>
|
160 |
+
{index < externalLinks.length - 1 && (
|
161 |
+
<Typography component="span" sx={{ opacity: 0.5 }}>
|
162 |
+
•
|
163 |
+
</Typography>
|
164 |
+
)}
|
165 |
+
</React.Fragment>
|
166 |
+
))}
|
167 |
</Typography>
|
168 |
+
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
<Box sx={{ display: "flex", alignItems: "center" }}>
|
170 |
<Tooltip title="Share">
|
171 |
<IconButton
|