diff --git a/frontend/src/pages/Matches.tsx b/frontend/src/pages/Matches.tsx index a34372e..15f2f9f 100644 --- a/frontend/src/pages/Matches.tsx +++ b/frontend/src/pages/Matches.tsx @@ -15,13 +15,16 @@ import { fetchMatchDetail, fetchMatchContext } from '../admin/dal' import type { MatchDetailOut, MatchContextOut } from '../admin/types' import { useMatchesList } from './matches/hooks/useMatchesList' import { useMatchPredict } from './matches/hooks/useMatchPredict' +import { useLeagues } from './matches/hooks/useLeagues' import { PredictModal } from './matches/components/MatchPredictPanel' import { MatchRow } from './matches/components/MatchDetailSection' import { Spinner, SkeletonRows, Switch, formatDateHeader, groupByDate, withinNext3Days } from './matches/ui' -import { LEAGUES, type Match } from './matches/types' +import { type Match } from './matches/types' export default function Matches() { const [error, setError] = useState(null) // 列表与预测共用(拆分前即如此) + // P1-3: 联赛列表优先请求 /api/v1/leagues,失败/空回退本地五大联赛常量 + const leagues = useLeagues() const { league, setLeague, status, setStatus, @@ -58,7 +61,7 @@ export default function Matches() { }, []) const scrollToTop = () => window.scrollTo({ top: 0, behavior: 'smooth' }) - const leagueName = LEAGUES.find(l => l.code === league)?.name ?? league + const leagueName = leagues.find(l => l.code === league)?.name ?? league /** 未开赛默认仅展示未来 3 天;其余状态展示全部。showAllUpcoming=true 时展开全部。 */ const isScheduledView = status === 'scheduled' @@ -91,7 +94,7 @@ export default function Matches() {
{/* ── 联赛版面切换 ── */}