import { Link, useNavigate } from "react-router-dom"; import ShareButton from "./ShareButton"; import LangSwitch from "./LangSwitch"; import { type Lang, dict } from "@/lib/i18n"; import type { League } from "@/lib/types"; type Share = { url: string; title: string; text: string }; // 브랜드 헤더 (대시보드·상세 공용). 경기별 후킹 카피는 상세 페이지에서 별도 노출. export default function Hero({ back = false, share, lang = "ko", league = "wc", }: { back?: boolean; share?: Share; lang?: Lang; league?: League; }) { const t = dict(lang); const navigate = useNavigate(); const home = lang === "en" ? "/?lang=en" : "/"; // 뒤로가기: 앱 내 이력이 있으면 직전 페이지로 그대로 복귀(전체 일정의 선택 날짜 보존), // 없으면(공유 링크로 직접 진입 등) 전체 일정으로 이동. const goBack = (e: React.MouseEvent) => { e.preventDefault(); const idx = (window.history.state?.idx as number | undefined) ?? 0; if (idx > 0) navigate(-1); else navigate(home); }; return (
{back && (
{t.back} {share && ( )}
)}
TRIPLE PICK 2026
AI Prediction Arena
{league === "kbo" ? lang === "en" ? "AI-powered 2026 KBO League game predictions" : "AI와 함께하는 2026 프로야구 KBO 승부예측 챌린지" : league === "mlb" ? lang === "en" ? "AI-powered 2026 MLB game predictions" : "AI와 함께하는 2026 MLB 승부예측 챌린지" : t.heroPill}
); } // 리그 전환 탭 — 단일 앱 내 전환. 탭 클릭 시 해당 리그 대시보드로 이동. function LeagueTabs({ lang, current }: { lang: Lang; current: League }) { const navigate = useNavigate(); const tabs: { key: League; label: string }[] = [ { key: "wc", label: lang === "en" ? "World Cup" : "월드컵" }, { key: "kbo", label: "KBO" }, { key: "mlb", label: "MLB" }, ]; return (
{tabs.map((tab) => tab.key === current ? ( {tab.label} ) : ( ), )}
); }