Multi-match restructure + 06.09 meeting reflection + scoring design

구조:
- 단일 경기 → 멀티 경기: 대시보드(/) + 경기 상세(/match/[matchId], 6경기 SSG) + 리더보드 stub(/leaderboard)
- 컴포넌트 파라미터화: MatchupHUD/Arena가 match·predictions·crowd props 수신 (싱글톤 의존 제거)
- 신규 컴포넌트: ScheduleBoard, Countdown, TeamFlag
- mockData: 경기별 결정론적 AI예측/Crowd 생성기(getPredictions/getCrowd) + matchUrl

06.09 회의 반영:
- 확률 라벨 "OO 승리 확률 %"+승리팀 국기(D3), confidence 바 제거 + 메인 리즌 강조
- 닉네임 제거→이메일만(D5), 투표 종료 카운트다운(D7), 결과 보기 전환, 경기별 공유(D8)
- "월드컵" 표현 제거→글로벌 축구(D9), 서브타이틀 중복 삭제, Crowd "AI 승리 확률과 다름" 라벨
- 포인트 컬러 #4AFFA0 통일, 일정 #94FBE0, 푸터 가시성 개선

채점·심사 설계(docs/SCORING.md):
- 공정성 모델 확정: 주최측 배제 + 순수 누적 포인트(점수는 정확도에서만)
- 배점/랭킹/배제/결과정의 + scorePrediction·rank 참조 구현
- 골드 카드 심사 기준 카피 정합

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Opus 4.8 committed 2026-06-09 14:05:14 +09:00
1 parent 0a96babc98
commit a0fc9d6194
19 files changed
+925 -244

No files matched your search

