From 3c864fe8ec1ffa2c94d7cd60a690fac952955027 Mon Sep 17 00:00:00 2001 From: Yared Yemane Date: Wed, 8 Apr 2026 01:00:54 -0700 Subject: [PATCH] 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 --- .../content-management/HumanLanguagePage.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pages/content-management/HumanLanguagePage.tsx b/src/pages/content-management/HumanLanguagePage.tsx index b384bd1..b189dce 100644 --- a/src/pages/content-management/HumanLanguagePage.tsx +++ b/src/pages/content-management/HumanLanguagePage.tsx @@ -1,5 +1,5 @@ import { useEffect, useMemo, useState } from "react" -import { Link } from "react-router-dom" +import { Link, useNavigate } from "react-router-dom" import { ChevronDown, ChevronRight, @@ -185,6 +185,7 @@ type PendingRemove = { } export function HumanLanguagePage() { + const navigate = useNavigate() const [loading, setLoading] = useState(false) const [categoryId, setCategoryId] = useState(null) const [subCategories, setSubCategories] = useState([]) @@ -598,11 +599,12 @@ export function HumanLanguagePage() { setQuestionDraft(createEmptyPracticeQuestionDraft()) } - const openCreatePracticeDialog = (subModuleId: number) => { - setPracticeSubmitAttempted(false) - setPracticeFormTouched(false) - resetPracticeForm() - setPracticeDialog({ open: true, mode: "create", subModuleId }) + const openCreatePracticeDialog = (courseId: number, subModuleId: number) => { + if (!categoryId) { + toast.error("Category is not ready yet. Please try again.") + return + } + navigate(`/content/human-language/${categoryId}/${courseId}/sub-module/${subModuleId}/add-practice`) } const openEditPracticeDialog = (subModuleId: number, p: LearningPathPractice) => { @@ -1309,7 +1311,7 @@ export function HumanLanguagePage() { size="sm" variant="outline" 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)} > New practice