diff --git a/src/pages/content-management/HumanLanguagePage.tsx b/src/pages/content-management/HumanLanguagePage.tsx index 8e46362..196f70b 100644 --- a/src/pages/content-management/HumanLanguagePage.tsx +++ b/src/pages/content-management/HumanLanguagePage.tsx @@ -4,8 +4,13 @@ import { ChevronDown, ChevronRight, ClipboardList, + HelpCircle, + Image as ImageIcon, Languages, + Lightbulb, + Link2, Loader2, + Mic, Plus, Search, Trash2, @@ -68,6 +73,31 @@ function practiceStatusStyle(status: string): string { return "bg-grayScale-50 text-grayScale-600 ring-1 ring-inset ring-grayScale-200" } +function questionTypeBadgeClass(questionType: string): string { + const t = questionType.toUpperCase().replace(/\s+/g, "_") + if (t === "MCQ" || t.includes("MULTIPLE")) { + return "border-transparent bg-violet-50 text-violet-800 ring-1 ring-inset ring-violet-200" + } + if (t === "TRUE_FALSE" || t.includes("TRUE")) { + return "border-transparent bg-sky-50 text-sky-800 ring-1 ring-inset ring-sky-200" + } + if (t === "SHORT" || t === "SHORT_ANSWER") { + return "border-transparent bg-emerald-50 text-emerald-800 ring-1 ring-inset ring-emerald-200" + } + if (t === "AUDIO") { + return "border-transparent bg-orange-50 text-orange-800 ring-1 ring-inset ring-orange-200" + } + return "border-transparent bg-grayScale-100 text-grayScale-700 ring-1 ring-inset ring-grayScale-200" +} + +function formatQuestionTypeLabel(raw: string): string { + return String(raw ?? "—") + .replace(/_/g, " ") + .trim() + .toLowerCase() + .replace(/\b\w/g, (c) => c.toUpperCase()) +} + const URL_REGEX = /(https?:\/\/[^\s<>"')\]]+)/gi function extractUrls(text: string): string[] { @@ -146,32 +176,71 @@ export function HumanLanguagePage() { urlRaw: string, hint?: "audio" | "video" | "image", className = "mt-2", + label?: string, ) => { const url = normalizeUrl(urlRaw) if (!url) return null const mediaType = detectMediaType(url, hint) const vimeoEmbed = getVimeoEmbedUrl(url) + const showPlayer = + mediaType === "image" || mediaType === "video" || mediaType === "audio" return ( -
+
+ {label ? ( +

+ {hint === "image" ? ( + + ) : hint === "audio" ? ( + + ) : hint === "video" ? ( +

+ ) : null} {mediaType === "image" ? ( - preview + ) : mediaType === "video" ? ( vimeoEmbed ? (