"use client";
import { Box, VStack, Text, Badge, Flex, Image } from "@chakra-ui/react";
import { useTranslations } from "next-intl";
import { useColorModeValue } from "@/components/ui/color-mode";
import type { ActiveLeagueDto } from "@/lib/api/matches/types";
interface LeagueSidebarProps {
leagues: ActiveLeagueDto[];
selectedLeagueId: string | null;
onSelect: (leagueId: string | null) => void;
isLoading?: boolean;
}
export default function LeagueSidebar({
leagues,
selectedLeagueId,
onSelect,
isLoading,
}: LeagueSidebarProps) {
const t = useTranslations("matches");
const bg = useColorModeValue("white", "gray.800");
const borderColor = useColorModeValue("gray.100", "gray.700");
const activeBg = useColorModeValue("primary.50", "primary.900");
const hoverBg = useColorModeValue("gray.50", "gray.750");
if (isLoading) {
return (
{Array.from({ length: 6 }).map((_, i) => (
))}
);
}
return (
{/* Header */}
{t("active-leagues")}
{/* All Leagues Option */}
onSelect(null)}
transition="background 0.15s"
borderBottomWidth="1px"
borderColor={borderColor}
>
{t("all-leagues")}
{/* League List */}
{leagues.map((league) => {
const isActive = selectedLeagueId === league.id;
return (
onSelect(league.id)}
transition="background 0.15s"
borderBottomWidth="1px"
borderColor={borderColor}
>
{league.countryFlag && (
)}
{league.name}
{league.liveCount > 0 && (
{league.liveCount}
)}
{league.matchCount}
);
})}
);
}