tfrere commited on
Commit
2098c43
·
1 Parent(s): 9cd0edd

update quick filter display on mobile

Browse files
frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/QuickFilters.js CHANGED
@@ -11,14 +11,21 @@ export const QuickFiltersSkeleton = () => (
11
  <Box sx={{ width: "100%" }}>
12
  <Box
13
  sx={{
 
 
 
 
 
 
 
 
 
 
 
14
  display: "flex",
15
- flexDirection: { xs: "column", md: "row" },
16
- alignItems: { xs: "flex-start", md: "center" },
17
  gap: 2,
18
  width: "100%",
19
- minHeight: { xs: "auto", md: "48px" },
20
- py: 1,
21
- px: 2,
22
  }}
23
  >
24
  <Box
@@ -26,8 +33,8 @@ export const QuickFiltersSkeleton = () => (
26
  display: "flex",
27
  alignItems: "center",
28
  gap: 1,
29
- width: { xs: "100%", md: "auto" },
30
- mb: { xs: 1, md: 0 },
31
  }}
32
  >
33
  <Typography
@@ -36,7 +43,6 @@ export const QuickFiltersSkeleton = () => (
36
  fontSize: "0.8rem",
37
  fontWeight: 700,
38
  color: "text.secondary",
39
- whiteSpace: "nowrap",
40
  }}
41
  >
42
  Quick Filters
@@ -50,42 +56,27 @@ export const QuickFiltersSkeleton = () => (
50
  sx={{
51
  display: "flex",
52
  flexDirection: { xs: "column", md: "row" },
53
- alignItems: { xs: "stretch", md: "center" },
54
- gap: 2,
55
- flex: 1,
56
- width: { xs: "100%", md: "auto" },
 
57
  }}
58
  >
59
- <Box
60
- sx={{
61
- display: "flex",
62
- flexDirection: { xs: "column", md: "row" },
63
- gap: 0.5,
64
- flexWrap: { xs: "nowrap", md: "nowrap" },
65
- borderRight: {
66
- xs: "none",
67
- md: (theme) => `1px solid ${alpha(theme.palette.divider, 0.2)}`,
68
- },
69
- borderBottom: {
70
- xs: (theme) => `1px solid ${alpha(theme.palette.divider, 0.2)}`,
71
- md: "none",
72
- },
73
- pr: { xs: 0, md: 2 },
74
- pb: { xs: 2, md: 0 },
75
- mr: 0,
76
- }}
77
- >
78
- {[1, 2, 3].map((i) => (
79
- <Skeleton
80
- key={i}
81
- width={120}
82
- height={32}
83
- sx={{ borderRadius: 1 }}
84
- />
85
- ))}
86
- </Box>
87
- <Skeleton width={150} height={32} sx={{ borderRadius: 1 }} />
88
  </Box>
 
 
 
 
 
89
  </Box>
90
  </Box>
91
  );
@@ -162,14 +153,10 @@ const QuickFilters = ({ totalCount = 0, loading = false }) => {
162
  border: "1px solid",
163
  borderRadius: 1,
164
  p: 3,
165
- position: "relative",
166
- width: "100%",
167
  display: "flex",
168
- flexDirection: { xs: "column", lg: "row" },
169
- transition: (theme) =>
170
- theme.transitions.create(["border-color", "background-color"], {
171
- duration: theme.transitions.duration.short,
172
- }),
173
  }}
174
  >
175
  <Box
@@ -177,8 +164,7 @@ const QuickFilters = ({ totalCount = 0, loading = false }) => {
177
  display: "flex",
178
  alignItems: "center",
179
  gap: 0.5,
180
- mb: 1.5,
181
- mr: 2,
182
  }}
183
  >
184
  <Typography variant="body2" sx={{ fontWeight: 600 }}>
