diff --git a/src/api/courses.api.ts b/src/api/courses.api.ts index 57fc5a2..fd31883 100644 --- a/src/api/courses.api.ts +++ b/src/api/courses.api.ts @@ -217,8 +217,41 @@ export const removeSubCoursePrerequisite = (subCourseId: number, prerequisiteId: export const getLearningPath = (courseId: number) => http.get(`/course-management/courses/${courseId}/learning-path`) -export const reorderSubCourses = (courseId: number, items: ReorderItem[]) => - http.put(`/course-management/courses/${courseId}/reorder-sub-courses`, { items }) +const buildReorderPayload = (items: ReorderItem[]) => { + const normalized = items.map((item, idx) => ({ + id: Number(item.id), + position: Number(item.position ?? idx), + })) + + const hasInvalid = normalized.some( + (item) => + Number.isNaN(item.id) || + Number.isNaN(item.position) || + !Number.isFinite(item.id) || + !Number.isFinite(item.position), + ) + + if (hasInvalid) { + throw new Error("Invalid reorder payload: ids/positions must be numeric.") + } + + return { items: normalized } +} + +export const reorderCategories = (items: ReorderItem[]) => + http.put("/course-management/categories/reorder", buildReorderPayload(items)) + +export const reorderCourses = (items: ReorderItem[]) => + http.put("/course-management/courses/reorder", buildReorderPayload(items)) + +export const reorderSubCourses = (items: ReorderItem[]) => + http.put("/course-management/sub-courses/reorder", buildReorderPayload(items)) + +export const reorderVideos = (items: ReorderItem[]) => + http.put("/course-management/videos/reorder", buildReorderPayload(items)) + +export const reorderPractices = (items: ReorderItem[]) => + http.put("/course-management/practices/reorder", buildReorderPayload(items)) // Ratings export const getRatings = (params: GetRatingsParams) => diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index c6ebbd2..ae41fe9 100644 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -272,20 +272,34 @@ export function ProfilePage() { const completionPct = profile.profile_completion_percentage ?? 0; return ( -
+
{/* ─── Hero Card ─── */} -
+
{/* Tall dark gradient banner with content inside */} -
+

Hello {profile.first_name}

-

- This is your profile page. You can see the progress you've made with your work and manage your projects or assigned tasks +

+ Track your account status, keep profile details up to date, and manage your learning preferences from one place.

+
+ + + {profile.role} + + + + Last login {formatDate(profile.last_login)} + + + + {completionPct}% complete + +
@@ -293,7 +307,7 @@ export function ProfilePage() {
{/* Identity info below banner */} -
+
{editing ? (
{/* ── Contact & Personal ── */} - +
@@ -569,9 +583,9 @@ export function ProfilePage() { {/* ── Right Sidebar ── */} -
+
{/* Profile Completion */} - +
@@ -585,7 +599,7 @@ export function ProfilePage() { {/* Activity */} - +

@@ -613,7 +627,7 @@ export function ProfilePage() { {/* Quick Account Info */} - +

@@ -675,8 +689,13 @@ export function ProfilePage() {

{/* ─── Learning & Goals Card ─── */} - +
+
+

+ Learning & Preferences +

+
diff --git a/src/pages/content-management/AddNewPracticePage.tsx b/src/pages/content-management/AddNewPracticePage.tsx index e571c23..0ae8876 100644 --- a/src/pages/content-management/AddNewPracticePage.tsx +++ b/src/pages/content-management/AddNewPracticePage.tsx @@ -889,7 +889,7 @@ export function AddNewPracticePage() { className="w-full bg-brand-500 hover:bg-brand-600" onClick={() => navigate(`/content/category/${categoryId}/courses/${courseId}/sub-courses/${subCourseId}`)} > - Go back to Sub-course + Go back to Course
-

Loading all courses…

+

Loading all sub-categories…

) } @@ -216,9 +216,9 @@ export function AllCoursesPage() { {/* Header */}
-

All Courses

+

All Sub-categories

- View and manage courses across all categories. + View and manage sub-categories across all categories.

- Course Management + Sub-category Management @@ -375,9 +375,9 @@ export function AllCoursesPage() {
-

No courses found

+

No sub-categories found

- Try adjusting your search or category filter, or create a new course. + Try adjusting your search or category filter, or create a new sub-category.

)} @@ -388,7 +388,7 @@ export function AllCoursesPage() { - Create course + Create sub-category Choose a category, add basic details, and optionally attach a thumbnail and intro video. @@ -439,7 +439,7 @@ export function AllCoursesPage() {