diff --git a/client/pages/community/MentorProfile.tsx b/client/pages/community/MentorProfile.tsx new file mode 100644 index 00000000..77248de8 --- /dev/null +++ b/client/pages/community/MentorProfile.tsx @@ -0,0 +1,107 @@ +import Layout from "@/components/Layout"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { useEffect, useMemo, useState } from "react"; +import { useNavigate, useParams } from "react-router-dom"; +import { aethexSocialService } from "@/lib/aethex-social-service"; + +interface MentorRow { + user_id: string; + bio: string | null; + expertise: string[] | null; + available: boolean; + hourly_rate: number | null; + user_profiles?: { + id: string; + full_name: string | null; + username: string | null; + avatar_url: string | null; + bio: string | null; + } | null; +} + +export default function MentorProfile() { + const { username } = useParams<{ username: string }>(); + const navigate = useNavigate(); + const [mentor, setMentor] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + const load = async () => { + setLoading(true); + try { + const rows = (await aethexSocialService.listMentors({ q: username, limit: 50 })) as MentorRow[]; + const found = rows.find((r) => (r.user_profiles?.username || "").toLowerCase() === (username || "").toLowerCase()); + setMentor(found || null); + } catch { + setMentor(null); + } finally { + setLoading(false); + } + }; + load(); + }, [username]); + + const displayName = useMemo(() => mentor?.user_profiles?.full_name || mentor?.user_profiles?.username || "Mentor", [mentor]); + + return ( + +
+
+ Mentorship +

{loading ? "Loading…" : displayName}

+ {!loading && ( +

{mentor?.user_profiles?.bio || mentor?.bio || "Mentor profile"}

+ )} +
+ + {loading && ( + Loading profile… + )} + + {!loading && !mentor && ( + Mentor not found. + )} + + {!loading && mentor && ( +
+ + + About + Background and focus areas + + + {mentor.bio &&

{mentor.bio}

} +
+ {(mentor.expertise || []).map((tag) => ( + {tag} + ))} +
+
+
+ + + + Booking + Availability and rate + + +
+
Availability: {mentor.available ? "Accepting requests" : "Unavailable"}
+ {typeof mentor.hourly_rate === "number" && ( +
Rate: ${mentor.hourly_rate}/hr
+ )} +
+
+ + +
+
+
+
+ )} +
+
+ ); +}