diff --git a/src/pages/content-management/ReorderContentPage.tsx b/src/pages/content-management/ReorderContentPage.tsx index 22bb6fb..300db6a 100644 --- a/src/pages/content-management/ReorderContentPage.tsx +++ b/src/pages/content-management/ReorderContentPage.tsx @@ -10,45 +10,50 @@ export function ReorderContentPage() { const [tab, setTab] = useState("learn_english"); return ( -
-
- +
+
+ -
-

- Reorder Content -

-

- Drag and drop items to change their display order. Changes are saved - automatically when you drop an item. -

-
+
+
+

+ Reorder Content +

+

+ Drag and drop to change order. Changes save automatically on drop. +

+
-
- - +
+ + +
diff --git a/src/pages/content-management/components/ContentHierarchyList.tsx b/src/pages/content-management/components/ContentHierarchyList.tsx index c2721d6..f752953 100644 --- a/src/pages/content-management/components/ContentHierarchyList.tsx +++ b/src/pages/content-management/components/ContentHierarchyList.tsx @@ -33,7 +33,6 @@ import { RotateCcw, Edit2, Trash2, - Image as ImageIcon, Loader2, } from "lucide-react"; import { cn } from "../../../lib/utils"; @@ -113,23 +112,22 @@ function SortableItem({ ref={setNodeRef} style={style} className={cn( - "flex items-center justify-between px-4 py-3 border border-grayScale-200 rounded-[6px] mb-2 bg-white dark:bg-grayScale-50 transition-all duration-200 group/item", - isDragging && "opacity-50 border-dashed z-50 shadow-sm", + "group/item mb-1 flex items-center justify-between rounded border border-grayScale-200 bg-white px-2 py-1.5 transition-all duration-150 dark:bg-grayScale-50", + isDragging && "z-50 border-dashed opacity-50 shadow-sm", !isDragging && "hover:border-brand-200 hover:shadow-sm", )} > -
+
-
- {/* Thumbnail/Icon Container */} -
+
+
{thumbnail ? ( ) : ( -
+
{icon}
)}
-
- - {name} - -
+ + {name} +
-
- - -
+ {(onEdit || onDelete) && ( +
+ {onEdit ? ( + + ) : null} + {onDelete ? ( + + ) : null} +
+ )}
); } @@ -216,7 +218,7 @@ export function DraggableList({ onDragEnd={handleDragEnd} > -
+
{items.map((item) => ( {activeItem ? ( -
-
-
- -
-
-
- {activeItem.thumbnail ? ( - {activeItem.name} - ) : ( -
{icon}
- )} -
- - {activeItem.name} - -
+
+ +
+ {activeItem.thumbnail ? ( + {activeItem.name} + ) : ( +
{icon}
+ )}
+ + {activeItem.name} +
) : null} @@ -277,18 +273,18 @@ export function HierarchySection({ children, }: SectionProps) { return ( -
+
-
-
{children}
-
+ {isOpen ? ( +
{children}
+ ) : null}
); } @@ -559,36 +550,35 @@ export function ContentHierarchyList() { }; return ( -
-
-
-

+
+
+
+

Content Hierarchy

-

- Manage the ordering and structure of your educational content +

+ Drag items to reorder Learn English content

-
- {/* Program Section */} +
} + icon={} isOpen={openSections.program} onToggle={() => toggleSection("program")} > {loading.program ? ( -
- +
+
) : ( void handleProgramReorder(active, over) } - icon={} + icon={} onEdit={(id) => handleEdit("program", id)} onDelete={(id) => handleDelete("program", id)} /> )} - {/* Course Section */} } + icon={} isOpen={openSections.course} onToggle={() => toggleSection("course")} > {loading.course ? ( -
- +
+
) : ( programs.map((program) => { @@ -621,8 +610,8 @@ export function ContentHierarchyList() { ); if (programCourses.length === 0) return null; return ( -
-

+
+

{program.name}

void handleCourseReorder(program.id, active, over) } - icon={} + icon={} onEdit={(id) => handleEdit("course", id)} onDelete={(id) => handleDelete("course", id)} /> @@ -640,16 +629,15 @@ export function ContentHierarchyList() { )} - {/* Module Section */} } + icon={} isOpen={openSections.module} onToggle={() => toggleSection("module")} > {loading.module ? ( -
- +
+
) : ( courses.map((course) => { @@ -658,8 +646,8 @@ export function ContentHierarchyList() { ); if (courseModules.length === 0) return null; return ( -
-

+
+

{course.name}

void handleModuleReorder(course.id, active, over) } - icon={} + icon={} onEdit={(id) => handleEdit("module", id)} onDelete={(id) => handleDelete("module", id)} /> @@ -677,16 +665,15 @@ export function ContentHierarchyList() { )} - {/* Lesson Section */} } + icon={} isOpen={openSections.lesson} onToggle={() => toggleSection("lesson")} > {loading.lesson ? ( -
- +
+
) : ( modules.map((module) => { @@ -695,8 +682,8 @@ export function ContentHierarchyList() { ); if (moduleLessons.length === 0) return null; return ( -
-

+
+

{module.name}

void handleLessonReorder(module.id, active, over) } - icon={} + icon={} onEdit={(id) => handleEdit("lesson", id)} onDelete={(id) => handleDelete("lesson", id)} /> diff --git a/src/pages/content-management/components/ExamPrepContentHierarchyList.tsx b/src/pages/content-management/components/ExamPrepContentHierarchyList.tsx index 5d38ab6..77aa672 100644 --- a/src/pages/content-management/components/ExamPrepContentHierarchyList.tsx +++ b/src/pages/content-management/components/ExamPrepContentHierarchyList.tsx @@ -250,63 +250,63 @@ export function ExamPrepContentHierarchyList() { } return ( -
-
-
-

- Exam prep hierarchy +
+
+
+

+ Duolingo/IELTS hierarchy

-

- Catalog courses, units, modules, and lessons (IELTS, Duolingo, etc.) +

+ Drag items to reorder catalog courses, units, modules, and lessons

-
+
} + icon={} isOpen={openSections.catalogCourse} onToggle={() => toggleSection("catalogCourse")} > {loading.catalogCourse ? ( -
- +
+
) : ( void handleCatalogCourseReorder(active, over)} - icon={} + icon={} /> )} } + icon={} isOpen={openSections.unit} onToggle={() => toggleSection("unit")} > {loading.unit ? ( -
- +
+
) : ( catalogCourses.map((course) => { const courseUnits = units.filter((u) => u.catalogCourseId === course.id) if (courseUnits.length === 0) return null return ( -
-

+
+

{course.name}

void handleUnitReorder(course.id, active, over) } - icon={} + icon={} />
) @@ -324,21 +324,21 @@ export function ExamPrepContentHierarchyList() { } + icon={} isOpen={openSections.module} onToggle={() => toggleSection("module")} > {loading.module ? ( -
- +
+
) : ( units.map((unit) => { const unitModules = modules.filter((m) => m.unitId === unit.id) if (unitModules.length === 0) return null return ( -
-

+
+

{unit.name}

void handleModuleReorder(unit.id, active, over) } - icon={} + icon={} />
) @@ -356,21 +356,21 @@ export function ExamPrepContentHierarchyList() { } + icon={} isOpen={openSections.lesson} onToggle={() => toggleSection("lesson")} > {loading.lesson ? ( -
- +
+
) : ( modules.map((module) => { const moduleLessons = lessons.filter((l) => l.moduleId === module.id) if (moduleLessons.length === 0) return null return ( -
-

+
+

{module.name}

void handleLessonReorder(module.id, active, over) } - icon={} + icon={} />
)