tfrere HF Staff commited on
Commit
8ad9fad
·
1 Parent(s): 5876642
client/src/components/LeaderboardSection.jsx CHANGED
@@ -16,7 +16,7 @@ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
16
  import { useLeaderboard } from "../context/LeaderboardContext";
17
  import SearchOffIcon from "@mui/icons-material/SearchOff";
18
 
19
- const ITEMS_PER_PAGE = 3;
20
 
21
  const LeaderboardSection = ({
22
  title,
@@ -213,12 +213,12 @@ const LeaderboardSection = ({
213
  const remainingLeaderboards = approvedLeaderboards.slice(ITEMS_PER_PAGE);
214
 
215
  // Calculate how many skeletons we need
216
- const skeletonsNeeded = Math.max(0, 3 - approvedLeaderboards.length);
217
 
218
  // On affiche le bouton seulement si aucune catégorie n'est sélectionnée
219
  const showExpandButton = !selectedCategory;
220
 
221
- // Le bouton est actif seulement s'il y a plus de 3 leaderboards
222
  const isExpandButtonEnabled = approvedLeaderboards.length > ITEMS_PER_PAGE;
223
 
224
  const toggleExpanded = () => {
@@ -510,13 +510,13 @@ const LeaderboardSection = ({
510
  <>
511
  <Grid container spacing={3}>
512
  {displayedLeaderboards.map((leaderboard, index) => (
513
- <Grid item xs={12} sm={6} md={4} key={index}>
514
  <LeaderboardCard leaderboard={leaderboard} />
515
  </Grid>
516
  ))}
517
  {/* Add skeletons if needed */}
518
  {Array.from({ length: skeletonsNeeded }).map((_, index) => (
519
- <Grid item xs={12} sm={6} md={4} key={`skeleton-${index}`}>
520
  <Box
521
  sx={{
522
  height: "180px",
@@ -535,7 +535,7 @@ const LeaderboardSection = ({
535
  <Collapse in={isExpanded} timeout={300} unmountOnExit>
536
  <Grid container spacing={3} sx={{ mt: 0 }}>
537
  {remainingLeaderboards.map((leaderboard, index) => (
538
- <Grid item xs={12} sm={6} md={4} key={index + ITEMS_PER_PAGE}>
539
  <LeaderboardCard leaderboard={leaderboard} />
540
  </Grid>
541
  ))}
 
16
  import { useLeaderboard } from "../context/LeaderboardContext";
17
  import SearchOffIcon from "@mui/icons-material/SearchOff";
18
 
19
+ const ITEMS_PER_PAGE = 4;
20
 
21
  const LeaderboardSection = ({
22
  title,
 
213
  const remainingLeaderboards = approvedLeaderboards.slice(ITEMS_PER_PAGE);
214
 
215
  // Calculate how many skeletons we need
216
+ const skeletonsNeeded = Math.max(0, 4 - approvedLeaderboards.length);
217
 
218
  // On affiche le bouton seulement si aucune catégorie n'est sélectionnée
219
  const showExpandButton = !selectedCategory;
220
 
221
+ // Le bouton est actif seulement s'il y a plus de 4 leaderboards
222
  const isExpandButtonEnabled = approvedLeaderboards.length > ITEMS_PER_PAGE;
223
 
224
  const toggleExpanded = () => {
 
510
  <>
511
  <Grid container spacing={3}>
512
  {displayedLeaderboards.map((leaderboard, index) => (
513
+ <Grid item xs={12} sm={6} md={3} key={index}>
514
  <LeaderboardCard leaderboard={leaderboard} />
515
  </Grid>
516
  ))}
517
  {/* Add skeletons if needed */}
518
  {Array.from({ length: skeletonsNeeded }).map((_, index) => (
519
+ <Grid item xs={12} sm={6} md={3} key={`skeleton-${index}`}>
520
  <Box
521
  sx={{
522
  height: "180px",
 
535
  <Collapse in={isExpanded} timeout={300} unmountOnExit>
536
  <Grid container spacing={3} sx={{ mt: 0 }}>
537
  {remainingLeaderboards.map((leaderboard, index) => (
538
+ <Grid item xs={12} sm={6} md={3} key={index + ITEMS_PER_PAGE}>
539
  <LeaderboardCard leaderboard={leaderboard} />
540
  </Grid>
541
  ))}