Fix curriculum editor chapters persisting across lessons

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 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-01-04 15:05:01 +07:00
parent 8d40a8cb29
commit 47a645520c
3 changed files with 3 additions and 2 deletions

View File

@@ -194,6 +194,7 @@ export function CurriculumEditor({ productId }: CurriculumEditorProps) {
mp4_url: '',
video_host: 'youtube',
release_at: '',
chapters: [],
});
setLessonDialogOpen(true);
};

View File

@@ -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;
}
}

View File

@@ -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"
>
<span className="font-mono w-10 text-center">
<span className="font-mono w-12 text-center">
{formatChapterTime(chapter.time)}
</span>
<span className="flex-1" dangerouslySetInnerHTML={{ __html: chapter.title }} />