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

+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>
);
}