이지선다 모드: 조회수가 더 높은 곡 고르기. 이지선다 퀴즈는 조회수가 든 파일로 만들고(custom_quizzes.kind='duel', custom_quiz_items.views, 013 마이그레이션; 1,234,567·123만·1.2억도 읽음, 조회수 없는 줄은 빠짐) 이지선다에서만, 일반 퀴즈는 듣고맞추기에서만 쓴다. 서버 game/duel.ts: 문제마다 A/B 카드, 카드를 누르면 고른 것(시간 전까지 바꾸기), 시간이 끝나면 조회수 공개·높은 쪽 1점·역배(혼자 맞히고 반대쪽 2명 이상) 2점·같으면 둘 다 정답, 매번 새 두 곡/연속(이긴 곡이 조회수를 보인 채 A로 남음). 화면 DuelScreen: 고른 사람 프로필이 카드 밑에, 카드마다 숨은 플레이어(net/duel-player.ts)로 각자 듣고 다시 누르면 멈춘 곳부터 이어서. 방 설정 이지선다(제한 시간 기본 30초·진행 방식·재생위치·문제 수, 이지선다 퀴즈만 목록에), 결과 화면 역배 성공 수. 관리자 파일로 만들기 종류 선택(조회수 열이 있으면 이지선다), 조회수 편집·내보내기·빈 양식. 폰 점수판 가로 스크롤 키보드 접근(axe). 서버 테스트 146개, e2e duel(실제 유튜브 이어 듣기 포함)·game·quiz·admin·rooms·login·a11y 통과
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ export const MODES = [
|
||||
{ id: 'listen', label: '듣고맞추기', icon: '🎧' },
|
||||
{ id: 'artist', label: '가수노래 맞추기', icon: '🎤' },
|
||||
{ id: 'lyrics', label: '가사보고 맞추기', icon: '📜' },
|
||||
{ id: 'duel', label: '이지선다', icon: '🆚' },
|
||||
] as const;
|
||||
export type Mode = (typeof MODES)[number]['id'];
|
||||
|
||||
@@ -22,6 +23,14 @@ export type VoteRule = (typeof VOTE_RULES)[number];
|
||||
export const COUNTS = [10, 20, 30, 50, 100, 0] as const;
|
||||
/** 다음 문제까지: seconds the answer stays on screen (the music goes on) before the next question. */
|
||||
export const REVEAL_SECS = [5, 10, 15, 30] as const;
|
||||
/** 이지선다 제한 시간: seconds to pick a card. */
|
||||
export const DUEL_SECS = [10, 15, 20, 30, 45, 60, 90] as const;
|
||||
/** 이지선다 진행: pairs = 매번 새 두 곡, chain = 조회수가 더 높은 곡이 남고 새 곡과 다시 비교. */
|
||||
export const DUEL_FLOWS = [
|
||||
{ id: 'pairs', label: '매번 새 두 곡' },
|
||||
{ id: 'chain', label: '이긴 곡이 남기 (연속)' },
|
||||
] as const;
|
||||
export type DuelFlow = (typeof DUEL_FLOWS)[number]['id'];
|
||||
|
||||
export interface RoomConfig {
|
||||
title: string;
|
||||
@@ -49,7 +58,10 @@ export interface RoomConfig {
|
||||
nextVotes: VoteRule;
|
||||
count: (typeof COUNTS)[number];
|
||||
visibility: 'public' | 'private' | 'password';
|
||||
/** 제작된 퀴즈: the chosen quiz (listen mode only, every song of it); null = 직접 선택 (장르·연도·난이도). */
|
||||
/** 이지선다: seconds to pick (the cards can be changed until then). */
|
||||
duelSec: (typeof DUEL_SECS)[number];
|
||||
duelFlow: DuelFlow;
|
||||
/** 제작된 퀴즈: the chosen quiz (일반 퀴즈 = listen mode, 이지선다 퀴즈 = duel mode); null = 직접 선택 (장르·연도·난이도). */
|
||||
quizId: number | null;
|
||||
/** Name of that quiz, filled in by the server for room cards. */
|
||||
quizName: string;
|
||||
@@ -76,6 +88,8 @@ export const DEFAULT_ROOM_CONFIG: RoomConfig = {
|
||||
nextVotes: '1/3',
|
||||
count: 30,
|
||||
visibility: 'public',
|
||||
duelSec: 30,
|
||||
duelFlow: 'pairs',
|
||||
quizId: null,
|
||||
quizName: '',
|
||||
};
|
||||
@@ -113,6 +127,11 @@ export function listenLabel(s: number): string {
|
||||
/** One-line summary for room cards (docs/03 열린 방 목록). */
|
||||
export function configSummary(c: RoomConfig, genreName: (id: string) => string = (x) => x): string[] {
|
||||
const out: string[] = [];
|
||||
if (c.mode === 'duel') {
|
||||
out.push(`🆚 이지선다 · ${c.duelSec}초`, c.duelFlow === 'chain' ? '이긴 곡이 남기' : '매번 새 두 곡');
|
||||
if (c.quizId) out.unshift(`📋 ${c.quizName || '이지선다 퀴즈'}`);
|
||||
return out;
|
||||
}
|
||||
if (c.quizId) {
|
||||
out.push(`📋 ${c.quizName || '제작된 퀴즈'}`, `🎧 ${listenLabel(c.listenSec)}${c.startAt === 'highlight' ? ' · 하이라이트' : ''}`);
|
||||
if (c.answer !== 'title') out.push(c.answer === 'both' ? '제목+가수' : '가수만');
|
||||
@@ -128,3 +147,10 @@ export function configSummary(c: RoomConfig, genreName: (id: string) => string =
|
||||
out.push(`공개 ${c.revealSec}초`);
|
||||
return out;
|
||||
}
|
||||
|
||||
/** 조회수 for people: 1.2억 · 3,456만 · 9,999 (exact numbers go in a tooltip). */
|
||||
export function viewsLabel(n: number): string {
|
||||
if (n >= 1e8) return `${(Math.floor(n / 1e7) / 10).toLocaleString('ko-KR')}억`;
|
||||
if (n >= 1e4) return `${Math.floor(n / 1e4).toLocaleString('ko-KR')}만`;
|
||||
return n.toLocaleString('ko-KR');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user