feat: quiz
This commit is contained in:
@@ -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`;
|
||||
}
|
||||
Reference in New Issue
Block a user