"use client"; import React, { useEffect, useState } from "react"; import { useParams } from "next/navigation"; import { lmsApi, PublicProfile } from "@/lib/api"; import { Award, BookOpen, Zap, ShieldCheck, Globe, Linkedin, Github, UserCircle } from "lucide-react"; export default function StudentPortfolioPage() { const { id } = useParams(); const [profile, setProfile] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { const loadProfile = async () => { try { const data = await lmsApi.getPublicProfile(id as string); setProfile(data); } catch (err: any) { setError(err.message || "Failed to load profile"); } finally { setLoading(false); } }; if (id) loadProfile(); }, [id]); if (loading) return
Loading portfolio...
; if (error) return
{error}
; if (!profile) return null; return (
{/* Hero Section / Profile Header */}
{profile.avatar_url ? ( {profile.full_name} ) : (
)}

{profile.full_name}

Level {profile.level} Apprentice • {profile.xp} XP

{/* Left Column: Bio & Stats */}

About Me

{profile.bio || "No biography provided. This student is focused on mastering their craft."}

Global Stats

Courses Finished
{profile.completed_courses_count}
Badges Earned
{profile.badges.length}
Global Rank
Top 5%
{/* Right Column: Badges & Showcase */}

Credentials & Badges

VERIFIED BY OPENCCB
{profile.badges.map((badge: any) => (
{badge.name} { const target = e.target as any; target.src = "https://cdn-icons-png.flaticon.com/512/10636/10636665.png"; }} />

{badge.name}

{badge.description}

))}
{profile.badges.length === 0 && (

This student hasn't collected any badges yet.

)}
); }