Spaces:
Running
Running
remove old component and update chevron position
Browse files
client/src/components/LeaderboardSection/components/LanguageAccordion.jsx
DELETED
|
@@ -1,138 +0,0 @@
|
|
| 1 |
-
import React from "react";
|
| 2 |
-
import { Typography, Box, Button } from "@mui/material";
|
| 3 |
-
import { alpha } from "@mui/material/styles";
|
| 4 |
-
|
| 5 |
-
const TAG_COLOR = {
|
| 6 |
-
main: "#F44336",
|
| 7 |
-
light: "#FFEBEE",
|
| 8 |
-
};
|
| 9 |
-
|
| 10 |
-
const LanguageList = ({
|
| 11 |
-
languages,
|
| 12 |
-
languageStats,
|
| 13 |
-
selectedLanguage,
|
| 14 |
-
onLanguageSelect,
|
| 15 |
-
LANGUAGE_FAMILIES,
|
| 16 |
-
findLanguageFamily,
|
| 17 |
-
}) => {
|
| 18 |
-
// Group languages by family
|
| 19 |
-
const groupedLanguages = languages.reduce((acc, lang) => {
|
| 20 |
-
const { family } = findLanguageFamily(lang);
|
| 21 |
-
if (!acc[family]) {
|
| 22 |
-
acc[family] = [];
|
| 23 |
-
}
|
| 24 |
-
acc[family].push(lang);
|
| 25 |
-
return acc;
|
| 26 |
-
}, {});
|
| 27 |
-
|
| 28 |
-
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
| 29 |
-
|
| 30 |
-
return (
|
| 31 |
-
<Box sx={{ mb: 4 }}>
|
| 32 |
-
<Typography
|
| 33 |
-
variant="body2"
|
| 34 |
-
color="text.secondary"
|
| 35 |
-
sx={{ fontWeight: 500, mb: 2 }}
|
| 36 |
-
>
|
| 37 |
-
Filter by language
|
| 38 |
-
</Typography>
|
| 39 |
-
<Box
|
| 40 |
-
sx={{
|
| 41 |
-
display: "flex",
|
| 42 |
-
flexWrap: "wrap",
|
| 43 |
-
gap: 3,
|
| 44 |
-
}}
|
| 45 |
-
>
|
| 46 |
-
{Object.entries(groupedLanguages).map(
|
| 47 |
-
([family, familyLanguages], familyIndex) => (
|
| 48 |
-
<Box
|
| 49 |
-
key={family}
|
| 50 |
-
sx={{
|
| 51 |
-
display: "flex",
|
| 52 |
-
flexWrap: "wrap",
|
| 53 |
-
gap: 1,
|
| 54 |
-
}}
|
| 55 |
-
>
|
| 56 |
-
{familyLanguages.map((lang) => {
|
| 57 |
-
const isActive = selectedLanguage === lang;
|
| 58 |
-
const count = languageStats?.get(lang) || 0;
|
| 59 |
-
|
| 60 |
-
return (
|
| 61 |
-
<Button
|
| 62 |
-
key={lang}
|
| 63 |
-
onClick={() => onLanguageSelect(isActive ? null : lang)}
|
| 64 |
-
variant={isActive ? "contained" : "outlined"}
|
| 65 |
-
size="small"
|
| 66 |
-
sx={{
|
| 67 |
-
textTransform: "none",
|
| 68 |
-
cursor: "pointer",
|
| 69 |
-
mb: 0.75,
|
| 70 |
-
backgroundColor: (theme) => {
|
| 71 |
-
if (isActive) {
|
| 72 |
-
return TAG_COLOR.main;
|
| 73 |
-
}
|
| 74 |
-
return theme.palette.mode === "dark"
|
| 75 |
-
? "background.paper"
|
| 76 |
-
: TAG_COLOR.light;
|
| 77 |
-
},
|
| 78 |
-
color: (theme) => {
|
| 79 |
-
if (isActive) {
|
| 80 |
-
return "white";
|
| 81 |
-
}
|
| 82 |
-
return TAG_COLOR.main;
|
| 83 |
-
},
|
| 84 |
-
borderColor: TAG_COLOR.main,
|
| 85 |
-
"&:hover": {
|
| 86 |
-
backgroundColor: (theme) => {
|
| 87 |
-
if (isActive) {
|
| 88 |
-
return TAG_COLOR.main;
|
| 89 |
-
}
|
| 90 |
-
return TAG_COLOR.light;
|
| 91 |
-
},
|
| 92 |
-
opacity: 0.8,
|
| 93 |
-
},
|
| 94 |
-
"& .MuiTouchRipple-root": {
|
| 95 |
-
transition: "none",
|
| 96 |
-
},
|
| 97 |
-
transition: "none",
|
| 98 |
-
}}
|
| 99 |
-
>
|
| 100 |
-
{capitalize(lang)}
|
| 101 |
-
<Box
|
| 102 |
-
component="span"
|
| 103 |
-
sx={{
|
| 104 |
-
display: "inline-flex",
|
| 105 |
-
alignItems: "center",
|
| 106 |
-
gap: 0.75,
|
| 107 |
-
color: isActive ? "white" : "inherit",
|
| 108 |
-
ml: 0.75,
|
| 109 |
-
}}
|
| 110 |
-
>
|
| 111 |
-
<Box
|
| 112 |
-
component="span"
|
| 113 |
-
sx={(theme) => ({
|
| 114 |
-
width: "4px",
|
| 115 |
-
height: "4px",
|
| 116 |
-
borderRadius: "100%",
|
| 117 |
-
backgroundColor: isActive
|
| 118 |
-
? "rgba(255, 255, 255, 0.5)"
|
| 119 |
-
: alpha(
|
| 120 |
-
TAG_COLOR.main,
|
| 121 |
-
theme.palette.mode === "dark" ? 0.4 : 0.3
|
| 122 |
-
),
|
| 123 |
-
})}
|
| 124 |
-
/>
|
| 125 |
-
{count}
|
| 126 |
-
</Box>
|
| 127 |
-
</Button>
|
| 128 |
-
);
|
| 129 |
-
})}
|
| 130 |
-
</Box>
|
| 131 |
-
)
|
| 132 |
-
)}
|
| 133 |
-
</Box>
|
| 134 |
-
</Box>
|
| 135 |
-
);
|
| 136 |
-
};
|
| 137 |
-
|
| 138 |
-
export default LanguageList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
client/src/components/LeaderboardSection/components/LanguageList.jsx
CHANGED
|
@@ -56,6 +56,7 @@ const LanguageList = ({
|
|
| 56 |
"&:before": {
|
| 57 |
display: "none",
|
| 58 |
},
|
|
|
|
| 59 |
bgcolor: "transparent",
|
| 60 |
}}
|
| 61 |
>
|
|
@@ -65,6 +66,7 @@ const LanguageList = ({
|
|
| 65 |
id="language-filter-header"
|
| 66 |
sx={{
|
| 67 |
p: 0,
|
|
|
|
| 68 |
minHeight: "unset",
|
| 69 |
"& .MuiAccordionSummary-content": {
|
| 70 |
m: 0,
|
|
|
|
| 56 |
"&:before": {
|
| 57 |
display: "none",
|
| 58 |
},
|
| 59 |
+
|
| 60 |
bgcolor: "transparent",
|
| 61 |
}}
|
| 62 |
>
|
|
|
|
| 66 |
id="language-filter-header"
|
| 67 |
sx={{
|
| 68 |
p: 0,
|
| 69 |
+
width: "auto",
|
| 70 |
minHeight: "unset",
|
| 71 |
"& .MuiAccordionSummary-content": {
|
| 72 |
m: 0,
|