diff --git a/client/pages/dashboards/FoundationDashboard.tsx b/client/pages/dashboards/FoundationDashboard.tsx index e95ddb1c..59a746c9 100644 --- a/client/pages/dashboards/FoundationDashboard.tsx +++ b/client/pages/dashboards/FoundationDashboard.tsx @@ -28,6 +28,9 @@ import { ArrowRight, Zap, } from "lucide-react"; +import { CoursesWidget } from "@/components/CoursesWidget"; +import { MentorshipWidget } from "@/components/MentorshipWidget"; +import { AchievementsWidget } from "@/components/AchievementsWidget"; const API_BASE = import.meta.env.VITE_API_BASE || ""; @@ -191,228 +194,111 @@ export default function FoundationDashboard() { {/* Overview Tab */} - {/* Active Mentorship */} - {activeMentor ? ( - - - - - Your Mentor - - - -
- {activeMentor.mentor?.full_name} -
-

{activeMentor.mentor?.full_name}

-

Connected since {new Date(activeMentor.accepted_at).toLocaleDateString()}

- -
-
-
-
- ) : ( - - - - - Find a Mentor - - - -

- Having a mentor accelerates your learning. Browse mentors in your field and request guidance. -

- -
-
- )} + {/* Mentorship Widget */} + ({ + id: m.id, + mentor: { + id: m.mentor?.id, + name: m.mentor?.full_name, + avatar: m.mentor?.avatar_url, + expertise: m.mentor?.role_title, + }, + status: m.status, + connectedSince: m.accepted_at ? new Date(m.accepted_at).toLocaleDateString() : null, + lastSession: m.last_session_date, + nextSession: m.next_session_date, + }))} + title="Your Mentorship" + description="Connect with industry experts" + accentColor="red" + onFindMentor={() => navigate("/mentors")} + /> - {/* Recent Courses */} - - - Continue Learning - Resume your courses - - - {enrolledCourses.length === 0 ? ( -
- -

No courses yet. Browse our curriculum!

- -
- ) : ( -
- {enrolledCourses.slice(0, 4).map((course: any) => ( -
navigate(`/courses/${course.id}`)} - > -
-

{course.title}

- -
-

{course.category}

-
-
-
-

{course.userEnrollment?.progress_percent || 0}% complete

-
- ))} -
- )} - - + {/* Courses Widget */} + ({ + id: c.id, + title: c.title, + description: c.description, + category: c.category, + progress: c.userEnrollment?.progress_percent || 0, + status: c.userEnrollment?.status || "not_started", + duration: c.duration, + lessons_total: c.lessons_total, + lessons_completed: c.userEnrollment?.lessons_completed || 0, + instructor: c.instructor?.full_name, + thumbnail_url: c.thumbnail_url, + }))} + title="Continue Learning" + description="Resume your courses" + accentColor="red" + onViewCourse={(courseId) => navigate(`/courses/${courseId}`)} + /> {/* Courses Tab */} - - - My Courses - All your enrollments - - - {enrolledCourses.length === 0 ? ( -
- -

Not enrolled in any courses yet

- -
- ) : ( -
- {enrolledCourses.map((course: any) => ( -
-
-
-

{course.title}

-

{course.description?.substring(0, 80)}...

-
- - {course.userEnrollment?.status} - -
-
-
- Progress - {course.userEnrollment?.progress_percent || 0}% -
-
-
-
-
-
- ))} -
- )} - - + ({ + id: c.id, + title: c.title, + description: c.description, + category: c.category, + progress: c.userEnrollment?.progress_percent || 0, + status: c.userEnrollment?.status || "not_started", + duration: c.duration, + lessons_total: c.lessons_total, + lessons_completed: c.userEnrollment?.lessons_completed || 0, + instructor: c.instructor?.full_name, + thumbnail_url: c.thumbnail_url, + }))} + title="My Courses" + description="All your enrollments" + accentColor="red" + onViewCourse={(courseId) => navigate(`/courses/${courseId}`)} + /> {/* Mentorship Tab */} - - - Mentorship - Your mentor relationships - - - {mentorships.length === 0 ? ( -
- -

No mentors yet

- -
- ) : ( -
- {mentorships.map((m: any) => ( -
-
-
- {m.mentor?.full_name} -
-

{m.mentor?.full_name}

-

{m.mentor?.email}

-
-
- {m.status} -
-
- ))} -
- )} -
-
+ ({ + id: m.id, + mentor: { + id: m.mentor?.id, + name: m.mentor?.full_name, + avatar: m.mentor?.avatar_url, + expertise: m.mentor?.role_title, + }, + status: m.status, + connectedSince: m.accepted_at ? new Date(m.accepted_at).toLocaleDateString() : null, + lastSession: m.last_session_date, + nextSession: m.next_session_date, + }))} + title="Mentorship" + description="Your mentor relationships" + accentColor="red" + onFindMentor={() => navigate("/mentors")} + />
{/* Achievements Tab */} - - - Your Achievements - Badges earned through learning and growth - - - {achievements.length === 0 ? ( -
- -

Complete courses to earn achievements!

-
- ) : ( -
- {achievements.map((ach: any) => ( -
-
{ach.icon}
-

{ach.name}

-

{ach.category}

-
- ))} -
- )} -
-
+ ({ + id: a.id, + name: a.name, + description: a.description, + icon: a.icon, + rarity: a.rarity || "common", + earnedDate: a.earned_date, + category: a.category, + }))} + title="Your Achievements" + description="Badges earned through learning and growth" + accentColor="red" + />