feat: KBO/MLB 운영 안정화 — 순위 탭·라이브 개선·취소/더블헤더 지원·야구 점수제
AI 예측 - 생성 시점을 킥오프 22시간 전으로 변경(선발투수 예고 이후), 잡 매시간 실행 - 경기 시작 후 생성 금지(사후 예측 방지), 경기 단위 커밋으로 중단 시 진행분 보존 일정·라이브 UI - 야구 일정에 순위 탭 추가 (KBO 단일 순위표 · MLB 6개 디비전, /api/standings 신설) - 경기중 카드에 현재 이닝·실시간 스코어 표시 (30s 폴링, 서버 15s 캐시) - MLB 선발 누락 수정: statsapi 날짜 파라미터 미국 날짜 기준 보정(-1일) - 라이브 대기타석 스크롤바 다크 테마 처리 운영 견고성 - 우천취소: 경기 삭제 → cancelled 상태 보존 (투표·예측 기록 유지, 정산/투표/AI 제외) - 더블헤더: 시작시각순 seq로 1·2차전 분리 등록 (match_id _2, 정산·라이브·프리뷰 매핑) - 축구 데이터 수집을 wc 리그로 한정 (야구 팀을 축구 API에 검색하던 쿼터 낭비 수정) 점수제 - 야구 판정 완화: 근접=득실차 ±1, 부분=한 팀 득점 ±1 (등급·배점은 리그 공통 유지) - 채점 판정을 _grade_of() 단일 함수로 통합, 종료된 야구 경기 재채점 - 배점 안내 모달 야구 문구 분리, docs/SCORING.md 갱신 기타 - 야구 전용 댓글 닉네임 풀 (종목별 세션 캐시 분리) - 리더보드 리그별 조회 연동 (?league=)
This commit is contained in:
1 parent
bfaf621949
commit
4e1ebc8989
46 files changed
+2560
-188
No files matched your search
@@ -5,17 +5,39 @@ import BallIcon from "./BallIcon";
|
||||
import TeamFlag from "./TeamFlag";
|
||||
import WaveStrip from "./WaveStrip";
|
||||
|
||||
// 순위 캐시 → "3위 · 52승37패 (0.584)" 한 줄 (야구)
|
||||
function standingLine(
|
||||
st: { rank?: number | null; w?: number; l?: number; wra?: string | number } | null | undefined,
|
||||
lang: Lang,
|
||||
): string | null {
|
||||
if (!st?.rank) return null;
|
||||
const rank = lang === "en" ? `#${st.rank}` : `${st.rank}위`;
|
||||
if (st.w == null || st.l == null) return rank;
|
||||
const rec = lang === "en" ? `${st.w}W ${st.l}L` : `${st.w}승${st.l}패`;
|
||||
return `${rank} · ${rec}${st.wra ? ` (${st.wra})` : ""}`;
|
||||
}
|
||||
|
||||
export default function MatchupHUD({ match, lang = "ko" }: { match: Match; lang?: Lang }) {
|
||||
const t = dict(lang);
|
||||
const { group } = match;
|
||||
const finished = !!match.result;
|
||||
// 한국을 항상 왼쪽에 표시(요청). 데이터/투표는 원본 A/B 프레임 유지, 화면 좌우만 교체.
|
||||
const flip = match.teamB.code === "KOR" && match.teamA.code !== "KOR";
|
||||
const isBaseball = match.league === "kbo" || match.league === "mlb";
|
||||
// 축구: 한국을 항상 왼쪽에. 야구: A=원정(좌), B=홈(우) 고정.
|
||||
const flip = !isBaseball && match.teamB.code === "KOR" && match.teamA.code !== "KOR";
|
||||
const left = flip ? match.teamB : match.teamA;
|
||||
const right = flip ? match.teamA : match.teamB;
|
||||
const leftScore = flip ? match.result?.scoreB : match.result?.scoreA;
|
||||
const rightScore = flip ? match.result?.scoreA : match.result?.scoreB;
|
||||
// 마스코트(파도타기 등)는 모든 경기에서 노출.
|
||||
|
||||
const ex = match.extras;
|
||||
const spL = ex?.starterA;
|
||||
const spR = ex?.starterB;
|
||||
const stL = standingLine(ex?.standings?.a, lang);
|
||||
const stR = standingLine(ex?.standings?.b, lang);
|
||||
const vs = ex?.seasonVs;
|
||||
const hasVs = !!vs && vs.aWin != null && vs.bWin != null;
|
||||
const flagCls = isBaseball ? "mx-auto h-[72px] w-[72px]" : "mx-auto h-[68px] w-[104px]";
|
||||
|
||||
return (
|
||||
<section className="mt-6">
|
||||
{/* 대결 카드 (녹색 글로우 보더) */}
|
||||
@@ -23,10 +45,12 @@ export default function MatchupHUD({ match, lang = "ko" }: { match: Match; lang?
|
||||
className="relative rounded-3xl border-2 border-[var(--green)] bg-[#171b21] p-5"
|
||||
style={{ boxShadow: "0 0 28px rgba(74,255,160,0.35), inset 0 0 24px rgba(74,255,160,0.06)" }}
|
||||
>
|
||||
{/* 박스 오른쪽 상단 파도타기 (응원 5마리) — 모든 경기 노출 */}
|
||||
<div className="absolute right-2 top-2 z-10">
|
||||
<WaveStrip />
|
||||
</div>
|
||||
{/* 파도타기 마스코트 — 축구 전용 (야구는 미노출) */}
|
||||
{!isBaseball && (
|
||||
<div className="absolute right-2 top-2 z-10">
|
||||
<WaveStrip />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 헤더: 브랜드 아이콘 + 팀명 + 일시 */}
|
||||
<div className="flex items-center gap-3">
|
||||
@@ -38,15 +62,22 @@ export default function MatchupHUD({ match, lang = "ko" }: { match: Match; lang?
|
||||
</div>
|
||||
<div className="mt-1 text-[15px] font-bold text-[var(--green)]">
|
||||
{kickoffDisplay(match.kickoffKst, lang)} ·{" "}
|
||||
{group ? t.group(group) : tRound(match.roundLabel, lang)}
|
||||
{!isBaseball && group ? t.group(group) : tRound(match.roundLabel, lang)}
|
||||
</div>
|
||||
<div className="mt-0.5 text-[12px] text-white/65">
|
||||
{match.venue}
|
||||
{isBaseball && (
|
||||
<span className="text-white/40">
|
||||
{" "}· {lang === "en" ? "Home: " : "홈 "}{teamShort(right, lang)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-0.5 text-[12px] text-white/65">{match.venue}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 국기 + 라이트닝 VS (종료 시 최종 스코어) */}
|
||||
{/* 국기/로고 + 라이트닝 VS (종료 시 최종 스코어) */}
|
||||
<div className="mt-5 grid grid-cols-[1fr_auto_1fr] items-center gap-3">
|
||||
<TeamFlag team={left} className="mx-auto h-[68px] w-[104px]" />
|
||||
<TeamFlag team={left} className={flagCls} />
|
||||
<div className="relative grid place-items-center">
|
||||
<div className="vs-glow absolute h-28 w-28" />
|
||||
{finished && match.result ? (
|
||||
@@ -64,9 +95,78 @@ export default function MatchupHUD({ match, lang = "ko" }: { match: Match; lang?
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<TeamFlag team={right} className="mx-auto h-[68px] w-[104px]" />
|
||||
<TeamFlag team={right} className={flagCls} />
|
||||
</div>
|
||||
|
||||
{/* 야구 정보 패널: 선발 매치업 · 순위 · 시즌 상대전적 (캐시 있을 때만) */}
|
||||
{isBaseball && (spL || spR || stL || stR || hasVs) && (
|
||||
<div className="mt-4 rounded-2xl bg-white/[0.04] p-3.5 text-[12px]">
|
||||
{(spL || spR) && (
|
||||
<div className="grid grid-cols-[1fr_auto_1fr] items-start gap-2">
|
||||
<div className="min-w-0">
|
||||
<div className="truncate font-extrabold text-white/90">
|
||||
{spL?.name ?? (lang === "en" ? "TBA" : "미정")}
|
||||
{spL?.hitType ? (
|
||||
<span className="ml-1 font-semibold text-white/40">{spL.hitType.slice(0, 2)}</span>
|
||||
) : null}
|
||||
</div>
|
||||
{spL?.era != null && (
|
||||
<div className="mt-0.5 text-white/50">
|
||||
ERA {spL.era}
|
||||
{spL.w != null ? ` · ${spL.w}${lang === "en" ? "W" : "승"}${spL.l ?? 0}${lang === "en" ? "L" : "패"}` : ""}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<span className="pt-0.5 text-[11px] font-bold text-[var(--green)]">
|
||||
{lang === "en" ? "Starting P" : "선발 투수"}
|
||||
</span>
|
||||
<div className="min-w-0 text-right">
|
||||
<div className="truncate font-extrabold text-white/90">
|
||||
{spR?.hitType ? (
|
||||
<span className="mr-1 font-semibold text-white/40">{spR.hitType.slice(0, 2)}</span>
|
||||
) : null}
|
||||
{spR?.name ?? (lang === "en" ? "TBA" : "미정")}
|
||||
</div>
|
||||
{spR?.era != null && (
|
||||
<div className="mt-0.5 text-white/50">
|
||||
ERA {spR.era}
|
||||
{spR.w != null ? ` · ${spR.w}${lang === "en" ? "W" : "승"}${spR.l ?? 0}${lang === "en" ? "L" : "패"}` : ""}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(stL || stR) && (
|
||||
<div className="mt-2.5 flex items-center justify-between border-t border-white/10 pt-2.5 text-white/55">
|
||||
<span className="truncate">{stL ?? "—"}</span>
|
||||
<span className="px-2 text-[10px] text-white/30">{lang === "en" ? "STANDINGS" : "순위"}</span>
|
||||
<span className="truncate text-right">{stR ?? "—"}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{hasVs && (
|
||||
<div className="mt-2.5 border-t border-white/10 pt-2.5">
|
||||
<div className="flex items-center justify-between font-bold text-white/75">
|
||||
<span>{vs!.aWin}{lang === "en" ? "W" : "승"}</span>
|
||||
<span className="text-[10px] text-white/35">
|
||||
{lang === "en" ? "SEASON H2H" : "시즌 상대전적"}
|
||||
{vs!.draw ? ` · ${vs!.draw}${lang === "en" ? "D" : "무"}` : ""}
|
||||
</span>
|
||||
<span>{vs!.bWin}{lang === "en" ? "W" : "승"}</span>
|
||||
</div>
|
||||
<div className="mt-1.5 flex h-1.5 gap-0.5 overflow-hidden rounded-full">
|
||||
<div
|
||||
className="bg-[var(--green)]/80"
|
||||
style={{ width: `${(100 * (vs!.aWin ?? 0)) / Math.max(1, (vs!.aWin ?? 0) + (vs!.bWin ?? 0))}%` }}
|
||||
/>
|
||||
<div className="flex-1 bg-white/20" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{finished && (
|
||||
<div className="mt-3 text-center text-[12px] font-bold text-[var(--green)]">
|
||||
{t.matchEnded}
|
||||
|
||||
Reference in new issue
Block a user