+35 -1
View File
@@ -1,4 +1,4 @@
import type { Outcome, Match } from "./types";
import type { Outcome, Match, AIPrediction, Team } from "./types";
export function outcomeLabel(match: Match, o: Outcome): string {
if (o === "TEAM_A_WIN") return `${match.teamA.shortName} 승`;
@@ -6,6 +6,40 @@ export function outcomeLabel(match: Match, o: Outcome): string {
return "무승부";
}
// D3: 확률 = "이긴다고 예측한 팀의 승리 확률". 무승부 예측이면 "무승부 가능성".
export function winProb(
match: Match,
p: Pick<AIPrediction, "outcome" | "confidencePct">,
): { team: Team | null; label: string; pct: number } {
if (p.outcome === "TEAM_A_WIN")
return { team: match.teamA, label: `${match.teamA.shortName} 승리 확률`, pct: p.confidencePct };
if (p.outcome === "TEAM_B_WIN")
return { team: match.teamB, label: `${match.teamB.shortName} 승리 확률`, pct: p.confidencePct };
return { team: null, label: "무승부 가능성", pct: p.confidencePct };
}
// "6월 12일 (금)" — 대시보드 날짜 그룹 헤더
export function dateHeading(iso: string): string {
const days = ["일", "월", "화", "수", "목", "금", "토"];
const dm = iso.match(/(\d{4})-(\d{2})-(\d{2})/);
if (!dm) return iso;
const [, y, mo, d] = dm;
const dow = days[new Date(Date.UTC(+y, +mo - 1, +d)).getUTCDay()];
return `${+mo}월 ${+d}일 (${dow})`;
}
// "11:00" — 경기 카드 시간
export function timeOnly(iso: string): string {
const m = iso.match(/T(\d{2}):(\d{2})/);
return m ? `${m[1]}:${m[2]}` : "";
}
// "2026-06-12" — 날짜 그룹 키
export function dateKey(iso: string): string {
const m = iso.match(/(\d{4}-\d{2}-\d{2})/);
return m ? m[1] : iso;
}
export function kickoffDisplay(iso: string): string {
// iso는 KST(+09:00). 런타임 TZ에 무관하게 ISO 문자열을 직접 파싱한다.
const days = ["일", "월", "화", "수", "목", "금", "토"];
+111 -13
View File
@@ -1,8 +1,11 @@
// 1차 mock 데이터 — Firebase 연결 전까지 사용.
// ⚠️ AI 예측은 플레이스홀더. 발행 전 GPT/Claude/Gemini 실제 출력(JSON)으로 교체할 것.
// 경기 일정은 lib/schedule.ts(Group A 정식 일정, KST)에서 자동 반영.
import type { AIPrediction, CrowdStats } from "./types";
import { FEATURED } from "./schedule";
//
// 멀티 경기(06.09 회의): 모든 경기에 3 AI 예측 + Crowd 가 있어야 대시보드/상세가 깨지지 않는다.
// 체코전(FEATURED)은 큐레이션 값, 그 외 경기는 matchId 시드 결정론적 생성 (Math.random 미사용).
import type { AIPrediction, CrowdStats, Match, ModelName, Outcome } from "./types";
import { FEATURED, GROUP_A } from "./schedule";
export const MATCH = FEATURED; // 대표 경기 = 한국 vs 체코 (schedule SSOT)
@@ -10,7 +13,8 @@ export const MATCH = FEATURED; // 대표 경기 = 한국 vs 체코 (schedule SSO
// true면 오픈 게이트를 무시하고 즉시 참여 가능. 운영 배포 시 false 로.
export const DEMO_FORCE_OPEN = true;
export const AI_PREDICTIONS: AIPrediction[] = [
// 체코전 큐레이션 예측 (D3: reason 짧고 또렷이)
const FEATURED_PREDICTIONS: AIPrediction[] = [
{
matchId: MATCH.matchId,
model: "GPT",
@@ -18,7 +22,7 @@ export const AI_PREDICTIONS: AIPrediction[] = [
scoreA: 2,
scoreB: 1,
confidencePct: 62,
reasonShort: "한국의 측면 공격 우위와 세트피스 강점",
reasonShort: "한국 측면 스피드가 한 끗 위",
generatedAt: "2026-06-08",
},
{
@@ -28,7 +32,7 @@ export const AI_PREDICTIONS: AIPrediction[] = [
scoreA: 1,
scoreB: 1,
confidencePct: 41,
reasonShort: "중원 밸런스가 팽팽한 접전 예상",
reasonShort: "중원 힘싸움이 끝까지 팽팽",
generatedAt: "2026-06-08",
},
{
@@ -38,17 +42,111 @@ export const AI_PREDICTIONS: AIPrediction[] = [
scoreA: 0,
scoreB: 2,
confidencePct: 28,
reasonShort: "체코의 전환 속도와 결정력 우세",
reasonShort: "체코 역습 한 방이 매섭다",
generatedAt: "2026-06-08",
},
];
export const CROWD: CrowdStats = {
matchId: MATCH.matchId,
total: 1284,
teamAWin: 616, // 48%
draw: 347, // 27%
teamBWin: 321, // 25%
// ── 결정론적 생성 (matchId 시드) ──────────────────────────────
function hash(s: string): number {
let h = 2166136261;
for (let i = 0; i < s.length; i++) {
h ^= s.charCodeAt(i);
h = Math.imul(h, 16777619);
}
return h >>> 0;
}
const MODELS: ModelName[] = ["GPT", "Claude", "Gemini"];
// AI 셋이 갈리도록 만든 결과 조합 (홈/원정 균형)
const OUTCOME_SETS: Outcome[][] = [
["TEAM_A_WIN", "DRAW", "TEAM_B_WIN"],
["TEAM_A_WIN", "TEAM_A_WIN", "DRAW"],
["TEAM_B_WIN", "DRAW", "TEAM_A_WIN"],
["TEAM_A_WIN", "DRAW", "TEAM_A_WIN"],
["DRAW", "TEAM_B_WIN", "TEAM_A_WIN"],
];
const SCORE_BY_OUTCOME: Record<Outcome, [number, number][]> = {
TEAM_A_WIN: [[2, 1], [1, 0], [2, 0], [3, 1]],
DRAW: [[1, 1], [0, 0], [2, 2]],
TEAM_B_WIN: [[0, 1], [1, 2], [0, 2], [1, 3]],
};
export const LANDING_URL = "https://triplepick.ai/predict/korea-vs-czechia";
function reasonFor(match: Match, outcome: Outcome, seed: number): string {
const A = match.teamA.shortName;
const B = match.teamB.shortName;
const win = outcome === "TEAM_A_WIN" ? A : outcome === "TEAM_B_WIN" ? B : null;
const winPool = win
? [
`${win} 측면 스피드가 한 끗 위`,
`${win} 세트피스 한 방이면 끝`,
`${win} 초반 기세에서 앞선다`,
`${win} 결정력이 승부를 가른다`,
]
: [];
const drawPool = [
"중원 힘싸움이 끝까지 팽팽",
"양 팀 다 한 방 있는 진검승부",
"first goal이 모든 걸 가른다",
];
const pool = win ? winPool : drawPool;
return pool[seed % pool.length];
}
function generatePredictions(match: Match): AIPrediction[] {
const base = hash(match.matchId);
const outcomes = OUTCOME_SETS[base % OUTCOME_SETS.length];
return MODELS.map((model, i) => {
const seed = hash(match.matchId + model);
const outcome = outcomes[i];
const scores = SCORE_BY_OUTCOME[outcome];
const [scoreA, scoreB] = scores[seed % scores.length];
const confidencePct =
outcome === "DRAW" ? 33 + (seed % 13) : 46 + (seed % 25); // draw 33~45, win 46~70
return {
matchId: match.matchId,
model,
outcome,
scoreA,
scoreB,
confidencePct,
reasonShort: reasonFor(match, outcome, seed),
generatedAt: "2026-06-08",
};
});
}
export function getPredictions(match: Match): AIPrediction[] {
if (match.matchId === FEATURED.matchId) return FEATURED_PREDICTIONS;
return generatePredictions(match);
}
export function getCrowd(match: Match): CrowdStats {
if (match.matchId === FEATURED.matchId) {
return { matchId: MATCH.matchId, total: 1284, teamAWin: 616, draw: 347, teamBWin: 321 };
}
const base = hash(match.matchId + "crowd");
const total = 240 + (base % 1400);
const a = 28 + (base % 40); // 28~67%
const d = 18 + ((base >> 3) % 22); // 18~39%
const teamAWin = Math.round((total * a) / 100);
const draw = Math.round((total * Math.min(d, 100 - a - 5)) / 100);
const teamBWin = total - teamAWin - draw;
return { matchId: match.matchId, total, teamAWin, draw, teamBWin };
}
// 경기별 공유 딥링크 (D8)
const ORIGIN = "https://triplepick-web.vercel.app";
export function matchUrl(matchId: string): string {
return `${ORIGIN}/match/${matchId}`;
}
// ── 하위 호환 (체코전 단일 참조용) ──
export const AI_PREDICTIONS: AIPrediction[] = FEATURED_PREDICTIONS;
export const CROWD: CrowdStats = getCrowd(FEATURED);
export const LANDING_URL = matchUrl(FEATURED.matchId);
// schedule re-export (페이지에서 한 곳에서 import)
export { GROUP_A };
+27 -2
View File
@@ -25,7 +25,7 @@ export const GROUP_A: Match[] = [
opensAt: opens("2026-06-12T04:00:00+09:00"),
lockAt: "2026-06-12T04:00:00+09:00",
status: "upcoming",
hookText: "월드컵 개막전, AI는 개최국을 믿을까",
hookText: "글로벌 축구 개막전, AI는 개최국을 믿을까",
result: null,
},
{
@@ -100,7 +100,7 @@ export const GROUP_A: Match[] = [
},
];
// 현재 노출할 대표 경기
// 현재 노출할 대표 경기 (체코전)
export const FEATURED_MATCH_ID = "A_KOR_CZE_20260612";
export function getMatch(id: string): Match {
@@ -108,3 +108,28 @@ export function getMatch(id: string): Match {
}
export const FEATURED = getMatch(FEATURED_MATCH_ID);
// 투표창 단계(D7): 오픈 전 / 투표중 / 마감(킥오프) / 종료(결과). DEMO_FORCE_OPEN는 UI 측에서 별도 처리.
export type MatchPhase = "scheduled" | "open" | "locked" | "finished";
export function matchPhase(m: Match, now: number = Date.now()): MatchPhase {
if (m.result) return "finished";
if (now >= new Date(m.lockAt).getTime()) return "locked";
if (now < new Date(m.opensAt).getTime()) return "scheduled";
return "open";
}
// 대시보드: 날짜별로 묶고 킥오프 오름차순 정렬
export function matchesByDate(): { date: string; matches: Match[] }[] {
const sorted = [...GROUP_A].sort(
(a, b) => new Date(a.kickoffKst).getTime() - new Date(b.kickoffKst).getTime(),
);
const groups: { date: string; matches: Match[] }[] = [];
for (const m of sorted) {
const key = m.kickoffKst.slice(0, 10);
const last = groups[groups.length - 1];
if (last && last.date === key) last.matches.push(m);
else groups.push({ date: key, matches: [m] });
}
return groups;
}