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 ( -
+ {hint === "image" ? (
+
Preview not available for this URL type.
+ )} + +- Practice questions -
-+ Question bank +
++ {practiceFetch.totalCount}{" "} + {practiceFetch.totalCount === 1 ? "question" : "questions"} in this + practice +
+ ) : null} +{practiceFetch.message}
- +{practiceFetch.message}
+ +- No questions yet. Add them via{" "} - Open editor or{" "} - Edit in full view. -
++ No questions in this practice yet. +
++ Add them via Open editor{" "} + or Edit in full view. +
+- {q.question_text || "—"} -
- {extractUrls(q.question_text || "").map((u) => ( -- Tip: - {q.tips} -
- ) : null} - {q.image_url ? renderMediaPreview(q.image_url, "image") : null} - {q.voice_prompt ? renderMediaPreview(q.voice_prompt, "audio") : null} - {q.sample_answer_voice_prompt - ? renderMediaPreview(q.sample_answer_voice_prompt, "audio") - : null} -+ Prompt +
++ {q.question_text?.trim() || ( + No prompt text + )} +
+
+
+
{q.tips}
++ Assets +
+- Showing {practiceFetch.questions.length} of {practiceFetch.totalCount}{" "} - questions. Open full editor to see or edit the rest. -
+