From 47a645520cc94fe7e7c8a4c3b68ce0c118826695 Mon Sep 17 00:00:00 2001 From: dwindown Date: Sun, 4 Jan 2026 15:05:01 +0700 Subject: [PATCH] Fix curriculum editor chapters persisting across lessons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed bug where editing a lesson without chapters would show chapters from the previously edited lesson. The handleNewLesson function now explicitly initializes chapters to an empty array to prevent state from carrying over between lesson edits. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/components/admin/CurriculumEditor.tsx | 1 + src/index.css | 2 +- src/pages/ProductDetail.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/admin/CurriculumEditor.tsx b/src/components/admin/CurriculumEditor.tsx index bd954d4..cbcf585 100644 --- a/src/components/admin/CurriculumEditor.tsx +++ b/src/components/admin/CurriculumEditor.tsx @@ -194,6 +194,7 @@ export function CurriculumEditor({ productId }: CurriculumEditorProps) { mp4_url: '', video_host: 'youtube', release_at: '', + chapters: [], }); setLessonDialogOpen(true); }; diff --git a/src/index.css b/src/index.css index cb93e4a..4d55989 100644 --- a/src/index.css +++ b/src/index.css @@ -389,7 +389,7 @@ All colors MUST be HSL. border: 1px solid rgba(0, 0, 0, 0.1); } - .flex .flex-1 code { + .flex > .flex-1 > code { background-color: #dedede; } } \ No newline at end of file diff --git a/src/pages/ProductDetail.tsx b/src/pages/ProductDetail.tsx index 959ace6..ab0ac1d 100644 --- a/src/pages/ProductDetail.tsx +++ b/src/pages/ProductDetail.tsx @@ -467,7 +467,7 @@ export default function ProductDetail() { className={`flex items-start gap-2 py-1 px-2 text-xs text-muted-foreground rounded transition-colors cursor-not-allowed opacity-60${isLastTimelineItem(lesson.chapters.length, chapterIndex) ? ' border-b-2 border-[#dedede] rounded-none' : ''}`} title="Beli bootcamp untuk mengakses materi ini" > - + {formatChapterTime(chapter.time)}