"use client"; import { useEffect, useState } from "react"; import { useEvaluation } from "@/hooks/use-evaluation"; import { ProfileForm } from "@/components/profile-form"; import { SkillsRadarChart } from "@/components/radar-chart"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { generateRadarData } from "@/lib/evaluation-utils"; import { useUser } from "@/hooks/use-user-context"; import { getTechIcon } from "@/components/icons/tech-icons"; import Link from "next/link"; import { Code2, ChevronDown, ChevronRight, ExternalLink } from "lucide-react"; import { getCategoryIcon } from "@/lib/category-icons"; export default function HomePage() { const { userEvaluation, skillCategories, teams, loading, updateProfile } = useEvaluation(); const { setUserInfo } = useUser(); const [expandedCategory, setExpandedCategory] = useState(null); // Update user info in navigation when user evaluation is loaded useEffect(() => { if (userEvaluation) { const teamName = teams.find((t) => t.id === userEvaluation.profile.teamId)?.name || ""; setUserInfo({ firstName: userEvaluation.profile.firstName, lastName: userEvaluation.profile.lastName, teamName, }); } else { setUserInfo(null); } }, [userEvaluation, teams, setUserInfo]); if (loading) { return (

Chargement...

); } if (!userEvaluation) { return (

Bienvenue sur PeakSkills

Évaluez vos compétences techniques et suivez votre progression

); } const radarData = generateRadarData( userEvaluation.evaluations, skillCategories ); return (
{/* Background Effects */}
{/* Header */}
Tableau de bord

Bonjour {userEvaluation.profile.firstName} !

Voici un aperçu de vos compétences techniques

{/* Main Content Grid */}
{/* Radar Chart */}

Vue d'ensemble de vos compétences

Radar chart représentant votre niveau par catégorie

{/* Category Breakdown */}

Détail par catégorie

Vue détaillée de votre progression dans chaque domaine

{radarData.map((category) => { const categoryEval = userEvaluation.evaluations.find( (e) => e.category === category.category ); const skillsCount = categoryEval?.selectedSkillIds?.length || 0; const evaluatedCount = categoryEval?.skills.filter((s) => s.level !== null).length || 0; const isExpanded = expandedCategory === category.category; const currentSkillCategory = skillCategories.find( (sc) => sc.category === category.category ); const CategoryIcon = currentSkillCategory ? getCategoryIcon(currentSkillCategory.icon) : null; return (
setExpandedCategory( isExpanded ? null : category.category ) } >
{isExpanded ? ( ) : ( )} {CategoryIcon && ( )}

{category.category}

{category.score.toFixed(1)}/3
{evaluatedCount}/{skillsCount} compétences sélectionnées évaluées
{/* Expanded Skills */} {isExpanded && categoryEval && currentSkillCategory && (
{categoryEval.selectedSkillIds.map((skillId) => { const skill = currentSkillCategory.skills.find( (s) => s.id === skillId ); if (!skill) return null; const skillEval = categoryEval.skills.find( (s) => s.skillId === skillId ); const TechIcon = getTechIcon(skill.id); return (
{skill.name}
{skillEval?.level && ( {skillEval.level === "never" && "Jamais utilisé"} {skillEval.level === "not-autonomous" && "Non autonome"} {skillEval.level === "autonomous" && "Autonome"} {skillEval.level === "expert" && "Expert"} )}
); })}
)}
); })}
{/* Action Button */}
); }