MVP V 1.0 #1

Merged
Lars merged 58 commits from develop into main 2026-10-17 21:24:12 +02:00
Showing only changes of commit 94ef46d8eb - Show all commits
+5 -1
View File
@@ -623,10 +623,12 @@ export function ContentBoard({
const chapterIndex = chapters.findIndex((chapter) => chapter.id === section.id); const chapterIndex = chapters.findIndex((chapter) => chapter.id === section.id);
const expanded = !onlyChapter || section.id === onlyChapter; const expanded = !onlyChapter || section.id === onlyChapter;
const movable = canMoveChapters && section.id !== "loose"; const movable = canMoveChapters && section.id !== "loose";
const fromIndex = chapters.findIndex((chapter) => chapter.id === draggingId);
const classes = ["content-section"]; const classes = ["content-section"];
if (draggingId === section.id) classes.push("is-dragging"); if (draggingId === section.id) classes.push("is-dragging");
if (!expanded) classes.push("is-collapsed"); if (!expanded) classes.push("is-collapsed");
if (indicator?.kind === "chapter" && chapterIndex === indicator.index && draggingId !== section.id) classes.push("is-chapter-target"); const insertBefore = indicator?.kind === "chapter" && fromIndex > indicator.index && chapterIndex === indicator.index;
const insertAfter = indicator?.kind === "chapter" && fromIndex >= 0 && fromIndex < indicator.index && chapterIndex === indicator.index;
return ( return (
<section <section
key={section.id} key={section.id}
@@ -634,6 +636,7 @@ export function ContentBoard({
data-section={section.id} data-section={section.id}
data-chapter={section.id === "loose" ? undefined : section.id} data-chapter={section.id === "loose" ? undefined : section.id}
> >
{insertBefore ? <div className="insert-line" aria-hidden="true" /> : null}
{section.title ? ( {section.title ? (
<div <div
className={movable ? "chapter-head is-movable" : "chapter-head"} className={movable ? "chapter-head is-movable" : "chapter-head"}
@@ -745,6 +748,7 @@ export function ContentBoard({
})} })}
{indicator?.sectionId === section.id && indicator?.kind !== "chapter" && indicator.index === section.items.length ? <li className="insert-line" aria-hidden="true" /> : null} {indicator?.sectionId === section.id && indicator?.kind !== "chapter" && indicator.index === section.items.length ? <li className="insert-line" aria-hidden="true" /> : null}
</ol> : null} </ol> : null}
{insertAfter ? <div className="insert-line" aria-hidden="true" /> : null}
</section> </section>
); );
}) })