Support audio practice creation from Human Language flow.
Add AUDIO question support to the shared practice creation page and preserve human-language navigation context so back/cancel returns to the Human Language page. Made-with: Cursor
This commit is contained in:
parent
383886156c
commit
bf0dabbf05
|
|
@ -1,5 +1,5 @@
|
||||||
import { useRef, useState, type ChangeEvent } from "react"
|
import { useMemo, useRef, useState, type ChangeEvent } from "react"
|
||||||
import { Link, useParams, useNavigate } from "react-router-dom"
|
import { Link, useLocation, useParams, useNavigate } from "react-router-dom"
|
||||||
import { ArrowLeft, ArrowRight, ChevronDown, Grid3X3, Check, Plus, Trash2, GripVertical, X, Edit, Rocket, Loader2, Upload } from "lucide-react"
|
import { ArrowLeft, ArrowRight, ChevronDown, Grid3X3, Check, Plus, Trash2, GripVertical, X, Edit, Rocket, Loader2, Upload } from "lucide-react"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { Card } from "../../components/ui/card"
|
import { Card } from "../../components/ui/card"
|
||||||
|
|
@ -12,7 +12,7 @@ import type { QuestionOption } from "../../types/course.types"
|
||||||
|
|
||||||
type Step = 1 | 2 | 3 | 4 | 5
|
type Step = 1 | 2 | 3 | 4 | 5
|
||||||
type ResultStatus = "success" | "error"
|
type ResultStatus = "success" | "error"
|
||||||
type QuestionType = "MCQ" | "TRUE_FALSE" | "SHORT"
|
type QuestionType = "MCQ" | "TRUE_FALSE" | "SHORT" | "AUDIO"
|
||||||
type DifficultyLevel = "EASY" | "MEDIUM" | "HARD"
|
type DifficultyLevel = "EASY" | "MEDIUM" | "HARD"
|
||||||
|
|
||||||
interface Persona {
|
interface Persona {
|
||||||
|
|
@ -37,6 +37,7 @@ interface Question {
|
||||||
options: MCQOption[]
|
options: MCQOption[]
|
||||||
voicePrompt: string
|
voicePrompt: string
|
||||||
sampleAnswerVoicePrompt: string
|
sampleAnswerVoicePrompt: string
|
||||||
|
audioCorrectAnswerText: string
|
||||||
shortAnswers: string[]
|
shortAnswers: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,13 +88,21 @@ function createEmptyQuestion(id: string): Question {
|
||||||
],
|
],
|
||||||
voicePrompt: "",
|
voicePrompt: "",
|
||||||
sampleAnswerVoicePrompt: "",
|
sampleAnswerVoicePrompt: "",
|
||||||
|
audioCorrectAnswerText: "",
|
||||||
shortAnswers: [],
|
shortAnswers: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddNewPracticePage() {
|
export function AddNewPracticePage() {
|
||||||
const { categoryId, courseId, subCourseId } = useParams()
|
const { categoryId, courseId, subCourseId } = useParams()
|
||||||
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const searchParams = new URLSearchParams(location.search)
|
||||||
|
const source = searchParams.get("source")
|
||||||
|
const backTo = useMemo(() => {
|
||||||
|
if (source === "human-language") return "/content/human-language"
|
||||||
|
return `/content/category/${categoryId}/courses/${courseId}/sub-courses/${subCourseId}`
|
||||||
|
}, [source, categoryId, courseId, subCourseId])
|
||||||
|
|
||||||
const [currentStep, setCurrentStep] = useState<Step>(1)
|
const [currentStep, setCurrentStep] = useState<Step>(1)
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
|
|
@ -134,7 +143,7 @@ export function AddNewPracticePage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
navigate(`/content/category/${categoryId}/courses/${courseId}/sub-courses/${subCourseId}`)
|
navigate(backTo)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleIntroVideoFileChange = async (event: ChangeEvent<HTMLInputElement>) => {
|
const handleIntroVideoFileChange = async (event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|
@ -247,6 +256,7 @@ export function AddNewPracticePage() {
|
||||||
options: options.length > 0 ? options : undefined,
|
options: options.length > 0 ? options : undefined,
|
||||||
voice_prompt: q.voicePrompt || undefined,
|
voice_prompt: q.voicePrompt || undefined,
|
||||||
sample_answer_voice_prompt: q.sampleAnswerVoicePrompt || undefined,
|
sample_answer_voice_prompt: q.sampleAnswerVoicePrompt || undefined,
|
||||||
|
audio_correct_answer_text: q.audioCorrectAnswerText || undefined,
|
||||||
short_answers: q.shortAnswers.length > 0 ? q.shortAnswers : undefined,
|
short_answers: q.shortAnswers.length > 0 ? q.shortAnswers : undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -297,7 +307,7 @@ export function AddNewPracticePage() {
|
||||||
<>
|
<>
|
||||||
{/* Back Link */}
|
{/* Back Link */}
|
||||||
<Link
|
<Link
|
||||||
to={`/content/category/${categoryId}/courses/${courseId}/sub-courses/${subCourseId}`}
|
to={backTo}
|
||||||
className="group inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-sm font-medium text-grayScale-600 transition-colors hover:bg-brand-50 hover:text-brand-600"
|
className="group inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-sm font-medium text-grayScale-600 transition-colors hover:bg-brand-50 hover:text-brand-600"
|
||||||
>
|
>
|
||||||
<ArrowLeft className="h-4 w-4 transition-transform group-hover:-translate-x-0.5" />
|
<ArrowLeft className="h-4 w-4 transition-transform group-hover:-translate-x-0.5" />
|
||||||
|
|
@ -588,7 +598,7 @@ export function AddNewPracticePage() {
|
||||||
<div className="rounded-2xl border border-grayScale-200/80 bg-gradient-to-r from-grayScale-50/80 to-white px-5 py-5 shadow-sm sm:px-8 sm:py-6">
|
<div className="rounded-2xl border border-grayScale-200/80 bg-gradient-to-r from-grayScale-50/80 to-white px-5 py-5 shadow-sm sm:px-8 sm:py-6">
|
||||||
<h2 className="text-lg font-semibold tracking-tight text-grayScale-900 sm:text-xl">Step 3: Questions</h2>
|
<h2 className="text-lg font-semibold tracking-tight text-grayScale-900 sm:text-xl">Step 3: Questions</h2>
|
||||||
<p className="mt-1.5 max-w-3xl text-sm leading-relaxed text-grayScale-500">
|
<p className="mt-1.5 max-w-3xl text-sm leading-relaxed text-grayScale-500">
|
||||||
Add MCQ, True/False, or Short Answer items. Use the full width for stems and options.
|
Add MCQ, True/False, Short Answer, or Audio items. Use the full width for stems and options.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -636,6 +646,7 @@ export function AddNewPracticePage() {
|
||||||
<option value="MCQ">Multiple Choice</option>
|
<option value="MCQ">Multiple Choice</option>
|
||||||
<option value="TRUE_FALSE">True/False</option>
|
<option value="TRUE_FALSE">True/False</option>
|
||||||
<option value="SHORT">Short Answer</option>
|
<option value="SHORT">Short Answer</option>
|
||||||
|
<option value="AUDIO">Audio</option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -800,6 +811,19 @@ export function AddNewPracticePage() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{question.questionType === "AUDIO" && (
|
||||||
|
<div className="space-y-2">
|
||||||
|
<label className="text-xs font-medium uppercase tracking-wider text-grayScale-500">
|
||||||
|
Audio Correct Answer Text
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
value={question.audioCorrectAnswerText}
|
||||||
|
onChange={(e) => updateQuestion(question.id, { audioCorrectAnswerText: e.target.value })}
|
||||||
|
placeholder="Expected correct answer text for audio response"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
))}
|
||||||
|
|
@ -925,7 +949,13 @@ export function AddNewPracticePage() {
|
||||||
<p className="text-sm font-medium leading-relaxed text-grayScale-900">{question.questionText}</p>
|
<p className="text-sm font-medium leading-relaxed text-grayScale-900">{question.questionText}</p>
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
<span className="rounded-md bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-600">
|
<span className="rounded-md bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-600">
|
||||||
{question.questionType === "MCQ" ? "Multiple Choice" : question.questionType === "TRUE_FALSE" ? "True/False" : "Short Answer"}
|
{question.questionType === "MCQ"
|
||||||
|
? "Multiple Choice"
|
||||||
|
: question.questionType === "TRUE_FALSE"
|
||||||
|
? "True/False"
|
||||||
|
: question.questionType === "AUDIO"
|
||||||
|
? "Audio"
|
||||||
|
: "Short Answer"}
|
||||||
</span>
|
</span>
|
||||||
<span className="rounded-md bg-purple-50 px-2 py-0.5 text-xs font-medium text-purple-600">
|
<span className="rounded-md bg-purple-50 px-2 py-0.5 text-xs font-medium text-purple-600">
|
||||||
{question.difficultyLevel}
|
{question.difficultyLevel}
|
||||||
|
|
@ -1001,7 +1031,7 @@ export function AddNewPracticePage() {
|
||||||
<div className="mt-10 flex w-full max-w-sm flex-col gap-3">
|
<div className="mt-10 flex w-full max-w-sm flex-col gap-3">
|
||||||
<Button
|
<Button
|
||||||
className="w-full bg-brand-500 hover:bg-brand-600"
|
className="w-full bg-brand-500 hover:bg-brand-600"
|
||||||
onClick={() => navigate(`/content/category/${categoryId}/courses/${courseId}/sub-courses/${subCourseId}`)}
|
onClick={() => navigate(backTo)}
|
||||||
>
|
>
|
||||||
Go back to Course
|
Go back to Course
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { useEffect, useMemo, useState } from "react"
|
import { useEffect, useMemo, useState } from "react"
|
||||||
import { Link } from "react-router-dom"
|
import { Link } from "react-router-dom"
|
||||||
import { BookOpen, ChevronDown, ChevronRight, Languages, Loader2, Plus, Search } from "lucide-react"
|
import { BookOpen, ChevronDown, ChevronRight, Languages, Loader2, Plus, Search, Trash2 } from "lucide-react"
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/card"
|
import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/card"
|
||||||
import { Button } from "../../components/ui/button"
|
import { Button } from "../../components/ui/button"
|
||||||
import { SpinnerIcon } from "../../components/ui/spinner-icon"
|
import { SpinnerIcon } from "../../components/ui/spinner-icon"
|
||||||
import { createCourse, createCourseCategory, createHumanLanguageLesson, getHumanLanguageHierarchy } from "../../api/courses.api"
|
import { createCourse, createCourseCategory, createHumanLanguageLesson, deleteSubCourse, getHumanLanguageHierarchy } from "../../api/courses.api"
|
||||||
import type { HumanLanguageCourseTree, HumanLanguageSubCategoryTree } from "../../types/course.types"
|
import type { HumanLanguageCourseTree, HumanLanguageSubCategoryTree } from "../../types/course.types"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
|
|
||||||
|
|
@ -24,6 +24,7 @@ export function HumanLanguagePage() {
|
||||||
const [quickCourseName, setQuickCourseName] = useState("")
|
const [quickCourseName, setQuickCourseName] = useState("")
|
||||||
const [quickSearch, setQuickSearch] = useState("")
|
const [quickSearch, setQuickSearch] = useState("")
|
||||||
const [quickCreating, setQuickCreating] = useState(false)
|
const [quickCreating, setQuickCreating] = useState(false)
|
||||||
|
const [deletingKey, setDeletingKey] = useState<string | null>(null)
|
||||||
|
|
||||||
const loadHierarchy = async () => {
|
const loadHierarchy = async () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
|
|
@ -69,6 +70,13 @@ export function HumanLanguagePage() {
|
||||||
[availableCourses, selectedCourseId],
|
[availableCourses, selectedCourseId],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const levelsForSelectedCourse = useMemo(() => {
|
||||||
|
if (selectedCourseId === "ALL") return [] as string[]
|
||||||
|
const course = selectedCourses.find((c) => c.course_id === selectedCourseId)
|
||||||
|
if (!course) return []
|
||||||
|
return course.levels.filter((l) => l.modules.length > 0).map((l) => l.level.toUpperCase())
|
||||||
|
}, [selectedCourses, selectedCourseId])
|
||||||
|
|
||||||
const toggleLevel = (level: CefrLevel) => {
|
const toggleLevel = (level: CefrLevel) => {
|
||||||
setCollapsedLevels((prev) => (prev.includes(level) ? prev.filter((l) => l !== level) : [...prev, level]))
|
setCollapsedLevels((prev) => (prev.includes(level) ? prev.filter((l) => l !== level) : [...prev, level]))
|
||||||
}
|
}
|
||||||
|
|
@ -151,6 +159,55 @@ export function HumanLanguagePage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleDeleteSubModules = async (ids: number[], key: string, successMessage: string) => {
|
||||||
|
if (ids.length === 0) return
|
||||||
|
const proceed = window.confirm("This action will permanently delete selected item(s). Continue?")
|
||||||
|
if (!proceed) return
|
||||||
|
setDeletingKey(key)
|
||||||
|
try {
|
||||||
|
for (const id of ids) {
|
||||||
|
await deleteSubCourse(id)
|
||||||
|
}
|
||||||
|
toast.success(successMessage)
|
||||||
|
await loadHierarchy()
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to delete item(s):", error)
|
||||||
|
toast.error("Failed to delete item(s)")
|
||||||
|
} finally {
|
||||||
|
setDeletingKey(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCreateNextLevel = async () => {
|
||||||
|
if (selectedCourseId === "ALL") {
|
||||||
|
toast.error("Select a specific course first")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const existing = new Set(levelsForSelectedCourse)
|
||||||
|
const next = CEFR_LEVELS.find((level) => !existing.has(level))
|
||||||
|
if (!next) {
|
||||||
|
toast.error("All CEFR levels are already created")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const key = `next-level-${selectedCourseId}-${next}`
|
||||||
|
setCreatingKey(key)
|
||||||
|
try {
|
||||||
|
await createHumanLanguageLesson({
|
||||||
|
course_id: selectedCourseId,
|
||||||
|
cefr_level: next,
|
||||||
|
title: "Module-1",
|
||||||
|
description: `${next} Module-1`,
|
||||||
|
})
|
||||||
|
toast.success(`${next} created with Module-1`)
|
||||||
|
await loadHierarchy()
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to create next level:", error)
|
||||||
|
toast.error("Failed to create next level")
|
||||||
|
} finally {
|
||||||
|
setCreatingKey(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleQuickCreatePath = async () => {
|
const handleQuickCreatePath = async () => {
|
||||||
if (!quickSubCategoryName.trim() || !quickCourseName.trim()) {
|
if (!quickSubCategoryName.trim() || !quickCourseName.trim()) {
|
||||||
toast.error("Subcategory and course names are required")
|
toast.error("Subcategory and course names are required")
|
||||||
|
|
@ -256,6 +313,17 @@ export function HumanLanguagePage() {
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
<CardContent className="pt-0">
|
||||||
|
<div className="flex items-center justify-end">
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
onClick={handleCreateNextLevel}
|
||||||
|
disabled={selectedCourseId === "ALL" || levelsForSelectedCourse.length >= CEFR_LEVELS.length || creatingKey?.startsWith("next-level-")}
|
||||||
|
>
|
||||||
|
{creatingKey?.startsWith("next-level-") ? "Creating level..." : "Add Next Level"}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{categoryId && selectedCourseId !== "ALL" ? (
|
{categoryId && selectedCourseId !== "ALL" ? (
|
||||||
|
|
@ -328,7 +396,7 @@ export function HumanLanguagePage() {
|
||||||
modules: levelNode?.modules ?? [],
|
modules: levelNode?.modules ?? [],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter((entry) => entry.modules.length > 0 || selectedCourses.length > 0)
|
.filter((entry) => entry.modules.length > 0 || (selectedCourses.length > 0 && level === "A1"))
|
||||||
return (
|
return (
|
||||||
<Card key={level} className="overflow-hidden border-grayScale-200/80 shadow-sm">
|
<Card key={level} className="overflow-hidden border-grayScale-200/80 shadow-sm">
|
||||||
<button
|
<button
|
||||||
|
|
@ -342,6 +410,22 @@ export function HumanLanguagePage() {
|
||||||
<span className="rounded-md bg-brand-100 px-2 py-0.5 text-xs font-medium text-brand-700">
|
<span className="rounded-md bg-brand-100 px-2 py-0.5 text-xs font-medium text-brand-700">
|
||||||
{modulesByCourse.reduce((sum, entry) => sum + entry.modules.length, 0)} module(s)
|
{modulesByCourse.reduce((sum, entry) => sum + entry.modules.length, 0)} module(s)
|
||||||
</span>
|
</span>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="outline"
|
||||||
|
className="ml-3 border-red-200 text-red-600 hover:bg-red-50"
|
||||||
|
disabled={selectedCourseId === "ALL" || deletingKey === `level-${selectedCourseId}-${level}`}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
if (selectedCourseId === "ALL") return
|
||||||
|
const courseEntry = modulesByCourse.find((entry) => entry.course.course_id === selectedCourseId)
|
||||||
|
const ids = (courseEntry?.modules ?? []).flatMap((m) => m.sub_modules.map((s) => s.id))
|
||||||
|
handleDeleteSubModules(ids, `level-${selectedCourseId}-${level}`, `Level ${level} removed`)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Trash2 className="h-3.5 w-3.5" />
|
||||||
|
Remove Level
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
{!collapsedLevels.includes(level) ? (
|
{!collapsedLevels.includes(level) ? (
|
||||||
|
|
@ -375,21 +459,39 @@ export function HumanLanguagePage() {
|
||||||
<div key={module.id} className="rounded-lg border border-grayScale-100 bg-grayScale-50/60 p-3">
|
<div key={module.id} className="rounded-lg border border-grayScale-100 bg-grayScale-50/60 p-3">
|
||||||
<div className="flex items-center justify-between gap-2">
|
<div className="flex items-center justify-between gap-2">
|
||||||
<p className="text-sm font-semibold text-grayScale-900">Module: {module.title}</p>
|
<p className="text-sm font-semibold text-grayScale-900">Module: {module.title}</p>
|
||||||
<Button
|
<div className="flex gap-2">
|
||||||
size="sm"
|
<Button
|
||||||
variant="outline"
|
size="sm"
|
||||||
onClick={() =>
|
variant="outline"
|
||||||
handleCreateSubModule(entry.course.course_id, level, module.title, module.sub_modules)
|
onClick={() =>
|
||||||
}
|
handleCreateSubModule(entry.course.course_id, level, module.title, module.sub_modules)
|
||||||
disabled={creatingKey === `submodule-${entry.course.course_id}-${level}-${parseModuleNumber(module.title) ?? 0}`}
|
}
|
||||||
>
|
disabled={creatingKey === `submodule-${entry.course.course_id}-${level}-${parseModuleNumber(module.title) ?? 0}`}
|
||||||
{creatingKey === `submodule-${entry.course.course_id}-${level}-${parseModuleNumber(module.title) ?? 0}` ? (
|
>
|
||||||
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
{creatingKey === `submodule-${entry.course.course_id}-${level}-${parseModuleNumber(module.title) ?? 0}` ? (
|
||||||
) : (
|
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
||||||
<Plus className="h-3.5 w-3.5" />
|
) : (
|
||||||
)}
|
<Plus className="h-3.5 w-3.5" />
|
||||||
Add Sub-module
|
)}
|
||||||
</Button>
|
Add Sub-module
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="outline"
|
||||||
|
className="border-red-200 text-red-600 hover:bg-red-50"
|
||||||
|
disabled={deletingKey === `module-${module.id}`}
|
||||||
|
onClick={() =>
|
||||||
|
handleDeleteSubModules(
|
||||||
|
module.sub_modules.map((s) => s.id),
|
||||||
|
`module-${module.id}`,
|
||||||
|
`Module ${module.title} removed`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Trash2 className="h-3.5 w-3.5" />
|
||||||
|
Remove Module
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{module.sub_modules.map((subModule) => (
|
{module.sub_modules.map((subModule) => (
|
||||||
<div key={subModule.id} className="mt-2 rounded-md border border-grayScale-100 bg-white p-2">
|
<div key={subModule.id} className="mt-2 rounded-md border border-grayScale-100 bg-white p-2">
|
||||||
|
|
@ -400,9 +502,25 @@ export function HumanLanguagePage() {
|
||||||
<Link to={`/content/category/${categoryId}/courses/${entry.course.course_id}/sub-courses/${subModule.id}`}>
|
<Link to={`/content/category/${categoryId}/courses/${entry.course.course_id}/sub-courses/${subModule.id}`}>
|
||||||
<Button size="sm" variant="outline">Manage lesson videos/audio</Button>
|
<Button size="sm" variant="outline">Manage lesson videos/audio</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<Link to={`/content/category/${categoryId}/courses/${entry.course.course_id}/sub-courses/${subModule.id}/add-practice`}>
|
<Link to={`/content/category/${categoryId}/courses/${entry.course.course_id}/sub-courses/${subModule.id}/add-practice?source=human-language`}>
|
||||||
<Button size="sm">Add practice/audio questions</Button>
|
<Button size="sm">Add practice/audio questions</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="outline"
|
||||||
|
className="border-red-200 text-red-600 hover:bg-red-50"
|
||||||
|
disabled={deletingKey === `submodule-${subModule.id}`}
|
||||||
|
onClick={() =>
|
||||||
|
handleDeleteSubModules(
|
||||||
|
[subModule.id],
|
||||||
|
`submodule-${subModule.id}`,
|
||||||
|
`Sub-module ${subModule.title} removed`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Trash2 className="h-3.5 w-3.5" />
|
||||||
|
Remove Sub-module
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user