Vote lock 5min + email autocomplete + detail-page UI tweaks

This commit is contained in:
JinwooKim committed 2026-06-15 11:28:41 +09:00
1 parent c77d014a01
commit 4a0188a443
11 files changed
+60 -10

No files matched your search

+14 -2
View File
@@ -9,7 +9,7 @@ import type {
AIPrediction,
Team,
} from "@/lib/types";
import { ApiError, getDeviceId, submitPrediction } from "@/lib/api";
import { ApiError, getDeviceId, getRecentEmails, rememberEmail, submitPrediction } from "@/lib/api";
import Countdown from "./Countdown";
import TeamFlag from "./TeamFlag";
@@ -43,7 +43,8 @@ export default function Arena({
const [scoreA, setScoreA] = useState(0);
const [scoreB, setScoreB] = useState(0);
const [step, setStep] = useState<Step>("pick");
const [email, setEmail] = useState("");
const [recentEmails, setRecentEmails] = useState<string[]>(getRecentEmails);
const [email, setEmail] = useState(() => recentEmails[0] ?? "");
const [notify, setNotify] = useState(true);
const [crowd, setCrowd] = useState<CrowdStats>(initialCrowd);
const [copied, setCopied] = useState(false);
@@ -98,6 +99,8 @@ export default function Arena({
notify,
});
setCrowd(res.crowd); // 서버 권위 분포로 갱신
rememberEmail(email.trim()); // 다음 투표 자동완성용으로 기억
setRecentEmails(getRecentEmails());
setStep("done");
} catch (e) {
const msg =
@@ -299,11 +302,20 @@ export default function Arena({
<input
type="email"
inputMode="email"
list="tp-email-suggestions"
autoComplete="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)]"
/>
{recentEmails.length > 0 && (
<datalist id="tp-email-suggestions">
{recentEmails.map((e) => (
<option key={e} value={e} />
))}
</datalist>
)}
<label className="flex items-start gap-2 text-[13px] text-[var(--ink-muted)]">
<input
type="checkbox"
+1 -1
View File
@@ -23,7 +23,7 @@ export default function Hero({
<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"
className="flex items-center gap-1.5 rounded-full border border-white/12 bg-white/8 px-[18px] py-[9px] text-[18px] font-bold text-white/85 active:scale-95"
>
{t.back}
</Link>
+1 -1
View File
@@ -37,7 +37,7 @@ export default function ShareButton({
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"
className="flex items-center rounded-full border border-[var(--share)]/55 bg-[var(--share)]/12 px-[18px] py-[9px] text-[18px] font-bold text-[var(--share)] transition active:scale-95"
>
{copied ? copiedLabel : label}
</button>