Fix attach-practice success back navigation for lesson context.
Show Back to Lessons and return to the lesson practices page when backTo=lesson. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
c98efdc6c9
commit
bc0fc8e3e5
|
|
@ -121,17 +121,19 @@ export function LinkExistingPracticeFlow() {
|
||||||
])
|
])
|
||||||
|
|
||||||
const backLabel =
|
const backLabel =
|
||||||
effectiveBackTo === "module"
|
effectiveBackTo === "lesson"
|
||||||
? "Back to Module"
|
? "Back to Lessons"
|
||||||
: effectiveBackTo === "unit"
|
: effectiveBackTo === "module"
|
||||||
? "Back to Unit"
|
? "Back to Module"
|
||||||
: effectiveBackTo === "modules"
|
: effectiveBackTo === "unit"
|
||||||
? "Back to Modules"
|
? "Back to Unit"
|
||||||
: effectiveBackTo === "courses"
|
: effectiveBackTo === "modules"
|
||||||
? "Back to Course"
|
? "Back to Modules"
|
||||||
: isExamPrep
|
: effectiveBackTo === "courses"
|
||||||
? "Back to Program"
|
? "Back to Course"
|
||||||
: "Back to Courses"
|
: isExamPrep
|
||||||
|
? "Back to Program"
|
||||||
|
: "Back to Courses"
|
||||||
|
|
||||||
const backPath = useMemo(() => {
|
const backPath = useMemo(() => {
|
||||||
if (isExamPrep) {
|
if (isExamPrep) {
|
||||||
|
|
@ -150,11 +152,36 @@ export function LinkExistingPracticeFlow() {
|
||||||
if (effectiveBackTo === "courses" && programType && courseId) {
|
if (effectiveBackTo === "courses" && programType && courseId) {
|
||||||
return `/new-content/courses/${programType}/${courseId}`
|
return `/new-content/courses/${programType}/${courseId}`
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
effectiveBackTo === "lesson" &&
|
||||||
|
programType &&
|
||||||
|
courseId &&
|
||||||
|
unitId &&
|
||||||
|
moduleId &&
|
||||||
|
lessonId
|
||||||
|
) {
|
||||||
|
const titleQuery = lessonTitleRaw?.trim()
|
||||||
|
? `?lessonTitle=${encodeURIComponent(lessonTitleDisplay || lessonTitleRaw)}`
|
||||||
|
: ""
|
||||||
|
return `/new-content/courses/${programType}/${courseId}/${unitId}/${moduleId}/lessons/${lessonId}/practices${titleQuery}`
|
||||||
|
}
|
||||||
if (programType) {
|
if (programType) {
|
||||||
return `/new-content/courses/${programType}`
|
return `/new-content/courses/${programType}`
|
||||||
}
|
}
|
||||||
return "/new-content"
|
return "/new-content"
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
effectiveBackTo === "lesson" &&
|
||||||
|
level &&
|
||||||
|
courseId &&
|
||||||
|
moduleId &&
|
||||||
|
lessonId
|
||||||
|
) {
|
||||||
|
const titleQuery = lessonTitleRaw?.trim()
|
||||||
|
? `?lessonTitle=${encodeURIComponent(lessonTitleDisplay || lessonTitleRaw)}`
|
||||||
|
: ""
|
||||||
|
return `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}/lessons/${lessonId}/practices${titleQuery}`
|
||||||
|
}
|
||||||
if (effectiveBackTo === "module" && level && courseId && moduleId) {
|
if (effectiveBackTo === "module" && level && courseId && moduleId) {
|
||||||
return `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}`
|
return `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}`
|
||||||
}
|
}
|
||||||
|
|
@ -169,6 +196,9 @@ export function LinkExistingPracticeFlow() {
|
||||||
courseId,
|
courseId,
|
||||||
unitId,
|
unitId,
|
||||||
moduleId,
|
moduleId,
|
||||||
|
lessonId,
|
||||||
|
lessonTitleRaw,
|
||||||
|
lessonTitleDisplay,
|
||||||
level,
|
level,
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user