Add cross-module lesson navigation and admin edit button
- Admin lesson editor now navigates across module boundaries (full course flat list) - Student lesson view shows "Edit" button for admins linking to lesson editor Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,19 +21,18 @@ interface LessonData {
|
||||
interface SiblingLesson {
|
||||
id: string;
|
||||
title: string;
|
||||
moduleId: string;
|
||||
}
|
||||
|
||||
export function LessonEditor({
|
||||
lesson,
|
||||
courseId,
|
||||
moduleId,
|
||||
courseSlug,
|
||||
prevLesson,
|
||||
nextLesson,
|
||||
}: {
|
||||
lesson: LessonData;
|
||||
courseId: string;
|
||||
moduleId: string;
|
||||
courseSlug: string;
|
||||
prevLesson?: SiblingLesson | null;
|
||||
nextLesson?: SiblingLesson | null;
|
||||
@@ -156,8 +155,8 @@ export function LessonEditor({
|
||||
}
|
||||
}
|
||||
|
||||
function navigateTo(lessonId: string) {
|
||||
router.push(`/admin/courses/${courseId}/modules/${moduleId}/lessons/${lessonId}`);
|
||||
function navigateTo(target: SiblingLesson) {
|
||||
router.push(`/admin/courses/${courseId}/modules/${target.moduleId}/lessons/${target.id}`);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -213,18 +212,18 @@ export function LessonEditor({
|
||||
<div className="flex items-center gap-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => prevLesson && navigateTo(prevLesson.id)}
|
||||
onClick={() => prevLesson && navigateTo(prevLesson)}
|
||||
disabled={!prevLesson}
|
||||
title={prevLesson ? `← ${prevLesson.title}` : "Первый урок в модуле"}
|
||||
title={prevLesson ? `← ${prevLesson.title}` : "Первый урок курса"}
|
||||
className="btn-aubade flex items-center gap-1 px-2 py-2 text-sm disabled:opacity-30"
|
||||
>
|
||||
<ChevronLeft size={14} />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => nextLesson && navigateTo(nextLesson.id)}
|
||||
onClick={() => nextLesson && navigateTo(nextLesson)}
|
||||
disabled={!nextLesson}
|
||||
title={nextLesson ? `${nextLesson.title} →` : "Последний урок в модуле"}
|
||||
title={nextLesson ? `${nextLesson.title} →` : "Последний урок курса"}
|
||||
className="btn-aubade flex items-center gap-1 px-2 py-2 text-sm disabled:opacity-30"
|
||||
>
|
||||
<ChevronRight size={14} />
|
||||
|
||||
Reference in New Issue
Block a user