"use client"; import { Box, Flex, Text, Heading, Badge, VStack, HStack, Image, Spinner, Button, Card, } from "@chakra-ui/react"; import { useTranslations } from "next-intl"; import { useParams, useRouter } from "next/navigation"; import { useColorModeValue } from "@/components/ui/color-mode"; import { SlideUp } from "@/components/motion"; import { useMatchDetails } from "@/lib/api/matches/use-hooks"; import { usePrediction } from "@/lib/api/predictions/use-hooks"; import PredictionCard from "@/components/matches/prediction-card"; import OddsCard from "@/components/matches/odds-card"; import LineupsCard from "@/components/matches/lineups-card"; import { LuArrowLeft, LuRefreshCw } from "react-icons/lu"; export default function MatchDetailContent() { const t = useTranslations("matches"); const tPred = useTranslations("predictions"); const tCommon = useTranslations("common"); const params = useParams(); const router = useRouter(); const matchId = params.id as string; const { data: matchData, isLoading: matchLoading } = useMatchDetails(matchId); const { data: predictionData, isLoading: predLoading, refetch: refetchPrediction, } = usePrediction(matchId); const headerBg = useColorModeValue("white", "gray.800"); const borderColor = useColorModeValue("gray.100", "gray.700"); const match = matchData?.data; const prediction = predictionData?.data; if (matchLoading) { return ( ); } if (!match) { return ( {t("no-matches")} ); } const isLive = match.status === "LIVE"; const isFinished = match.status === "Finished"; return ( {/* Back Button */} {/* Match Header */} {/* League Info */} {match.league && ( {match.league.country?.flag && ( {match.league.country.name )} {match.league.name} {isLive && ( )} {isLive ? t("live") : isFinished ? t("finished") : t("not-started")} )} {/* Teams & Score */} {/* Home Team */} {match.homeTeam?.logo ? ( {match.homeTeam.name} ) : ( {match.homeTeam?.name?.charAt(0) || "H"} )} {match.homeTeam?.name} {t("home-team")} {/* Score */} {match.score && (isLive || isFinished) ? ( {match.score.home} - {match.score.away} ) : ( {t("vs")} )} {new Date(match.mstUtc).toLocaleDateString("tr-TR", { weekday: "short", day: "2-digit", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit", })} {/* Away Team */} {match.awayTeam?.logo ? ( {match.awayTeam.name} ) : ( {match.awayTeam?.name?.charAt(0) || "A"} )} {match.awayTeam?.name} {t("away-team")} {/* Lineups Section */} {/* Prediction Section */} {tPred("title")} {predLoading ? ( ) : prediction ? ( ) : ( {tPred("no-predictions")} )} {/* Odds Section */} {match.odds && Object.keys(match.odds).length > 0 && ( )} ); }