diff --git a/src/components/AdminContentManager.tsx b/src/components/AdminContentManager.tsx index 245ab52..7c8a500 100644 --- a/src/components/AdminContentManager.tsx +++ b/src/components/AdminContentManager.tsx @@ -148,7 +148,7 @@ export default function AdminContentManager({ token }: AdminContentManagerProps) }); setShowCourseForm(true); setTimeout(() => { - window.scrollTo({ top: 0, behavior: 'smooth' }); + document.getElementById('admin-content-top')?.scrollIntoView({ behavior: 'smooth', block: 'start' }); }, 50); }; @@ -208,7 +208,7 @@ export default function AdminContentManager({ token }: AdminContentManagerProps) setModuleForm({ title: mod.title, order: mod.order }); setShowModuleForm(true); setTimeout(() => { - window.scrollTo({ top: 0, behavior: 'smooth' }); + document.getElementById('admin-content-top')?.scrollIntoView({ behavior: 'smooth', block: 'start' }); }, 50); }; @@ -279,16 +279,17 @@ export default function AdminContentManager({ token }: AdminContentManagerProps) const handleEditLesson = (lesson: Lesson) => { setEditingLesson(lesson); + setActiveModuleForLesson(lesson.moduleId); setLessonForm({ title: lesson.title, videoUrl: lesson.videoUrl, videoType: lesson.videoType, order: lesson.order, - content: lesson.content + content: lesson.content || '' }); setShowLessonForm(true); setTimeout(() => { - window.scrollTo({ top: 0, behavior: 'smooth' }); + document.getElementById('admin-content-top')?.scrollIntoView({ behavior: 'smooth', block: 'start' }); }, 50); }; @@ -320,7 +321,7 @@ export default function AdminContentManager({ token }: AdminContentManagerProps) } return ( -