제작된 퀴즈 1~3단계: 관리자 → 퀴즈(목록·추가·곡 목록: 서버 DB/유튜브 검색·주소로 추가, 끌어서·▲▼·번호로 순서, 복수정답은 연결된 DB 곡 별칭에도, 영상 바꾸기 / 설정: 설명·공개방식(비공개·일부공개·전체공개)·문제 순서·재생위치 기본·방 규칙). 저장은 버튼·Ctrl+S로만, 안 저장 시 탭 제목·표시·나가기 확인. 곡마다 처음·하이라이트 위치 편집기(영상+큰 재생바, 끌기·지금 위치로·여기서 듣기·±1초, 자동=0초+DB 하이라이트, 연령제한은 받아 둔 음원). 방 설정 '직접 선택 / 제작된 퀴즈'(검색·비공개/일부공개 먼저), 고르면 퀴즈 설정이 방 설정으로, 듣고맞추기·곡 전부, 곡별 위치로 재생, 플레이 수. 퀴즈당 곡 수·계정당 퀴즈 수 제한(사이트 설정, 기본 무제한). '퀴즈 저장·불러오기'는 '진행 저장·불러오기'로 이름 변경

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-22 08:36:40 +09:00
parent e3cb623773
commit b56d1a8d0e
29 changed files with 2366 additions and 111 deletions

View File

@@ -0,0 +1,62 @@
/**
* 제작된 퀴즈 (admin-made quizzes): a list of songs with their own answers and start/highlight positions,
* plus the room settings a room takes over when it picks the quiz. Plain data for the browser; zod in custom-quiz-schema.ts.
*/
import { DEFAULT_ROOM_CONFIG, type RoomConfig } from './room-config';
/** 비공개: only the maker's rooms · 일부공개: the maker's and admins' rooms · 전체공개: everyone. */
export const QUIZ_VISIBILITIES = [
{ id: 'private', label: '비공개', help: '내 계정으로 방을 만들 때만 고를 수 있어요.' },
{ id: 'partial', label: '일부공개', help: '나와 관리자 계정으로 방을 만들 때만 고를 수 있어요.' },
{ id: 'public', label: '전체공개', help: '누구나 고를 수 있어요. 곡은 관리자 검토를 거쳐 서버 노래 DB에도 들어가요.' },
] as const;
export type QuizVisibility = (typeof QUIZ_VISIBILITIES)[number]['id'];
/** Room settings a quiz carries as its defaults (the host may still change them in the room). */
export const QUIZ_ROOM_KEYS = ['listenSec', 'startAt', 'answer', 'strict', 'hint', 'hintVotes', 'skipVotes', 'replayVotes', 'revealSec', 'nextVotes'] as const;
export type QuizRoomDefaults = Pick<RoomConfig, (typeof QUIZ_ROOM_KEYS)[number]>;
export interface QuizSettings extends QuizRoomDefaults {
/** 문제 순서: as listed or shuffled each game. */
order: 'ordered' | 'random';
}
export const DEFAULT_QUIZ_SETTINGS: QuizSettings = {
...(Object.fromEntries(QUIZ_ROOM_KEYS.map((k) => [k, DEFAULT_ROOM_CONFIG[k]])) as QuizRoomDefaults),
order: 'ordered',
};
export interface QuizItem {
/** Stable id once saved; absent for a song added since the last save. */
id?: number;
/** The server DB song this item is (its aliases also count as answers), null when it is not in the DB. */
songId: number | null;
videoId: string;
title: string;
artist: string;
/** Extra accepted answers for this quiz (also added to the DB song's aliases on save). */
titleAnswers: string[];
artistAnswers: string[];
durationSec: number | null;
/** 자동: start at 0 and the DB highlight; off = startSec/highlightSec below. */
auto: boolean;
startSec: number | null;
highlightSec: number | null;
}
export interface QuizSummary {
id: number;
name: string;
description: string;
visibility: QuizVisibility;
songs: number;
plays: number;
ownerId: string;
ownerName: string;
updatedAt: number;
}
export interface QuizDetail extends QuizSummary {
settings: QuizSettings;
items: QuizItem[];
}