route human language new-practice to full create flow
Use the dedicated add-practice route from Human Language so question-set creation uses the richer speaking-style multi-step UI instead of the inline create modal. Made-with: Cursor
This commit is contained in:
parent
79da9014de
commit
3c864fe8ec
|
|
@ -1,5 +1,5 @@
|
||||||
import { useEffect, useMemo, useState } from "react"
|
import { useEffect, useMemo, useState } from "react"
|
||||||
import { Link } from "react-router-dom"
|
import { Link, useNavigate } from "react-router-dom"
|
||||||
import {
|
import {
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
|
|
@ -185,6 +185,7 @@ type PendingRemove = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function HumanLanguagePage() {
|
export function HumanLanguagePage() {
|
||||||
|
const navigate = useNavigate()
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [categoryId, setCategoryId] = useState<number | null>(null)
|
const [categoryId, setCategoryId] = useState<number | null>(null)
|
||||||
const [subCategories, setSubCategories] = useState<HumanLanguageSubCategoryTree[]>([])
|
const [subCategories, setSubCategories] = useState<HumanLanguageSubCategoryTree[]>([])
|
||||||
|
|
@ -598,11 +599,12 @@ export function HumanLanguagePage() {
|
||||||
setQuestionDraft(createEmptyPracticeQuestionDraft())
|
setQuestionDraft(createEmptyPracticeQuestionDraft())
|
||||||
}
|
}
|
||||||
|
|
||||||
const openCreatePracticeDialog = (subModuleId: number) => {
|
const openCreatePracticeDialog = (courseId: number, subModuleId: number) => {
|
||||||
setPracticeSubmitAttempted(false)
|
if (!categoryId) {
|
||||||
setPracticeFormTouched(false)
|
toast.error("Category is not ready yet. Please try again.")
|
||||||
resetPracticeForm()
|
return
|
||||||
setPracticeDialog({ open: true, mode: "create", subModuleId })
|
}
|
||||||
|
navigate(`/content/human-language/${categoryId}/${courseId}/sub-module/${subModuleId}/add-practice`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const openEditPracticeDialog = (subModuleId: number, p: LearningPathPractice) => {
|
const openEditPracticeDialog = (subModuleId: number, p: LearningPathPractice) => {
|
||||||
|
|
@ -1309,7 +1311,7 @@ export function HumanLanguagePage() {
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-8 border-grayScale-200 bg-white px-2 text-[11px] hover:border-brand-200 hover:bg-brand-50/40"
|
className="h-8 border-grayScale-200 bg-white px-2 text-[11px] hover:border-brand-200 hover:bg-brand-50/40"
|
||||||
onClick={() => openCreatePracticeDialog(subModule.id)}
|
onClick={() => openCreatePracticeDialog(course.course_id, subModule.id)}
|
||||||
>
|
>
|
||||||
<Plus className="h-3.5 w-3.5" />
|
<Plus className="h-3.5 w-3.5" />
|
||||||
New practice
|
New practice
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user