feat: quiz

This commit is contained in:
gosangam
2026-10-15 19:40:28 +05:30
parent 3f3fa9a720
commit 111485a43e
20 changed files with 2178 additions and 224 deletions
+17
View File
@@ -0,0 +1,17 @@
import type { Quiz } from "@/lib/api";
export const KIND_LABEL: Record<Quiz["target_kind"], string> = {
chapter: "Book chapter",
lecture: "Lecture",
conversation: "Conversation",
standalone: "Stand-alone",
};
/** "1m 12s" / "8.4s" — response times read better than raw milliseconds. */
export function fmtMs(ms: number | null | undefined): string {
if (ms == null) return "—";
if (ms < 60_000) return `${(ms / 1000).toFixed(1)}s`;
const m = Math.floor(ms / 60_000);
const s = Math.round((ms % 60_000) / 1000);
return `${m}m ${s}s`;
}