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 =
|
||||
effectiveBackTo === "module"
|
||||
? "Back to Module"
|
||||
: effectiveBackTo === "unit"
|
||||
? "Back to Unit"
|
||||
: effectiveBackTo === "modules"
|
||||
? "Back to Modules"
|
||||
: effectiveBackTo === "courses"
|
||||
? "Back to Course"
|
||||
: isExamPrep
|
||||
? "Back to Program"
|
||||
: "Back to Courses"
|
||||
effectiveBackTo === "lesson"
|
||||
? "Back to Lessons"
|
||||
: effectiveBackTo === "module"
|
||||
? "Back to Module"
|
||||
: effectiveBackTo === "unit"
|
||||
? "Back to Unit"
|
||||
: effectiveBackTo === "modules"
|
||||
? "Back to Modules"
|
||||
: effectiveBackTo === "courses"
|
||||
? "Back to Course"
|
||||
: isExamPrep
|
||||
? "Back to Program"
|
||||
: "Back to Courses"
|
||||
|
||||
const backPath = useMemo(() => {
|
||||
if (isExamPrep) {
|
||||
|
|
@ -150,11 +152,36 @@ export function LinkExistingPracticeFlow() {
|
|||
if (effectiveBackTo === "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) {
|
||||
return `/new-content/courses/${programType}`
|
||||
}
|
||||
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) {
|
||||
return `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}`
|
||||
}
|
||||
|
|
@ -169,6 +196,9 @@ export function LinkExistingPracticeFlow() {
|
|||
courseId,
|
||||
unitId,
|
||||
moduleId,
|
||||
lessonId,
|
||||
lessonTitleRaw,
|
||||
lessonTitleDisplay,
|
||||
level,
|
||||
])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user