Refactor: Next.js+Firebase → React(Vite) + FastAPI + PostgreSQL

- 백엔드: FastAPI + SQLAlchemy(async) + PostgreSQL, 별도 워커(APScheduler)
- 프론트: React 19 + Vite + TS + Tailwind v4 (기존 UI 이식, API 연동)
- docker-compose: db · api · worker · frontend 일괄 실행
- 경기 일정: openfootball 매일 09:00 크롤링 → DB upsert (신규 경기 자동 삽입+예측 생성)
- AI 예측: GPT·Claude·Gemini 실 API 매일 생성 → DB 저장 → 조회 (목데이터 제거)
- 투표창: 오픈 킥오프 D-2 / 마감 킥오프 1시간 전, lockAt 백엔드 전달→프론트 카운트다운
- 채점/리더보드: docs/SCORING.md 기준 누적 포인트
- crowd: 0 시작, 실제 제출로만 증분
- 구 Next.js/Firebase 파일 제거, README/AGENTS 갱신

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
HyeongBaeYangandClaude Opus 4.8 committed 2026-06-10 13:04:35 +09:00
1 parent 35414a8d47
commit 6ffe0dfca3
95 files changed
+5266 -8856

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
# 프론트엔드 환경변수 (Vite) — 복사: cp .env.example .env
# 운영(docker)에서는 nginx 가 /api 를 프록시하므로 비워두면 동일 출처(/api)를 사용.
# 백엔드 API 베이스 (기본: /api). 절대 URL 로 직접 호출하려면 지정.
# VITE_API_BASE=/api
# 로컬 vite dev 서버의 프록시 타깃 (기본: http://localhost:8000)
# VITE_API_TARGET=http://localhost:8000
+13
View File
@@ -0,0 +1,13 @@
# TriplePick 프론트엔드 — Vite 빌드 → nginx 정적 서빙 + /api 프록시.
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
+18
View File
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/icons/profile.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#14171C" />
<title>TriplePick 2026 | AI 2026 월드컵 승부예측 — GPT vs Claude vs Gemini</title>
<meta
name="description"
content="GPT·Claude·Gemini가 매 경기를 서로 다르게 예측합니다. 당신의 픽을 찍고 AI와 겨뤄보세요. 끝까지 잘 맞히면 100만 원 챌린지."
/>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+20
View File
@@ -0,0 +1,20 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# API 는 백엔드(api 서비스)로 프록시 → 브라우저는 동일 출처로 호출(CORS 불필요).
location /api/ {
proxy_pass http://api:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# SPA 폴백 — 클라이언트 라우팅(/match/:id 등)
location / {
try_files $uri $uri/ /index.html;
}
}
+2485
View File
File diff suppressed because it is too large. Load diff
+25
View File
@@ -0,0 +1,25 @@
{
"name": "triplepick-frontend",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router-dom": "^7.1.1"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2",
"@vitejs/plugin-react": "^4.3.4",
"tailwindcss": "^4.0.0",
"typescript": "^5.7.2",
"vite": "^6.0.5"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

+16
View File
@@ -0,0 +1,16 @@
import { Routes, Route } from "react-router-dom";
import Dashboard from "./pages/Dashboard";
import MatchDetail from "./pages/MatchDetail";
import Leaderboard from "./pages/Leaderboard";
import NotFound from "./pages/NotFound";
export default function App() {
return (
<Routes>
<Route path="/" element={<Dashboard />} />
<Route path="/match/:matchId" element={<MatchDetail />} />
<Route path="/leaderboard" element={<Leaderboard />} />
<Route path="*" element={<NotFound />} />
</Routes>
);
}
+37
View File
@@ -0,0 +1,37 @@
import { type Lang, dict } from "@/lib/i18n";
// 운영사(ADO2) 광고 — 메인 랜딩 하단. 솔리드 퍼플(#A65EFF) 라운드 풀(pill) + 화이트 로고.
export default function Ado2Ad({ lang = "ko" }: { lang?: Lang }) {
const t = dict(lang);
return (
<section className="mt-8">
<div className="mb-2 text-center text-[10px] font-bold uppercase tracking-[0.2em] text-white/35">
{t.adLabel}
</div>
<a
href="https://ado2.o2osolution.ai/"
target="_blank"
rel="noopener noreferrer"
className="flex items-center justify-between gap-3 rounded-full bg-[#A65EFF] px-6 py-3 transition active:scale-[0.99]"
style={{ boxShadow: "0 10px 28px rgba(166,94,255,0.40)" }}
>
{/* 태그라인이 가로 폭을 정하고, 로고는 그 폭에 맞춰 스케일(언어 무관 자동 일치) */}
<span className="flex flex-col items-stretch gap-1">
<img
src="/icons/ado2-white.png"
alt="ADO2"
className="h-auto"
style={{ width: 0, minWidth: "100%" }}
/>
<span className="whitespace-nowrap text-[13px] font-bold leading-none text-white">
{t.ado2Tagline}
</span>
</span>
<span className="flex shrink-0 items-center gap-1 whitespace-nowrap text-[13px] font-extrabold text-white">
{t.ado2Cta}
<span aria-hidden>→</span>
</span>
</a>
</section>
);
}
+453
View File
@@ -0,0 +1,453 @@
import { useEffect, useMemo, useState } from "react";
import { outcomeLabel, pct, kickoffDisplay, winProb } from "@/lib/format";
import { type Lang, dict, teamShort } from "@/lib/i18n";
import type {
Outcome,
CrowdStats,
ModelName,
Match,
AIPrediction,
Team,
} from "@/lib/types";
import { ApiError, getDeviceId, submitPrediction } from "@/lib/api";
import Countdown from "./Countdown";
import TeamFlag from "./TeamFlag";
type Step = "pick" | "form" | "done";
const MODEL_ICON: Record<ModelName, string> = {
GPT: "/icons/gpt.png",
Claude: "/icons/claude.jpg",
Gemini: "/icons/gemini.jpeg",
};
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
export default function Arena({
match,
predictions,
crowd: initialCrowd,
shareUrl,
lang = "ko",
}: {
match: Match;
predictions: AIPrediction[];
crowd: CrowdStats;
shareUrl: string;
lang?: Lang;
}) {
const t = dict(lang);
const aShort = teamShort(match.teamA, lang);
const bShort = teamShort(match.teamB, lang);
const [outcome, setOutcome] = useState<Outcome | null>(null);
const [scoreA, setScoreA] = useState(2);
const [scoreB, setScoreB] = useState(1);
const [step, setStep] = useState<Step>("pick");
const [email, setEmail] = useState("");
const [notify, setNotify] = useState(true);
const [crowd, setCrowd] = useState<CrowdStats>(initialCrowd);
const [copied, setCopied] = useState(false);
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
// 점수 선택 시 승/무/패 자동 선택 (스코어가 결과의 소스)
useEffect(() => {
setOutcome(
scoreA > scoreB ? "TEAM_A_WIN" : scoreA < scoreB ? "TEAM_B_WIN" : "DRAW",
);
}, [scoreA, scoreB]);
// 투표 가능 여부는 백엔드 계산(votingOpen, demo 반영) + phase 라벨.
const finished = !!match.result;
const disabled = finished || !match.votingOpen;
const ctaLabel = finished
? t.ctaResult
: match.phase === "scheduled" && !match.votingOpen
? t.ctaOpens(kickoffDisplay(match.opensAt, lang))
: match.phase === "locked"
? t.ctaLocked
: t.ctaBeat;
const matched = useMemo(() => {
if (!outcome) return [];
return predictions
.filter((p) => p.outcome === outcome)
.map((p) => ({ model: p.model, exact: p.scoreA === scoreA && p.scoreB === scoreB }));
}, [outcome, scoreA, scoreB, predictions]);
const submitPick = () => {
if (!outcome) return;
setStep("form");
};
const confirmSubmit = async () => {
if (!EMAIL_RE.test(email.trim()) || !outcome) return;
setSubmitting(true);
setError(null);
try {
const res = await submitPrediction({
matchId: match.matchId,
deviceId: getDeviceId(),
outcome,
scoreA,
scoreB,
email: email.trim(),
notify,
});
setCrowd(res.crowd); // 서버 권위 분포로 갱신
setStep("done");
} catch (e) {
const msg =
e instanceof ApiError
? e.status === 423
? t.ctaLocked
: e.detail
: lang === "en"
? "Submission failed. Please try again."
: "제출에 실패했습니다. 다시 시도해주세요.";
setError(msg);
} finally {
setSubmitting(false);
}
};
const shareText = useMemo(() => {
if (!outcome) return "";
const me = `${aShort} ${scoreA}-${scoreB} ${bShort}`;
const sameAI = matched.map((m) => m.model).join("·");
if (lang === "en") {
return sameAI
? `I picked ${me}, same as ${sameAI}! You? — TriplePick`
: `I picked ${me} — different from all 3 AIs! You? — TriplePick`;
}
return sameAI
? `나는 ${me}. ${sameAI}와 같은 선택! 너는? — TriplePick`
: `나는 ${me}. AI 셋과 다 다른 선택! 너는? — TriplePick`;
}, [outcome, scoreA, scoreB, matched, aShort, bShort, lang]);
const copyLink = async () => {
try {
await navigator.clipboard.writeText(`${shareText}\n${shareUrl}`);
setCopied(true);
setTimeout(() => setCopied(false), 1800);
} catch {
setCopied(false);
}
};
const nativeShare = async () => {
if (navigator.share) {
try {
await navigator.share({
title: `${aShort} vs ${bShort} — TriplePick`,
text: shareText,
url: shareUrl,
});
} catch {
/* cancelled */
}
} else copyLink();
};
return (
<>
{/* ===== 카운트다운 (D7) — 투표 진행 중일 때만 ===== */}
{!finished && match.votingOpen && (
<div className="mt-4">
<Countdown to={match.lockAt} lang={lang} />
</div>
)}
{/* ===== 레이어드 화이트 시트 (002) ===== */}
<section className="sheet mt-4 p-5 text-[var(--ink)]">
<div className="mb-3">
<h2 className="text-[22px] font-extrabold">{t.aiBattle}</h2>
</div>
<div className="flex flex-col gap-3">
{predictions.map((p) => {
const wp = winProb(match, p);
const wpLabel = wp.team
? t.winProb(teamShort(wp.team, lang))
: t.drawOdds;
return (
<div
key={p.model}
className="rounded-2xl border border-[var(--line-l)] bg-[var(--sheet-card)] p-4"
>
<div className="flex items-center gap-3">
<img
src={MODEL_ICON[p.model]}
alt={p.model}
className="h-12 w-12 shrink-0 rounded-full object-cover"
/>
<div className="min-w-0">
<div className="text-[20px] font-extrabold leading-none">
{p.model}
</div>
{/* D3: 승리 예측 팀의 승리 확률 + 승리팀 국기 */}
<div className="mt-1.5 flex items-center gap-1.5">
{wp.team && (
<TeamFlag team={wp.team} className="h-3.5 w-5 shrink-0" />
)}
<span className="text-[12px] font-bold text-[var(--ink-muted)]">
{wpLabel} <span className="text-[var(--gpt)]">{wp.pct}%</span>
</span>
</div>
</div>
<div className="ml-auto shrink-0 whitespace-nowrap font-mono text-[28px] font-extrabold tabular-nums">
{p.scoreA}&nbsp;-&nbsp;{p.scoreB}
</div>
</div>
{/* 메인 리즌 강조 (D3: 확률은 텍스트, 바 제거) */}
<p className="mt-3 text-[15px] font-bold leading-snug text-[var(--ink)]">
“{p.reasonShort}”
</p>
</div>
);
})}
</div>
{/* 당신의 선택 */}
<div className="mt-5 flex items-center justify-between">
<span className="text-[13px] font-bold text-[var(--ink-muted)]">
{t.yourPickLabel}
</span>
<span className="text-[20px] font-extrabold">{t.yourChoice}</span>
</div>
<div className="mt-3 grid grid-cols-3 gap-2">
{(
[
["TEAM_A_WIN", `${aShort} ${t.win}`],
["DRAW", t.drawLabel],
["TEAM_B_WIN", `${bShort} ${t.win}`],
] as [Outcome, string][]
).map(([val, label]) => (
<button
key={val}
disabled={disabled}
onClick={() => setOutcome(val)}
className={`rounded-xl border py-3.5 text-[16px] font-extrabold transition disabled:opacity-50 ${
outcome === val
? "border-transparent bg-[var(--mint)] text-[var(--mint-ink)]"
: "border-[var(--line-l)] bg-white text-[var(--ink-muted)]"
}`}
>
{label}
</button>
))}
</div>
<div className="mt-3 flex items-center justify-center gap-5 rounded-xl border border-[var(--line-l)] bg-white py-3">
<Stepper label={aShort} value={scoreA} onChange={setScoreA} disabled={disabled} />
<span className="text-[26px] font-extrabold text-[var(--ink-muted)]">:</span>
<Stepper label={bShort} value={scoreB} onChange={setScoreB} disabled={disabled} />
</div>
</section>
{/* ===== 종료된 경기: 결과 보기 ===== */}
{finished && match.result && (
<section className="mt-5 rounded-2xl border border-[var(--green)]/50 bg-[var(--bg2)] p-5">
<div className="text-[13px] text-[var(--ink-muted)]">{t.finalResult}</div>
<div className="mt-1 text-[26px] font-extrabold">
{aShort} {match.result.scoreA}-{match.result.scoreB} {bShort}
<span className="ml-2 text-[16px] font-bold text-[var(--green)]">
{outcomeLabel(match, match.result.outcome, lang)}
</span>
</div>
<div className="mt-3 flex flex-col gap-1.5">
{predictions.map((p) => {
const hit = p.outcome === match.result!.outcome;
return (
<div key={p.model} className="flex items-center justify-between text-[13px]">
<span className="font-bold text-white/85">{p.model}</span>
<span className={hit ? "font-bold text-[var(--green)]" : "text-white/45"}>
{hit ? t.hit : t.miss}
</span>
</div>
);
})}
</div>
</section>
)}
{/* ===== CTA 민트 #85FCA8 (진행 중일 때) ===== */}
{!finished && step === "pick" && (
<button
onClick={submitPick}
disabled={!outcome || disabled}
className="btn-mint mt-5 w-full rounded-2xl py-5 text-[20px] font-extrabold transition active:scale-[0.99] disabled:opacity-40 disabled:shadow-none"
>
{ctaLabel}
</button>
)}
{/* ===== 폼: 이메일만 (D5, 닉네임 제거) ===== */}
{!finished && step === "form" && (
<div className="mt-5 space-y-2.5 rounded-2xl border border-[var(--line-d)] bg-[var(--bg2)] p-4">
<input
type="email"
inputMode="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder={t.emailPh}
className="w-full rounded-lg border border-[var(--line-d)] bg-[#0f1217] px-3 py-3 text-[15px] text-white outline-none focus:border-[var(--green)]"
/>
<label className="flex items-start gap-2 text-[13px] text-[var(--ink-muted)]">
<input
type="checkbox"
checked={notify}
onChange={(e) => setNotify(e.target.checked)}
className="mt-0.5 accent-[var(--mint)]"
/>
{t.notify}
</label>
{error && (
<p className="text-[13px] font-bold text-[#ff6b6b]">{error}</p>
)}
<button
onClick={confirmSubmit}
disabled={!EMAIL_RE.test(email.trim()) || submitting}
className="btn-mint w-full rounded-xl py-3.5 text-[17px] font-extrabold transition active:scale-[0.99] disabled:opacity-40 disabled:shadow-none"
>
{submitting ? "…" : t.submit}
</button>
</div>
)}
{/* ===== 제출 완료: 같은 AI + 경기별 공유 (D8) ===== */}
{!finished && step === "done" && outcome && (
<div className="mt-5 rounded-2xl border border-[var(--green)]/50 bg-[var(--bg2)] p-5">
<div className="text-[13px] text-[var(--ink-muted)]">{t.myPick}</div>
<div className="mt-1 text-[26px] font-extrabold">
{aShort} {scoreA}-{scoreB} {bShort}
<span className="ml-2 text-[16px] font-bold text-[var(--green)]">
{outcomeLabel(match, outcome, lang)}
</span>
</div>
<p className="mt-2 text-[14px] leading-relaxed text-white/80">
{matched.length > 0
? t.sameAI(
matched.map((m) => m.model).join("·"),
matched.some((m) => m.exact),
)
: t.soloPick}
</p>
<div className="mt-4 grid grid-cols-2 gap-2.5">
<button onClick={nativeShare} className="btn-mint rounded-xl py-3 text-[15px] font-bold active:scale-[0.99]">
{t.shareThis}
</button>
<button onClick={copyLink} className="rounded-xl border border-[var(--line-d)] py-3 text-[15px] font-bold active:scale-[0.99]">
{copied ? t.copied : t.copyLink}
</button>
</div>
</div>
)}
{/* ===== 골드 상금 (003) ===== */}
<section className="gold-card mt-5 rounded-2xl p-5">
<div className="flex items-center justify-between gap-3">
<div className="min-w-0">
<div className="flex items-center gap-1.5 text-[18px] font-extrabold text-[var(--gold-border)]">
<span>₩1,000,000 Final Challenge</span>
<span>★</span>
</div>
<p className="mt-1.5 text-[13px] leading-snug text-white/75">
{t.goldDesc}
</p>
</div>
<button className="gold-btn shrink-0 whitespace-pre-line rounded-xl px-4 py-3.5 text-[14px] font-extrabold leading-tight active:scale-[0.98]">
{t.goldBtn}
</button>
</div>
</section>
{/* ===== Crowd Pick (003) — 보팅 비율(≠ AI 승리 확률) ===== */}
<section className="mt-6">
<div className="mb-2.5 text-[20px] font-extrabold">
Crowd Pick{" "}
<span className="text-[14px] text-[var(--ink-muted)]">{t.crowdSub}</span>
</div>
<div className="flex h-14 overflow-hidden rounded-2xl border border-[var(--line-d)]">
<CrowdSeg team={match.teamA} value={pct(crowd.teamAWin, crowd.total)} tone="a" />
<CrowdSeg value={pct(crowd.draw, crowd.total)} tone="draw" />
<CrowdSeg team={match.teamB} value={pct(crowd.teamBWin, crowd.total)} tone="b" />
</div>
<div className="mt-1.5 text-right text-[11px] text-[var(--ink-muted)]">
{t.joined(crowd.total.toLocaleString())}
</div>
</section>
</>
);
}
function Stepper({
label,
value,
onChange,
disabled,
}: {
label: string;
value: number;
onChange: (n: number) => void;
disabled?: boolean;
}) {
return (
<div className="flex items-center gap-3">
<StepBtn disabled={disabled || value <= 0} onClick={() => onChange(Math.max(0, value - 1))}>
−
</StepBtn>
<div className="flex w-12 flex-col items-center">
<span className="font-mono text-[32px] font-extrabold leading-none tabular-nums">
{value}
</span>
<span className="mt-1 text-[11px] text-[var(--ink-muted)]">{label}</span>
</div>
<StepBtn disabled={disabled || value >= 9} onClick={() => onChange(Math.min(9, value + 1))}>
+
</StepBtn>
</div>
);
}
function StepBtn({
children,
onClick,
disabled,
}: {
children: React.ReactNode;
onClick: () => void;
disabled?: boolean;
}) {
return (
<button
onClick={onClick}
disabled={disabled}
className="grid h-11 w-11 place-items-center rounded-xl border border-[var(--line-l)] bg-white text-[22px] font-bold leading-none text-[var(--ink)] active:scale-95 disabled:opacity-30"
>
{children}
</button>
);
}
function CrowdSeg({
team,
value,
tone,
}: {
team?: Team;
value: number;
tone: "a" | "draw" | "b";
}) {
const bg = tone === "draw" ? "#2b313c" : tone === "a" ? "rgba(74,255,160,0.22)" : "#222831";
return (
<div
className="flex items-center justify-center gap-1.5 border-r border-[var(--line-d)] text-[16px] font-extrabold last:border-r-0"
style={{ width: `${value}%`, background: bg, minWidth: 56 }}
>
{team && <TeamFlag team={team} className="h-4 w-6" />}
<span>{value}%</span>
</div>
);
}
+11
View File
@@ -0,0 +1,11 @@
// 매치카드 아이콘 = TriplePick 프로필 로고 (그린 글로우)
export default function BallIcon({ className = "" }: { className?: string }) {
return (
<img
src="/icons/profile.png?v=3"
alt="TriplePick"
className={`rounded-full ${className}`}
style={{ filter: "drop-shadow(0 0 7px rgba(74,255,160,0.55))" }}
/>
);
}
+47
View File
@@ -0,0 +1,47 @@
import { useEffect, useState } from "react";
import { type Lang, dict } from "@/lib/i18n";
// "투표 종료까지" 카운트다운 (D7). 마감 = 킥오프 정각(lockAt).
export default function Countdown({ to, lang = "ko" }: { to: string; lang?: Lang }) {
const t = dict(lang);
const label = t.cdUntil;
const [left, setLeft] = useState<number | null>(null);
useEffect(() => {
const target = new Date(to).getTime();
const tick = () => setLeft(Math.max(0, target - Date.now()));
tick();
const id = setInterval(tick, 1000);
return () => clearInterval(id);
}, [to]);
const ended = left !== null && left <= 0;
return (
<div className="flex items-center justify-center gap-2 rounded-xl border border-[var(--line-d)] bg-[var(--bg2)] px-3 py-2.5">
<span className="text-[12px] font-semibold text-[var(--ink-muted)]">
{ended ? t.cdClosed : label}
</span>
{!ended && (
<span
className="font-mono text-[18px] font-extrabold tabular-nums text-[var(--green)]"
style={{ textShadow: "0 0 12px rgba(74,255,160,0.45)" }}
>
{left === null ? "--:--:--" : fmt(left, lang)}
</span>
)}
</div>
);
}
function fmt(ms: number, lang: Lang): string {
const s = Math.floor(ms / 1000);
const d = Math.floor(s / 86400);
const h = Math.floor((s % 86400) / 3600);
const m = Math.floor((s % 3600) / 60);
const sec = s % 60;
const pad = (n: number) => String(n).padStart(2, "0");
const dayUnit = lang === "en" ? "d" : "일";
if (d > 0) return `${d}${dayUnit} ${pad(h)}:${pad(m)}:${pad(sec)}`;
return `${pad(h)}:${pad(m)}:${pad(sec)}`;
}
+24
View File
@@ -0,0 +1,24 @@
import { type Lang, dict } from "@/lib/i18n";
export default function Footer({ lang = "ko" }: { lang?: Lang }) {
const t = dict(lang);
return (
<footer className="mt-6 text-center">
<p className="text-[10.5px] font-semibold text-white/75">
{t.footerNotOfficial}
</p>
<p className="mt-1 text-[10.5px] leading-relaxed text-white/60">
{t.footerDisc1}
</p>
<div className="mx-auto mt-3 max-w-[400px] space-y-1 text-[9.5px] leading-relaxed text-white/55">
<p>{t.footerDisc2}</p>
<p>{t.footerDisc3}</p>
</div>
<div className="mt-3 text-[10px] text-white/70">
© 2026 TriplePick · 운영 AIO2O · @triplepick_ai
</div>
</footer>
);
}
+51
View File
@@ -0,0 +1,51 @@
import { Link } from "react-router-dom";
import ShareButton from "./ShareButton";
import LangSwitch from "./LangSwitch";
import { type Lang, dict } from "@/lib/i18n";
type Share = { url: string; title: string; text: string };
// 브랜드 헤더 (대시보드·상세 공용). 경기별 후킹 카피는 상세 페이지에서 별도 노출.
export default function Hero({
back = false,
share,
lang = "ko",
}: {
back?: boolean;
share?: Share;
lang?: Lang;
}) {
const t = dict(lang);
const home = lang === "en" ? "/?lang=en" : "/";
return (
<header className="pt-5 text-center">
{back && (
<div className="mb-3 flex items-center justify-between">
<Link
to={home}
className="flex items-center gap-1 rounded-full border border-white/12 bg-white/8 px-3 py-1.5 text-[12px] font-bold text-white/85 active:scale-95"
>
{t.back}
</Link>
{share && (
<ShareButton {...share} label={t.share} copiedLabel={t.shareCopied} />
)}
</div>
)}
<div className="font-impact text-[44px] leading-none tracking-tight">
TRIPLE PICK <span className="text-[var(--green)]">2026</span>
</div>
<div className="relative mt-2">
<div className="text-[16px] font-extrabold text-[var(--green)]">
AI Prediction Arena
</div>
<div className="absolute right-0 top-1/2 -translate-y-1/2">
<LangSwitch lang={lang} />
</div>
</div>
<div className="mt-2 inline-block rounded-full border border-white/12 bg-white/8 px-3 py-1 text-[13px] font-semibold text-white/85">
{t.heroPill}
</div>
</header>
);
}
+24
View File
@@ -0,0 +1,24 @@
import { Link, useLocation } from "react-router-dom";
import type { Lang } from "@/lib/i18n";
// KO / EN 토글. 현재 경로 유지 + ?lang 토글.
export default function LangSwitch({ lang }: { lang: Lang }) {
const { pathname } = useLocation();
const href = (l: Lang) => (l === "en" ? `${pathname}?lang=en` : pathname);
const langs: Lang[] = ["ko", "en"];
return (
<div className="flex items-center overflow-hidden rounded-full border border-white/15 text-[11px] font-extrabold">
{langs.map((l) => (
<Link
key={l}
to={href(l)}
className={`px-2.5 py-1 transition ${
lang === l ? "bg-white text-[#14171C]" : "text-white/65"
}`}
>
{l.toUpperCase()}
</Link>
))}
</div>
);
}
+64
View File
@@ -0,0 +1,64 @@
import type { Match } from "@/lib/types";
import { kickoffDisplay } from "@/lib/format";
import { type Lang, dict } from "@/lib/i18n";
import BallIcon from "./BallIcon";
import TeamFlag from "./TeamFlag";
export default function MatchupHUD({ match, lang = "ko" }: { match: Match; lang?: Lang }) {
const t = dict(lang);
const { group } = match;
const finished = !!match.result;
return (
<section className="mt-6">
{/* 대결 카드 (녹색 글로우 보더) */}
<div
className="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)" }}
>
{/* 헤더: 브랜드 아이콘 + 팀명 + 일시 */}
<div className="flex items-center gap-3">
<BallIcon className="h-14 w-14 shrink-0" />
<div className="min-w-0">
<div className="text-[22px] font-extrabold leading-tight">
{match.teamA.name} <span className="text-white/55">vs</span>{" "}
{match.teamB.name}
</div>
<div className="mt-1 text-[15px] font-bold text-[var(--green)]">
{kickoffDisplay(match.kickoffKst, lang)} · {t.group(group)}
</div>
<div className="mt-0.5 text-[12px] text-white/65">{match.venue}</div>
</div>
</div>
{/* 국기 + 라이트닝 VS (종료 시 최종 스코어) */}
<div className="mt-5 grid grid-cols-[1fr_auto_1fr] items-center gap-3">
<TeamFlag team={match.teamA} className="mx-auto h-[68px] w-[104px]" />
<div className="relative grid place-items-center">
<div className="vs-glow absolute h-28 w-28" />
{finished && match.result ? (
<span className="relative whitespace-nowrap font-mono text-[34px] font-extrabold tabular-nums text-white">
{match.result.scoreA}
<span className="px-1 text-white/55">-</span>
{match.result.scoreB}
</span>
) : (
<span
className="relative font-impact text-[46px] italic leading-none text-[var(--green)]"
style={{ textShadow: "0 0 18px rgba(74,255,160,0.8)" }}
>
VS
</span>
)}
</div>
<TeamFlag team={match.teamB} className="mx-auto h-[68px] w-[104px]" />
</div>
{finished && (
<div className="mt-3 text-center text-[12px] font-bold text-[var(--green)]">
{t.matchEnded}
</div>
)}
</div>
</section>
);
}
+123
View File
@@ -0,0 +1,123 @@
import { Link } from "react-router-dom";
import { dateHeading, timeOnly } from "@/lib/format";
import { type Lang, dict, teamShort, roundLabel as tRound } from "@/lib/i18n";
import type { Match, MatchPhase } from "@/lib/types";
import { dateKey } from "@/lib/format";
import TeamFlag from "./TeamFlag";
const STROKE = "#94FBE0"; // 일정 텍스트·선택 아웃라인 스트로크 컬러
const PHASE_CLS: Record<MatchPhase, string> = {
open: "border-[#94FBE0] text-[#94FBE0]",
scheduled: "border-[var(--line-d)] text-[var(--ink-muted)]",
locked: "border-[var(--line-d)] text-[var(--ink-muted)]",
finished: "border-white/15 text-white/55",
};
// 날짜별로 묶고 킥오프 오름차순 정렬 (백엔드가 이미 정렬 반환)
function groupByDate(matches: Match[]): { date: string; matches: Match[] }[] {
const groups: { date: string; matches: Match[] }[] = [];
for (const m of matches) {
const key = dateKey(m.kickoffKst);
const last = groups[groups.length - 1];
if (last && last.date === key) last.matches.push(m);
else groups.push({ date: key, matches: [m] });
}
return groups;
}
export default function ScheduleBoard({
matches,
lang = "ko",
}: {
matches: Match[];
lang?: Lang;
}) {
const t = dict(lang);
const groups = groupByDate(matches);
return (
<section className="mt-6">
<div className="mb-3 flex items-baseline gap-2.5">
<h2 className="shrink-0 text-[22px] font-extrabold">{t.schedTitle}</h2>
<span className="whitespace-nowrap text-[12px] text-white/55">
{t.schedGuide}
</span>
</div>
<div className="flex flex-col gap-5">
{groups.map((g) => (
<div key={g.date}>
<div className="mb-2 text-[13px] font-bold" style={{ color: STROKE }}>
{dateHeading(g.date, lang)}
</div>
<div className="flex flex-col gap-2.5">
{g.matches.map((m) => (
<MatchCard key={m.matchId} match={m} lang={lang} />
))}
</div>
</div>
))}
</div>
</section>
);
}
function MatchCard({ match, lang }: { match: Match; lang: Lang }) {
const t = dict(lang);
const phase = match.phase;
const preds = match.predictions;
const crowdTotal = match.crowd?.total ?? 0;
// AI 픽 갈림 요약
const tally = { a: 0, d: 0, b: 0 };
for (const p of preds) {
if (p.outcome === "TEAM_A_WIN") tally.a++;
else if (p.outcome === "DRAW") tally.d++;
else tally.b++;
}
const split: string[] = [];
if (tally.a) split.push(`${teamShort(match.teamA, lang)} ${tally.a}`);
if (tally.d) split.push(`${t.draw} ${tally.d}`);
if (tally.b) split.push(`${teamShort(match.teamB, lang)} ${tally.b}`);
const href = `/match/${match.matchId}${lang === "en" ? "?lang=en" : ""}`;
return (
<Link
to={href}
className="block rounded-2xl border-2 border-[#94FBE0]/45 bg-[#171b21] p-4 transition active:scale-[0.99] hover:border-[#94FBE0]"
>
<div className="flex items-center justify-between text-[11px]">
<span className="font-mono font-bold text-white/70">
{timeOnly(match.kickoffKst)} <span className="text-white/40">KST</span> ·{" "}
{tRound(match.roundLabel, lang)}
</span>
<span className={`rounded-md border px-2 py-0.5 font-semibold ${PHASE_CLS[phase]}`}>
{t.phase[phase]}
</span>
</div>
<div className="mt-3 grid grid-cols-[1fr_auto_1fr] items-center gap-2">
<div className="flex items-center gap-2">
<TeamFlag team={match.teamA} className="h-6 w-9 shrink-0" />
<span className="truncate text-[15px] font-extrabold">{teamShort(match.teamA, lang)}</span>
</div>
<span className="font-impact text-[18px] italic text-[#94FBE0]">VS</span>
<div className="flex items-center justify-end gap-2">
<span className="truncate text-right text-[15px] font-extrabold">{teamShort(match.teamB, lang)}</span>
<TeamFlag team={match.teamB} className="h-6 w-9 shrink-0" />
</div>
</div>
<div className="mt-3 flex items-center justify-between text-[11px] font-bold text-[#F4F3FE]">
<span>
<span className="font-semibold text-white/55">{t.aiPicks}</span> {split.join(" · ")}
</span>
<span className="flex items-center gap-2">
<span>{t.joined(crowdTotal.toLocaleString())}</span>
<span className="text-[#94FBE0]">→</span>
</span>
</div>
</Link>
);
}
+45
View File
@@ -0,0 +1,45 @@
import { useState } from "react";
// 투표(경기) 공유 — 모바일 네이티브 공유, 미지원 시 클립보드 복사 폴백 (D8)
export default function ShareButton({
url,
title,
text,
label = "투표 공유하기",
copiedLabel = "링크 복사됨 ✓",
}: {
url: string;
title: string;
text: string;
label?: string;
copiedLabel?: string;
}) {
const [copied, setCopied] = useState(false);
const onShare = async () => {
if (typeof navigator !== "undefined" && navigator.share) {
try {
await navigator.share({ title, text, url });
return;
} catch {
/* 사용자 취소 */
}
}
try {
await navigator.clipboard.writeText(`${text}\n${url}`);
setCopied(true);
setTimeout(() => setCopied(false), 1800);
} catch {
/* noop */
}
};
return (
<button
onClick={onShare}
className="flex items-center rounded-full border border-[var(--share)]/55 bg-[var(--share)]/12 px-3 py-1.5 text-[12px] font-bold text-[var(--share)] transition active:scale-95"
>
{copied ? copiedLabel : label}
</button>
);
}
+47
View File
@@ -0,0 +1,47 @@
import type { Team } from "@/lib/types";
// 모든 경기에 일반화된 국기 렌더.
// KOR = 실제 png 자산, CZE = 인라인 SVG(비율 보존), 그 외 = 이모지(컨테이너 높이에 비례, 안 잘림).
export default function TeamFlag({
team,
className = "",
}: {
team: Team;
className?: string;
}) {
if (team.code === "KOR") {
return (
<img
src="/icons/kor.png"
alt={team.name}
className={`flag-img object-cover ${className}`}
/>
);
}
if (team.code === "CZE") {
return (
<svg
viewBox="0 0 6 4"
className={`border border-[var(--line-d)] ${className}`}
preserveAspectRatio="xMidYMid meet"
aria-label={team.name}
>
<rect width="6" height="2" y="0" fill="#ffffff" />
<rect width="6" height="2" y="2" fill="#d7141a" />
<polygon points="0,0 3,2 0,4" fill="#11457e" />
</svg>
);
}
// 그 외 국가 — 이모지 국기. 컨테이너 높이(cqh) 기준으로 크기를 잡아 잘림/찌그러짐 방지.
return (
<span
className={`grid place-items-center overflow-hidden border border-[var(--line-d)] bg-white/[0.06] ${className}`}
style={{ containerType: "size" }}
aria-label={team.name}
>
<span className="leading-none" style={{ fontSize: "92cqh" }}>
{team.flag}
</span>
</span>
);
}
+153
View File
@@ -0,0 +1,153 @@
@import "tailwindcss";
:root {
--bg: #14171c; /* 차콜 다크 */
--bg2: #1b1f26;
--mint: #85fca8; /* CTA 버튼 */
--mint-ink: #0a2417; /* 민트 버튼 위 텍스트 */
--green: #4affa0; /* 글로우/액센트 (포인트 컬러) */
--sheet: #f2f3ef; /* 레이어드 화이트 시트 */
--sheet-card: #ffffff;
--ink: #14171c; /* 화이트 위 텍스트 */
--ink-muted: #79808c;
--line-d: #2b313c; /* 다크 보더 */
--line-l: #e3e5df; /* 라이트 보더 */
/* 상금 카드 — 골드 대신 민트/틸그린 쿨 톤 */
--gold-border: #5ef0b4; /* 민트 액센트 */
--gold-bg: #0e1f1b; /* 딥 틸그린 */
--gold-btn-1: #85fca8; /* 민트 */
--gold-btn-2: #15a99b; /* 틸그린 */
--gpt: #15a99b; /* 틸그린 (teal green) */
--claude: #e8814a;
--gemini: #5b8cff;
--share: #a65eff; /* 공유/바이럴 액션 (ADO2 브랜드 포인트 퍼플) */
}
* {
box-sizing: border-box;
}
html,
body {
background:
radial-gradient(120% 50% at 50% -5%, #20302a 0%, var(--bg) 48%) no-repeat,
var(--bg);
color: #fff;
-webkit-font-smoothing: antialiased;
}
body {
font-family:
"Pretendard", -apple-system, BlinkMacSystemFont, system-ui,
"Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
margin: 0;
}
.shell {
max-width: 460px;
margin: 0 auto;
padding: 0 16px 56px;
}
/* Triple Pick 2026 타이틀용 Impact */
.font-impact {
font-family: Impact, Haettenschweiler, "Arial Narrow Bold", system-ui,
sans-serif;
letter-spacing: 0.5px;
}
.flag-img {
object-fit: cover;
border: 1px solid var(--line-d);
}
/* 레이어드 화이트 시트 */
.sheet {
background: var(--sheet);
border-radius: 22px;
box-shadow:
0 -2px 0 rgba(255, 255, 255, 0.04),
0 24px 60px rgba(0, 0, 0, 0.5);
}
/* 코너 브래킷 (HUD) */
.bracket {
position: relative;
}
.bracket > .bk {
content: "";
position: absolute;
width: 18px;
height: 18px;
border: 2px solid var(--green);
}
.bracket > .bk-tl {
top: 0;
left: 0;
border-right: 0;
border-bottom: 0;
border-top-left-radius: 6px;
}
.bracket > .bk-tr {
top: 0;
right: 0;
border-left: 0;
border-bottom: 0;
border-top-right-radius: 6px;
}
.bracket > .bk-br {
bottom: 0;
right: 0;
border-left: 0;
border-top: 0;
border-bottom-right-radius: 6px;
}
.bracket > .bk-bl {
bottom: 0;
left: 0;
border-right: 0;
border-top: 0;
border-bottom-left-radius: 6px;
}
.vs-glow {
background: radial-gradient(
closest-side,
rgba(74, 255, 160, 0.5),
rgba(74, 255, 160, 0) 70%
);
}
.btn-mint {
background: var(--mint);
color: var(--mint-ink);
box-shadow:
0 0 0 1px rgba(133, 252, 168, 0.55),
0 10px 28px rgba(133, 252, 168, 0.28);
}
.gold-card {
background:
linear-gradient(180deg, rgba(94, 240, 180, 0.08), rgba(21, 169, 155, 0.03)),
var(--gold-bg);
border: 1px solid rgba(94, 240, 180, 0.45);
box-shadow: inset 0 0 24px rgba(94, 240, 180, 0.06);
}
.gold-btn {
background: linear-gradient(180deg, var(--gold-btn-1), var(--gold-btn-2));
color: #06231a;
box-shadow: 0 6px 18px rgba(21, 169, 155, 0.3);
}
@keyframes barfill {
from {
width: 0;
}
}
.bar-anim {
animation: barfill 0.8s ease-out;
}
+86
View File
@@ -0,0 +1,86 @@
// 백엔드 FastAPI 클라이언트. 동일 출처 /api (dev=vite proxy, prod=nginx proxy).
import type { CrowdStats, Leaderboard, Match, ModelName } from "./types";
import type { Lang } from "./i18n";
const BASE = import.meta.env.VITE_API_BASE || "/api";
async function http<T>(path: string, init?: RequestInit): Promise<T> {
const res = await fetch(`${BASE}${path}`, {
headers: { "Content-Type": "application/json", ...(init?.headers || {}) },
...init,
});
if (!res.ok) {
let detail = res.statusText;
try {
const body = await res.json();
detail = body.detail || detail;
} catch {
/* noop */
}
throw new ApiError(res.status, detail);
}
return res.json() as Promise<T>;
}
export class ApiError extends Error {
constructor(
public status: number,
public detail: string,
) {
super(detail);
}
}
export function listMatches(lang: Lang): Promise<Match[]> {
return http<Match[]>(`/matches?lang=${lang}`);
}
export function getMatch(matchId: string, lang: Lang): Promise<Match> {
return http<Match>(`/matches/${matchId}?lang=${lang}`);
}
export interface SubmitResult {
ok: boolean;
predictionId: string;
matchedModels: ModelName[];
exactMatch: boolean;
crowd: CrowdStats;
}
export function submitPrediction(body: {
matchId: string;
deviceId: string;
outcome: string;
scoreA: number;
scoreB: number;
email?: string;
notify: boolean;
}): Promise<SubmitResult> {
return http<SubmitResult>(`/predictions`, {
method: "POST",
body: JSON.stringify(body),
});
}
export function getLeaderboard(): Promise<Leaderboard> {
return http<Leaderboard>(`/leaderboard`);
}
// ── 비로그인 식별: deviceId (localStorage 영속) ──
const DEVICE_KEY = "tp_device_id";
export function getDeviceId(): string {
let id = localStorage.getItem(DEVICE_KEY);
if (!id) {
id =
typeof crypto !== "undefined" && crypto.randomUUID
? crypto.randomUUID()
: `dev-${Date.now()}-${Math.random().toString(36).slice(2)}`;
localStorage.setItem(DEVICE_KEY, id);
}
return id;
}
// 경기별 공유 딥링크
export function matchUrl(matchId: string): string {
return `${window.location.origin}/match/${matchId}`;
}
+56
View File
@@ -0,0 +1,56 @@
import type { Outcome, Match, AIPrediction, Team } from "./types";
import { type Lang, teamShort, dayName, monthEn, dict } from "./i18n";
export function outcomeLabel(match: Match, o: Outcome, lang: Lang = "ko"): string {
const d = dict(lang);
if (o === "TEAM_A_WIN") return `${teamShort(match.teamA, lang)} ${d.win}`;
if (o === "TEAM_B_WIN") return `${teamShort(match.teamB, lang)} ${d.win}`;
return d.drawLabel;
}
// D3: 확률 = 이긴다고 예측한 팀의 승리 확률. 라벨은 호출부에서 dict로 구성.
export function winProb(
match: Match,
p: Pick<AIPrediction, "outcome" | "confidencePct">,
): { team: Team | null; pct: number } {
if (p.outcome === "TEAM_A_WIN") return { team: match.teamA, pct: p.confidencePct };
if (p.outcome === "TEAM_B_WIN") return { team: match.teamB, pct: p.confidencePct };
return { team: null, pct: p.confidencePct };
}
// "6월 12일 (금)" / "Jun 12 (Fri)" — 대시보드 날짜 그룹 헤더
export function dateHeading(iso: string, lang: Lang = "ko"): string {
const dm = iso.match(/(\d{4})-(\d{2})-(\d{2})/);
if (!dm) return iso;
const [, y, mo, d] = dm;
const dow = dayName(lang, new Date(Date.UTC(+y, +mo - 1, +d)).getUTCDay());
return lang === "en"
? `${monthEn(+mo)} ${+d} (${dow})`
: `${+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;
}
// "6.12(금) 11:00 KST" — 요일명만 로케일 적용
export function kickoffDisplay(iso: string, lang: Lang = "ko"): string {
const dm = iso.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/);
if (!dm) return iso;
const [, y, mo, d, hh, mm] = dm;
const dow = dayName(lang, new Date(Date.UTC(+y, +mo - 1, +d)).getUTCDay());
return `${+mo}.${+d}(${dow}) ${hh}:${mm} KST`;
}
export function pct(part: number, total: number): number {
if (!total) return 0;
return Math.round((part / total) * 100);
}
+215
View File
@@ -0,0 +1,215 @@
// 경량 i18n — ?lang=en 쿼리로 한/영 전환. SSG 유지(서버에서 lang 주입).
import type { Team } from "./types";
export type Lang = "ko" | "en";
export function parseLang(v: unknown): Lang {
return v === "en" ? "en" : "ko";
}
// 팀 짧은 표기 (KO=한글, EN=영문 약식)
const TEAM_EN: Record<string, string> = {
KOR: "Korea",
CZE: "Czechia",
MEX: "Mexico",
RSA: "S. Africa",
};
export function teamShort(team: Team, lang: Lang): string {
return lang === "en" ? TEAM_EN[team.code] ?? team.name : team.shortName;
}
const DAYS: Record<Lang, string[]> = {
ko: ["일", "월", "화", "수", "목", "금", "토"],
en: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
};
const MONTHS_EN = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
export function dayName(lang: Lang, dow: number): string {
return DAYS[lang][dow];
}
export function monthEn(m: number): string {
return MONTHS_EN[m - 1];
}
// roundLabel 안의 한국어 토막 번역
export function roundLabel(label: string, lang: Lang): string {
if (lang === "ko") return label;
return label.replace("개막전", "Opener");
}
type Dict = {
heroPill: string;
back: string;
share: string;
shareCopied: string;
introLead: string;
prizeLine1: string;
prizeLine2: string;
schedTitle: string;
schedGuide: string;
phase: { open: string; scheduled: string; locked: string; finished: string };
aiPicks: string;
draw: string;
joined: (n: string) => string;
aiBattle: string;
yourPickLabel: string;
yourChoice: string;
win: string;
drawLabel: string;
winProb: (team: string) => string;
drawOdds: string;
ctaBeat: string;
ctaResult: string;
ctaLocked: string;
ctaOpens: (d: string) => string;
emailPh: string;
notify: string;
submit: string;
myPick: string;
sameAI: (models: string, exact: boolean) => string;
soloPick: string;
shareThis: string;
copyLink: string;
copied: string;
goldDesc: string;
goldBtn: string;
crowdSub: string;
finalResult: string;
hit: string;
miss: string;
matchEnded: string;
cdUntil: string;
cdClosed: string;
final: string;
group: (g: string) => string;
footerNotOfficial: string;
footerDisc1: string;
footerDisc2: string;
footerDisc3: string;
hook: (a: string, b: string) => string;
adLabel: string;
ado2Tagline: string;
ado2Sub: string;
ado2Cta: string;
};
export const DICT: Record<Lang, Dict> = {
ko: {
heroPill: "AI와 함께하는 2026 월드컵 승부예측 챌린지",
back: "← 전체 일정",
share: "투표 공유하기",
shareCopied: "링크 복사됨 ✓",
introLead: "GPT · Claude · Gemini가 매 경기를\n서로 다르게 예측합니다.",
prizeLine1: "가장 많이 참여하고, 가장 정확하게 예측한",
prizeLine2: "최종 우승자에게 100만원 상금",
schedTitle: "전체 일정",
schedGuide: "투표하고 싶은 경기를 선택해주세요",
phase: { open: "투표 중", scheduled: "오픈 예정", locked: "투표 마감", finished: "종료" },
aiPicks: "AI 픽",
draw: "무",
joined: (n) => `${n}명 참여`,
aiBattle: "AI의 예측 대결",
yourPickLabel: "Your Pick · 내 예측",
yourChoice: "당신의 선택",
win: "승",
drawLabel: "무승부",
winProb: (t) => `${t} 승리 확률`,
drawOdds: "무승부 가능성",
ctaBeat: "AI보다 잘 맞히기",
ctaResult: "결과 보기",
ctaLocked: "예측 마감 (경기 시작)",
ctaOpens: (d) => `투표 오픈 ${d}`,
emailPh: "이메일 (결과·다음 경기 알림)",
notify: "경기 결과가 나오면 알려주세요. 다음 경기·100만원 챌린지 소식도 받겠습니다.",
submit: "제출하고 AI와 겨루기",
myPick: "내 예측",
sameAI: (m, exact) =>
`당신은 ${m}와 같은 선택입니다.${exact ? " 스코어까지 일치!" : ""} 나머지 AI는 생각이 다릅니다.`,
soloPick: "당신은 AI 셋 모두와 다른 선택! 소신 픽 🔥",
shareThis: "이 경기 공유하기",
copyLink: "링크 복사",
copied: "복사됨 ✓",
goldDesc: "경기마다 승패·스코어를 맞혀 포인트를 쌓고, 누적 1위에게 최종 100만원",
goldBtn: "100만 원에\n도전하기",
crowdSub: "| 참여자들의 선택",
finalResult: "최종 결과",
hit: "적중 ✓",
miss: "빗나감",
matchEnded: "경기 종료 · 최종 결과",
cdUntil: "투표 종료까지",
cdClosed: "투표가 마감되었습니다",
final: "Final",
group: (g) => `Group ${g}`,
footerNotOfficial:
"Independent AI prediction game — not affiliated with, endorsed by, or sponsored by FIFA or the official World Cup.",
footerDisc1: "FIFA 및 공식 월드컵과 무관한 독립 AI 예측 게임입니다 (제휴·후원·운영 아님).",
footerDisc2: "스포츠 분석·엔터테인먼트 목적의 예측 게임이며 베팅·도박을 권유하지 않습니다. AI 예측은 실제 결과를 보장하지 않습니다.",
footerDisc3: "100만 원 이벤트는 무료 참여형 챌린지입니다. 지급·동점 처리 조건은 별도 약관에 따릅니다. 이메일은 결과·이벤트 알림 목적으로만 사용됩니다.",
hook: (a, b) => `${a} vs ${b}, AI의 선택은 갈렸다`,
adLabel: "광고",
ado2Tagline: "AI 마케팅 자동화 플랫폼",
ado2Sub: "AI Marketing Automation Platform →",
ado2Cta: "사용해보기",
},
en: {
heroPill: "AI-powered World Cup 2026 match predictions",
back: "← All matches",
share: "Share vote",
shareCopied: "Link copied ✓",
introLead: "GPT · Claude · Gemini predict\nevery match differently.",
prizeLine1: "The most active, most accurate",
prizeLine2: "overall winner takes ₩1,000,000",
schedTitle: "All Matches",
schedGuide: "Pick a match to predict",
phase: { open: "Voting", scheduled: "Opens soon", locked: "Closed", finished: "Ended" },
aiPicks: "AI picks",
draw: "Draw",
joined: (n) => `${n} joined`,
aiBattle: "AI Prediction Battle",
yourPickLabel: "Your Pick",
yourChoice: "Your Choice",
win: "Win",
drawLabel: "Draw",
winProb: (t) => `${t} win prob.`,
drawOdds: "Draw odds",
ctaBeat: "Beat the AI",
ctaResult: "View result",
ctaLocked: "Closed (kickoff)",
ctaOpens: (d) => `Opens ${d}`,
emailPh: "Email (result & next-match alerts)",
notify: "Notify me when the result is out. I'll also get next-match & ₩1,000,000 challenge news.",
submit: "Submit & face the AI",
myPick: "My Pick",
sameAI: (m, exact) =>
`You matched ${m}.${exact ? " Exact score too!" : ""} The other AIs disagree.`,
soloPick: "You disagree with all three AIs — bold pick 🔥",
shareThis: "Share this match",
copyLink: "Copy link",
copied: "Copied ✓",
goldDesc: "Earn points each match by nailing the result & score — the overall #1 wins ₩1,000,000.",
goldBtn: "Go for\n₩1,000,000",
crowdSub: "| What the crowd picked",
finalResult: "Final result",
hit: "Hit ✓",
miss: "Miss",
matchEnded: "Match ended · Final",
cdUntil: "Voting closes in",
cdClosed: "Voting closed",
final: "Final",
group: (g) => `Group ${g}`,
footerNotOfficial:
"Independent AI prediction game — not affiliated with, endorsed by, or sponsored by FIFA or the official World Cup.",
footerDisc1: "A fan-run prediction game using public match schedules; all picks are independent.",
footerDisc2: "A sports-analysis & entertainment prediction game. No betting or gambling. AI predictions do not guarantee real outcomes.",
footerDisc3: "The ₩1,000,000 event is a free-to-enter challenge. Payout & tie-break terms follow separate rules. Email is used only for result & event alerts.",
hook: (a, b) => `AI is split on ${a} vs ${b}`,
adLabel: "AD",
ado2Tagline: "AI Marketing Automation Platform",
ado2Sub: "Visit ado2.o2osolution.ai →",
ado2Cta: "Try it",
},
};
export function dict(lang: Lang): Dict {
return DICT[lang];
}
+75
View File
@@ -0,0 +1,75 @@
// TriplePick 도메인 타입 — 백엔드 API 응답(schemas.py)과 정합.
export type Outcome = "TEAM_A_WIN" | "DRAW" | "TEAM_B_WIN";
export type ModelName = "GPT" | "Claude" | "Gemini";
export type MatchPhase = "scheduled" | "open" | "locked" | "finished";
export interface Team {
name: string;
shortName: string;
code: string;
flag: string;
}
export interface MatchResult {
scoreA: number;
scoreB: number;
outcome: Outcome;
}
export interface AIPrediction {
matchId: string;
model: ModelName;
outcome: Outcome;
scoreA: number;
scoreB: number;
confidencePct: number;
reasonShort: string;
generatedAt: string;
}
export interface CrowdStats {
matchId: string;
total: number;
teamAWin: number;
draw: number;
teamBWin: number;
}
export interface Match {
matchId: string;
roundLabel: string;
group: string;
teamA: Team;
teamB: Team;
kickoffKst: string;
venue: string;
opensAt: string;
lockAt: string;
status: string;
phase: MatchPhase;
votingOpen: boolean;
hookText: string;
result?: MatchResult | null;
predictions: AIPrediction[];
crowd?: CrowdStats | null;
}
export interface UserPick {
outcome: Outcome;
scoreA: number;
scoreB: number;
}
export interface Standing {
rank: number;
emailMasked: string;
totalPoints: number;
exactCount: number;
matchesPlayed: number;
}
export interface Leaderboard {
standings: Standing[];
scoredMatches: number;
}
+13
View File
@@ -0,0 +1,13 @@
// ?lang=en 쿼리에서 언어 파싱 (Next searchParams 대체).
import { useSearchParams } from "react-router-dom";
import { parseLang, type Lang } from "./i18n";
export function useLang(): Lang {
const [params] = useSearchParams();
return parseLang(params.get("lang") ?? undefined);
}
// 현재 lang 을 유지하며 경로에 쿼리 부착
export function withLang(path: string, lang: Lang): string {
return lang === "en" ? `${path}${path.includes("?") ? "&" : "?"}lang=en` : path;
}
+13
View File
@@ -0,0 +1,13 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import App from "./App";
import "./globals.css";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>,
);
+57
View File
@@ -0,0 +1,57 @@
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 { listMatches } from "@/lib/api";
import type { Match } from "@/lib/types";
// L1. 전체 일정 대시보드 (랜딩 진입)
export default function Dashboard() {
const lang = useLang();
const t = dict(lang);
const [matches, setMatches] = useState<Match[] | null>(null);
const [error, setError] = useState(false);
useEffect(() => {
let alive = true;
setMatches(null);
setError(false);
listMatches(lang)
.then((m) => alive && setMatches(m))
.catch(() => alive && setError(true));
return () => {
alive = false;
};
}, [lang]);
return (
<main className="shell">
<Hero lang={lang} />
{/* 기간 안내 + CTA 영역 */}
<div className="mt-5 rounded-2xl border border-[var(--line-d)] bg-[var(--bg2)] p-4 text-center">
<p className="whitespace-pre-line text-[14px] font-bold leading-snug">
{t.introLead}
</p>
<p className="mt-1 text-[14px] font-bold leading-snug text-[var(--green)]">
{t.prizeLine1}
<br />
<span className="whitespace-nowrap">{t.prizeLine2}</span>
</p>
</div>
{error && (
<p className="mt-6 text-center text-[13px] text-white/55">
{lang === "en" ? "Failed to load matches." : "경기 정보를 불러오지 못했습니다."}
</p>
)}
{matches && <ScheduleBoard matches={matches} lang={lang} />}
<Ado2Ad lang={lang} />
<Footer lang={lang} />
</main>
);
}
+74
View File
@@ -0,0 +1,74 @@
import { useEffect, useState } from "react";
import Hero from "@/components/Hero";
import Footer from "@/components/Footer";
import { useLang } from "@/lib/useLang";
import { getLeaderboard } from "@/lib/api";
import type { Leaderboard as LB } from "@/lib/types";
// L3. 리더보드 — 누적 포인트 1위. 데이터 없으면 안내 stub.
export default function Leaderboard() {
const lang = useLang();
const [data, setData] = useState<LB | null>(null);
useEffect(() => {
let alive = true;
getLeaderboard()
.then((d) => alive && setData(d))
.catch(() => alive && setData({ standings: [], scoredMatches: 0 }));
return () => {
alive = false;
};
}, []);
const empty = !data || data.standings.length === 0;
return (
<main className="shell">
<Hero back lang={lang} />
<section className="mt-8">
<div className="font-impact text-[28px] text-[var(--green)]">LEADERBOARD</div>
{empty ? (
<div className="mt-4 rounded-2xl border border-[var(--line-d)] bg-[var(--bg2)] p-8 text-center">
<p className="text-[15px] font-bold">
{lang === "en" ? "Rankings open soon" : "랭킹은 곧 공개됩니다"}
</p>
<p className="mt-2 text-[13px] leading-relaxed text-[var(--ink-muted)]">
{lang === "en"
? "Points accumulate each match — the overall #1 wins ₩1,000,000."
: "매 경기 누적 점수로 순위를 매기고, 끝까지 가장 잘 맞힌 한 분께 최종 100만원을 드립니다."}
</p>
</div>
) : (
<div className="mt-4 overflow-hidden rounded-2xl border border-[var(--line-d)]">
{data!.standings.map((s) => (
<div
key={s.rank}
className="flex items-center justify-between border-b border-[var(--line-d)] px-4 py-3 last:border-b-0"
>
<div className="flex items-center gap-3">
<span className="w-6 text-center font-impact text-[18px] text-[var(--green)]">
{s.rank}
</span>
<span className="text-[14px] font-bold">{s.emailMasked}</span>
</div>
<div className="text-right">
<span className="text-[16px] font-extrabold">{s.totalPoints}</span>
<span className="ml-1 text-[11px] text-[var(--ink-muted)]">
{lang === "en" ? "pts" : "점"}
</span>
<span className="ml-2 text-[11px] text-[var(--ink-muted)]">
{lang === "en"
? `${s.exactCount} exact · ${s.matchesPlayed} played`
: `정확 ${s.exactCount} · ${s.matchesPlayed}경기`}
</span>
</div>
</div>
))}
</div>
)}
</section>
<Footer lang={lang} />
</main>
);
}
+103
View File
@@ -0,0 +1,103 @@
import { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import Hero from "@/components/Hero";
import MatchupHUD from "@/components/MatchupHUD";
import Arena from "@/components/Arena";
import Footer from "@/components/Footer";
import { dict, teamShort } from "@/lib/i18n";
import { useLang } from "@/lib/useLang";
import { getMatch, matchUrl, ApiError } from "@/lib/api";
import type { Match } from "@/lib/types";
// L2. 경기 상세(대결) 페이지
export default function MatchDetail() {
const { matchId = "" } = useParams();
const lang = useLang();
const t = dict(lang);
const [match, setMatch] = useState<Match | null>(null);
const [notFound, setNotFound] = useState(false);
useEffect(() => {
let alive = true;
setMatch(null);
setNotFound(false);
getMatch(matchId, lang)
.then((m) => alive && setMatch(m))
.catch((e) => {
if (!alive) return;
if (e instanceof ApiError && e.status === 404) setNotFound(true);
else setNotFound(true);
});
return () => {
alive = false;
};
}, [matchId, lang]);
if (notFound) {
return (
<main className="shell">
<Hero back lang={lang} />
<p className="mt-10 text-center text-[15px] font-bold text-white/70">
{lang === "en" ? "Match not found." : "경기를 찾을 수 없습니다."}
</p>
<Footer lang={lang} />
</main>
);
}
if (!match) {
return (
<main className="shell">
<Hero back lang={lang} />
<p className="mt-10 text-center text-[14px] text-white/45">…</p>
</main>
);
}
const aShort = teamShort(match.teamA, lang);
const bShort = teamShort(match.teamB, lang);
const hook = lang === "en" ? t.hook(aShort, bShort) : match.hookText;
const url = matchUrl(match.matchId);
return (
<main className="shell">
<Hero
back
lang={lang}
share={{
url,
title: `${aShort} vs ${bShort} — TriplePick`,
text:
lang === "en"
? `${hook} — see all 3 AI picks and make yours!`
: `${hook} — AI 셋의 예측을 보고 너의 픽을 찍어봐!`,
}}
/>
{/* 경기별 후킹 카피 (한 줄) */}
<h1 className="mt-6 flex items-center justify-center gap-2 whitespace-nowrap text-[19px] font-extrabold leading-snug">
<span className="text-[var(--green)]">⫽</span>
{hook}
<span className="text-[var(--green)]">⫽</span>
</h1>
<MatchupHUD match={match} lang={lang} />
<Arena
match={match}
predictions={match.predictions}
crowd={
match.crowd ?? {
matchId: match.matchId,
total: 0,
teamAWin: 0,
draw: 0,
teamBWin: 0,
}
}
shareUrl={url}
lang={lang}
/>
<Footer lang={lang} />
</main>
);
}
+17
View File
@@ -0,0 +1,17 @@
import Hero from "@/components/Hero";
import Footer from "@/components/Footer";
import { useLang } from "@/lib/useLang";
export default function NotFound() {
const lang = useLang();
return (
<main className="shell">
<Hero back lang={lang} />
<p className="mt-16 text-center font-impact text-[40px] text-[var(--green)]">404</p>
<p className="mt-2 text-center text-[14px] text-white/60">
{lang === "en" ? "Page not found" : "페이지를 찾을 수 없습니다"}
</p>
<Footer lang={lang} />
</main>
);
}
+9
View File
@@ -0,0 +1,9 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_API_BASE?: string;
readonly VITE_API_TARGET?: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": { "@/*": ["./src/*"] }
},
"include": ["src"]
}
+22
View File
@@ -0,0 +1,22 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import path from "node:path";
// 개발 시 /api 요청을 백엔드(8000)로 프록시 → 브라우저는 동일 출처로 호출.
// 운영(docker)에서는 nginx 가 동일하게 /api 를 프록시한다.
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: { "@": path.resolve(__dirname, "./src") },
},
server: {
port: 5173,
proxy: {
"/api": {
target: process.env.VITE_API_TARGET || "http://localhost:8000",
changeOrigin: true,
},
},
},
});