투표 제출 CTA 단일 카드 통합 + Red Wave 2026 트랙 추가
This commit is contained in:
1 parent
7a68d27693
commit
2988a59749
7 files changed
+42
-27
No files matched your search
@@ -13,7 +13,7 @@ import { ApiError, getDeviceId, getRecentEmails, rememberEmail, submitPrediction
|
||||
import Countdown from "./Countdown";
|
||||
import TeamFlag from "./TeamFlag";
|
||||
|
||||
type Step = "pick" | "form" | "done";
|
||||
type Step = "form" | "done";
|
||||
|
||||
const MODEL_ICON: Record<ModelName, string> = {
|
||||
GPT: "/icons/gpt.png",
|
||||
@@ -42,7 +42,7 @@ export default function Arena({
|
||||
const [outcome, setOutcome] = useState<Outcome | null>("DRAW");
|
||||
const [scoreA, setScoreA] = useState(0);
|
||||
const [scoreB, setScoreB] = useState(0);
|
||||
const [step, setStep] = useState<Step>("pick");
|
||||
const [step, setStep] = useState<Step>("form");
|
||||
const [recentEmails, setRecentEmails] = useState<string[]>(getRecentEmails);
|
||||
const [email, setEmail] = useState(""); // 칸은 비우고, 입력/포커스 시 datalist 드롭다운으로만 자동완성
|
||||
const [notify, setNotify] = useState(true);
|
||||
@@ -79,10 +79,7 @@ export default function Arena({
|
||||
.map((p) => ({ model: p.model, exact: p.scoreA === scoreA && p.scoreB === scoreB }));
|
||||
}, [outcome, scoreA, scoreB, predictions]);
|
||||
|
||||
const submitPick = () => {
|
||||
if (!outcome) return;
|
||||
setStep("form");
|
||||
};
|
||||
const emailValid = EMAIL_RE.test(email.trim());
|
||||
|
||||
const confirmSubmit = async () => {
|
||||
if (!EMAIL_RE.test(email.trim()) || !outcome) return;
|
||||
@@ -285,20 +282,22 @@ export default function Arena({
|
||||
</section>
|
||||
)}
|
||||
|
||||
{/* ===== CTA 민트 #85FCA8 (진행 중일 때) ===== */}
|
||||
{!finished && step === "pick" && (
|
||||
{/* ===== 투표 마감/오픈 전: 상태 버튼만 ===== */}
|
||||
{!finished && disabled && (
|
||||
<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"
|
||||
disabled
|
||||
className="btn-mint mt-5 w-full rounded-2xl py-5 text-[20px] font-extrabold opacity-60"
|
||||
>
|
||||
{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">
|
||||
{/* ===== 투표 제출 (D5): 이메일 + 단일 CTA를 한 카드로 통합 ===== */}
|
||||
{!finished && !disabled && step === "form" && (
|
||||
<div className="mt-5 rounded-2xl border-2 border-[var(--green)]/60 bg-[var(--bg2)] p-4 shadow-[0_0_24px_rgba(74,255,160,0.08)]">
|
||||
<div className="mb-2.5 text-center text-[15px] font-extrabold text-[var(--green)]">
|
||||
{t.emailGate}
|
||||
</div>
|
||||
<input
|
||||
type="email"
|
||||
inputMode="email"
|
||||
@@ -307,7 +306,7 @@ export default function Arena({
|
||||
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)]"
|
||||
className="w-full rounded-2xl border border-[var(--share)] bg-[#0f1217] px-4 py-3 text-[16px] text-white shadow-[0_0_0_2px_rgba(166,94,255,0.12)] outline-none focus:shadow-[0_0_0_2px_rgba(166,94,255,0.3)]"
|
||||
/>
|
||||
{recentEmails.length > 0 && (
|
||||
<datalist id="tp-email-suggestions">
|
||||
@@ -316,24 +315,24 @@ export default function Arena({
|
||||
))}
|
||||
</datalist>
|
||||
)}
|
||||
<label className="flex items-start gap-2 text-[13px] text-[var(--ink-muted)]">
|
||||
<label className="mt-2.5 flex items-start gap-2 text-[13px] leading-snug text-[var(--ink-muted)]">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={notify}
|
||||
onChange={(e) => setNotify(e.target.checked)}
|
||||
className="mt-0.5 accent-[var(--mint)]"
|
||||
className="mt-0.5 accent-[var(--share)]"
|
||||
/>
|
||||
{t.notify}
|
||||
</label>
|
||||
{error && (
|
||||
<p className="text-[13px] font-bold text-[#ff6b6b]">{error}</p>
|
||||
<p className="mt-2 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"
|
||||
disabled={!emailValid || submitting}
|
||||
className="btn-share mt-3.5 flex w-full items-center justify-center gap-1.5 rounded-2xl py-3 text-[15px] font-extrabold transition active:scale-[0.99] disabled:opacity-[0.72]"
|
||||
>
|
||||
{submitting ? "…" : t.submit}
|
||||
{submitting ? "…" : <>{t.submit} <span aria-hidden>→</span></>}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user