Fix edit course/module/lesson buttons not scrolling to form
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 46s Details

This commit is contained in:
Sidney Gomes 2026-07-20 19:31:21 -03:00
parent dc13f33455
commit 2045c33525
1 changed files with 7 additions and 6 deletions

View File

@ -148,7 +148,7 @@ export default function AdminContentManager({ token }: AdminContentManagerProps)
}); });
setShowCourseForm(true); setShowCourseForm(true);
setTimeout(() => { setTimeout(() => {
window.scrollTo({ top: 0, behavior: 'smooth' }); document.getElementById('admin-content-top')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
}, 50); }, 50);
}; };
@ -208,7 +208,7 @@ export default function AdminContentManager({ token }: AdminContentManagerProps)
setModuleForm({ title: mod.title, order: mod.order }); setModuleForm({ title: mod.title, order: mod.order });
setShowModuleForm(true); setShowModuleForm(true);
setTimeout(() => { setTimeout(() => {
window.scrollTo({ top: 0, behavior: 'smooth' }); document.getElementById('admin-content-top')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
}, 50); }, 50);
}; };
@ -279,16 +279,17 @@ export default function AdminContentManager({ token }: AdminContentManagerProps)
const handleEditLesson = (lesson: Lesson) => { const handleEditLesson = (lesson: Lesson) => {
setEditingLesson(lesson); setEditingLesson(lesson);
setActiveModuleForLesson(lesson.moduleId);
setLessonForm({ setLessonForm({
title: lesson.title, title: lesson.title,
videoUrl: lesson.videoUrl, videoUrl: lesson.videoUrl,
videoType: lesson.videoType, videoType: lesson.videoType,
order: lesson.order, order: lesson.order,
content: lesson.content content: lesson.content || ''
}); });
setShowLessonForm(true); setShowLessonForm(true);
setTimeout(() => { setTimeout(() => {
window.scrollTo({ top: 0, behavior: 'smooth' }); document.getElementById('admin-content-top')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
}, 50); }, 50);
}; };
@ -320,7 +321,7 @@ export default function AdminContentManager({ token }: AdminContentManagerProps)
} }
return ( return (
<div className="space-y-8"> <div id="admin-content-top" className="space-y-8">
{/* Top Header */} {/* Top Header */}
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between border-b border-white/10 pb-5 gap-4"> <div className="flex flex-col sm:flex-row sm:items-center sm:justify-between border-b border-white/10 pb-5 gap-4">
<div> <div>
@ -443,7 +444,7 @@ export default function AdminContentManager({ token }: AdminContentManagerProps)
{/* --- RENDER COURSE DETAIL / CURRICULUM MANAGER --- */} {/* --- RENDER COURSE DETAIL / CURRICULUM MANAGER --- */}
{selectedCourse ? ( {selectedCourse ? (
<div className="space-y-6"> <div id="admin-content-top" className="space-y-6">
{/* Active Course Breadcrumb */} {/* Active Course Breadcrumb */}
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 glass-card p-4 rounded-xl"> <div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 glass-card p-4 rounded-xl">
<button <button