1단계 뼈대: joke-app에서 로그인(디스코드·게스트)·세션·권한·관리자·DB를 가져와 음악퀴즈용으로 정리, 새 디자인·아이콘, WS 연결·시계 맞추기, 테스트·e2e

- apps/server: Hono API(auth/me/config/admin), Bun WebSocket(welcome·ping/pong, 압축 끔), SQLite 마이그레이션
- 사이트 설정: 채팅 도배 방지 기본 꺼짐(관리자가 켬, 초당·순간 횟수)
- apps/web: 첫 화면·로그인·관리자(대시보드·사이트·사용자·관리자·기록), 라이트/다크, 휴대폰, noindex
- packages/shared: 닉네임 규칙, 프로토콜(zod), 시계 차이 계산
- 테스트 20개 + 브라우저 e2e 6단계 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-18 19:44:47 +09:00
parent 7ae34c49c1
commit 391bbe69e5
61 changed files with 3569 additions and 3 deletions

View File

@@ -0,0 +1,65 @@
/** Guest start: nickname (pre-filled suggestion) + start button (joke-app NicknameForm). */
import { useState } from 'react';
import { nicknameError, normalizeNickname, suggestNickname } from '@mq/shared/lite';
import { api } from '../net/api';
import { useSession } from '../store/session';
export function NicknameForm({ onDone }: { onDone?: () => void }) {
const [nick, setNick] = useState(() => suggestNickname());
const [error, setError] = useState<string | null>(null);
const [busy, setBusy] = useState(false);
const submit = async (e: React.FormEvent) => {
e.preventDefault();
const n = normalizeNickname(nick);
const err = nicknameError(n);
if (err) return setError(err);
setBusy(true);
try {
await api.guest(n);
await useSession.getState().refresh();
onDone?.();
} catch (ex) {
setError((ex as Error).message);
} finally {
setBusy(false);
}
};
return (
<form className="stack" onSubmit={submit}>
<label className="field">
게스트 닉네임 (2~12자)
<input
className="input"
value={nick}
onChange={(e) => {
setNick(e.target.value);
setError(null);
}}
onFocus={(e) => e.target.select()}
maxLength={20}
autoComplete="nickname"
enterKeyHint="go"
/>
</label>
{error && (
<p className="field-error" role="alert">
{error}
</p>
)}
<button className="btn btn-block" disabled={busy}>
{busy ? '잠시만요…' : '게스트로 시작'}
</button>
</form>
);
}
/** Guests are deleted a day after they leave the site (docs/02). */
export function GuestWarning() {
return (
<p className="guest-warning small" role="note">
게스트는 사이트에 들어오지 않은 채 하루가 지나면 계정이 지워져요. 퀴즈 저장은 디스코드 로그인 계정만 할 수 있어요.
</p>
);
}