import { useEffect, useState } from "react"; import Hero from "@/components/Hero"; import ScheduleBoard from "@/components/ScheduleBoard"; import Ado2Ad from "@/components/Ado2Ad"; import Footer from "@/components/Footer"; import { dict } from "@/lib/i18n"; import { useLang } from "@/lib/useLang"; import { useLeague } from "@/lib/useLeague"; import { listMatches } from "@/lib/api"; import type { Match } from "@/lib/types"; // L1. 전체 일정 대시보드 (랜딩 진입) — 리그 탭(월드컵/KBO/MLB)별 경기 목록 export default function Dashboard() { const lang = useLang(); const [league] = useLeague(); const t = dict(lang); const [matches, setMatches] = useState(null); const [error, setError] = useState(false); useEffect(() => { let alive = true; setMatches(null); setError(false); listMatches(lang, league) .then((m) => alive && setMatches(m)) .catch(() => alive && setError(true)); return () => { alive = false; }; }, [lang, league]); return (
{/* 기간 안내 + CTA 영역 */}

{t.introLead}

{t.prizeLine1}
{t.prizeLine2}

{error && (

{lang === "en" ? "Failed to load matches." : "경기 정보를 불러오지 못했습니다."}

)} {matches && }
); }