"use client"; import { useState, useEffect } from "react"; import { useParams } from "next/navigation"; import Link from "next/link"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { PlusCircle, Users, Wand2, ArrowLeft, Loader2 } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { toast } from "sonner"; // Mock project data const getProjectData = (id: string) => { return { id: parseInt(id), name: "Projet Formation Dev Web", description: "Création de groupes pour la formation développement web", date: "2025-05-15", groups: [ { id: 1, name: "Groupe A", persons: [ { id: 1, name: "Jean Dupont", tags: ["Frontend", "React", "Junior"] }, { id: 2, name: "Marie Martin", tags: ["Backend", "Node.js", "Senior"] }, { id: 3, name: "Pierre Durand", tags: ["Fullstack", "JavaScript", "Medior"] }, { id: 4, name: "Sophie Lefebvre", tags: ["UX/UI", "Design", "Senior"] }, ] }, { id: 2, name: "Groupe B", persons: [ { id: 5, name: "Thomas Bernard", tags: ["Backend", "Java", "Senior"] }, { id: 6, name: "Julie Petit", tags: ["Frontend", "Vue", "Junior"] }, { id: 7, name: "Nicolas Moreau", tags: ["DevOps", "Docker", "Medior"] }, { id: 8, name: "Emma Dubois", tags: ["Frontend", "Angular", "Junior"] }, ] }, { id: 3, name: "Groupe C", persons: [ { id: 9, name: "Lucas Leroy", tags: ["Backend", "Python", "Medior"] }, { id: 10, name: "Camille Roux", tags: ["Fullstack", "TypeScript", "Senior"] }, { id: 11, name: "Hugo Fournier", tags: ["Frontend", "React", "Medior"] }, { id: 12, name: "Léa Girard", tags: ["UX/UI", "Figma", "Junior"] }, ] }, { id: 4, name: "Groupe D", persons: [ { id: 13, name: "Mathis Bonnet", tags: ["Backend", "PHP", "Junior"] }, { id: 14, name: "Chloé Lambert", tags: ["Frontend", "CSS", "Senior"] }, { id: 15, name: "Nathan Mercier", tags: ["DevOps", "Kubernetes", "Senior"] }, { id: 16, name: "Zoé Faure", tags: ["Fullstack", "MERN", "Medior"] }, ] } ], persons: [ { id: 1, name: "Jean Dupont", tags: ["Frontend", "React", "Junior"] }, { id: 2, name: "Marie Martin", tags: ["Backend", "Node.js", "Senior"] }, { id: 3, name: "Pierre Durand", tags: ["Fullstack", "JavaScript", "Medior"] }, { id: 4, name: "Sophie Lefebvre", tags: ["UX/UI", "Design", "Senior"] }, { id: 5, name: "Thomas Bernard", tags: ["Backend", "Java", "Senior"] }, { id: 6, name: "Julie Petit", tags: ["Frontend", "Vue", "Junior"] }, { id: 7, name: "Nicolas Moreau", tags: ["DevOps", "Docker", "Medior"] }, { id: 8, name: "Emma Dubois", tags: ["Frontend", "Angular", "Junior"] }, { id: 9, name: "Lucas Leroy", tags: ["Backend", "Python", "Medior"] }, { id: 10, name: "Camille Roux", tags: ["Fullstack", "TypeScript", "Senior"] }, { id: 11, name: "Hugo Fournier", tags: ["Frontend", "React", "Medior"] }, { id: 12, name: "Léa Girard", tags: ["UX/UI", "Figma", "Junior"] }, { id: 13, name: "Mathis Bonnet", tags: ["Backend", "PHP", "Junior"] }, { id: 14, name: "Chloé Lambert", tags: ["Frontend", "CSS", "Senior"] }, { id: 15, name: "Nathan Mercier", tags: ["DevOps", "Kubernetes", "Senior"] }, { id: 16, name: "Zoé Faure", tags: ["Fullstack", "MERN", "Medior"] }, ] }; }; export default function ProjectGroupsPage() { const params = useParams(); const projectId = params.id as string; const [project, setProject] = useState(null); const [loading, setLoading] = useState(true); const [activeTab, setActiveTab] = useState("existing"); useEffect(() => { // Simulate API call to fetch project data const fetchProject = async () => { setLoading(true); try { // In a real app, this would be an API call await new Promise(resolve => setTimeout(resolve, 1000)); const data = getProjectData(projectId); setProject(data); } catch (error) { console.error("Error fetching project:", error); toast.error("Erreur lors du chargement du projet"); } finally { setLoading(false); } }; fetchProject(); }, [projectId]); const handleCreateGroups = async () => { toast.success("Redirection vers la page de création de groupes"); // In a real app, this would redirect to the group creation page }; const handleAutoCreateGroups = async () => { toast.success("Redirection vers l'assistant de création automatique de groupes"); // In a real app, this would redirect to the automatic group creation page }; if (loading) { return (
); } if (!project) { return (

Projet non trouvé

); } return (

{project.name} - Groupes

Groupes existants Créer des groupes {project.groups.length === 0 ? ( Aucun groupe Ce projet ne contient pas encore de groupes. Créez-en un maintenant. ) : (
{project.groups.map((group: any) => ( {group.name} {group.persons.length} personnes
{group.persons.map((person: any) => (

{person.name}

{person.tags.map((tag: string, index: number) => ( {tag} ))}
))}
))}
)}
Création manuelle Créez des groupes manuellement en glissant-déposant les personnes

Utilisez l'interface de glisser-déposer pour créer vos groupes selon vos critères

Création automatique Laissez l'assistant créer des groupes équilibrés automatiquement

L'assistant prendra en compte les tags et niveaux pour créer des groupes équilibrés

); }