@@ -193,30 +179,21 @@ const QuickFilters = ({ totalCount = 0, loading = false }) => {
193
  <Box
194
  sx={{
195
  display: "flex",
196
- flexDirection: { xs: "column", lg: "row" },
197
- alignItems: { xs: "stretch", lg: "center" },
198
  gap: 2,
199
  flex: 1,
200
- width: { xs: "100%", md: "auto" },
201
  }}
202
  >
203
  <Box
204
  sx={{
205
  display: "flex",
206
- flexDirection: { xs: "column", lg: "row" },
207
- gap: 0.5,
208
- flexWrap: { xs: "nowrap", lg: "nowrap" },
209
- borderRight: {
210
- xs: "none",
211
- md: (theme) => `1px solid ${alpha(theme.palette.divider, 0.2)}`,
212
- },
213
- borderBottom: {
214
- xs: (theme) => `1px solid ${alpha(theme.palette.divider, 0.2)}`,
215
- md: "none",
216
  },
217
- pr: { xs: 0, md: 2 },
218
- pb: { xs: 2, md: 0 },
219
- mr: 0,
220
  }}
221
  >
222
  {modelSizePresets.map((preset) => (
@@ -230,6 +207,9 @@ const QuickFilters = ({ totalCount = 0, loading = false }) => {
230
  onChange={() => handleSizePresetClick(preset)}
231
  count={getPresetCount(preset)}
232
  totalCount={totalCount}
 
 
 
233
  />
234
  ))}
235
  </Box>
@@ -243,6 +223,7 @@ const QuickFilters = ({ totalCount = 0, loading = false }) => {
243
  totalCount={totalCount}
244
  showCheckbox={true}
245
  variant="secondary"
 
246
  />
247
  )}
248
  </Box>
 
11
  <Box sx={{ width: "100%" }}>
12
  <Box
13
  sx={{
14
+ backgroundColor: (theme) => ({
15
+ xs: alpha(theme.palette.primary.main, 0.02),
16
+ lg: "transparent",
17
+ }),
18
+ borderColor: (theme) => ({
19
+ xs: alpha(theme.palette.primary.main, 0.2),
20
+ lg: "transparent",
21
+ }),
22
+ border: "1px solid",
23
+ borderRadius: 1,
24
+ p: 3,
25
  display: "flex",
26
+ flexDirection: { xs: "column", md: "column", lg: "row" },
 
27
  gap: 2,
28
  width: "100%",
 
 
 
29
  }}
30
  >
31
  <Box
 
33
  display: "flex",
34
  alignItems: "center",
35
  gap: 1,
36
+ width: "100%",
37
+ mb: { xs: 1, md: 2, lg: 0 },
38
  }}
39
  >
40
  <Typography
 
43
  fontSize: "0.8rem",
44
  fontWeight: 700,
45
  color: "text.secondary",
 
46
  }}
47
  >
48
  Quick Filters
 
56
  sx={{
57
  display: "flex",
58
  flexDirection: { xs: "column", md: "row" },
59
+ gap: 1,
60
+ width: "100%",
61
+ "& > *": {
62
+ flex: { md: 1 },
63
+ },
64
  }}
65
  >
66
+ {[1, 2, 3].map((i) => (
67
+ <Skeleton
68
+ key={i}
69
+ width={{ xs: "100%", md: "auto" }}
70
+ height={32}
71
+ sx={{ borderRadius: 1 }}
72
+ />
73
+ ))}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  </Box>
75
+ <Skeleton
76
+ width={{ xs: "100%", md: 150 }}
77
+ height={32}
78
+ sx={{ borderRadius: 1 }}
79
+ />
80
  </Box>
81
  </Box>
82
  );
 
153
  border: "1px solid",
154
  borderRadius: 1,
155
  p: 3,
 
 
156
  display: "flex",
157
+ flexDirection: { xs: "column", md: "column", lg: "row" },
158
+ gap: 2,
159
+ width: "100%",
 
 
160
  }}
161
  >
162
  <Box
 
164
  display: "flex",
165
  alignItems: "center",
166
  gap: 0.5,
167
+ mb: { xs: 1, md: 2, lg: 0 },
 
168
  }}
169
  >
170
  <Typography variant="body2" sx={{ fontWeight: 600 }}>
 
179
  <Box
180
  sx={{
181
  display: "flex",
182
+ flexDirection: { xs: "column", md: "column", lg: "row" },
 
183
  gap: 2,
184
  flex: 1,
185
+ width: "100%",
186
  }}
187
  >
188
  <Box
189
  sx={{
190
  display: "flex",
191
+ flexDirection: { xs: "column", md: "row" },
192
+ gap: 1,
193
+ width: "100%",
194
+ "& > *": {
195
+ flex: { md: 1 },
 
 
 
 
 
196
  },
 
 
 
197
  }}
198
  >
199
  {modelSizePresets.map((preset) => (
 
207
  onChange={() => handleSizePresetClick(preset)}
208
  count={getPresetCount(preset)}
209
  totalCount={totalCount}
210
+ sx={{
211
+ width: { xs: "100%", md: "auto" },
212
+ }}
213
  />
214
  ))}
215
  </Box>
 
223
  totalCount={totalCount}
224
  showCheckbox={true}
225
  variant="secondary"
226
+ sx={{ width: { xs: "100%", md: "100%", lg: "auto" } }}
227
  />
228
  )}
229
  </Box>
frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Filters/SearchBar.js CHANGED
@@ -307,7 +307,7 @@ const SearchBar = ({
307
  sx={{
308
  color: "text.secondary",
309
  fontSize: "0.75rem",
310
- textAlign: { xs: "center", sm: "left" },
311
  opacity: 1,
312
  transition: "opacity 0.2s ease",
313
  minHeight: "18px",
 
307
  sx={{
308
  color: "text.secondary",
309
  fontSize: "0.75rem",
310
+ textAlign: { xs: "center", md: "left" },
311
  opacity: 1,
312
  transition: "opacity 0.2s ease",
313
  minHeight: "18px",