"use client" import { useState, useEffect } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { FileText, Folder, Users, Activity, TrendingUp, Clock, Shield, AlertCircle, CheckCircle, Download, Upload, Search, Plus, MoreHorizontal, Edit, Share2, TestTube, Zap, HardDrive, X, } from "lucide-react" import MessageBus from "@/lib/4nk/MessageBus" import Link from "next/link" export default function DashboardPage() { const [isMockMode, setIsMockMode] = useState(false) const [stats, setStats] = useState({ totalDocuments: 0, totalFolders: 0, totalUsers: 0, storageUsed: 0, storageLimit: 100, recentActivity: 0, // Nouveaux indicateurs permanentStorage: 0, permanentStorageLimit: 1000, // 1 To en Go temporaryStorage: 0, temporaryStorageLimit: 100, // 100 Go newFoldersThisMonth: 0, newFoldersLimit: 75, tokensUsed: 0, tokensTotal: 1000, }) const [recentDocuments, setRecentDocuments] = useState([]) const [recentActivity, setRecentActivity] = useState([]) const [notifications, setNotifications] = useState([]) useEffect(() => { const iframeUrl = process.env.NEXT_PUBLIC_4NK_IFRAME_URL || "https://dev3.4nkweb.com" const messageBus = MessageBus.getInstance(iframeUrl) // const mockMode = messageBus.isInMockMode() // setIsMockMode(mockMode) // Simuler le chargement des données if (true) { setStats({ totalDocuments: 1247, totalFolders: 89, totalUsers: 12, storageUsed: 67.3, storageLimit: 100, recentActivity: 24, // Nouveaux indicateurs avec données réalistes permanentStorage: 673, // 673 Go utilisés sur 1000 Go permanentStorageLimit: 1000, temporaryStorage: 45, // 45 Go utilisés sur 100 Go temporaryStorageLimit: 100, newFoldersThisMonth: 23, // 23 nouveaux dossiers ce mois newFoldersLimit: 75, tokensUsed: 673, // Environ 67% des jetons utilisés tokensTotal: 1000, }) setRecentDocuments([ { id: "doc_001", name: "Contrat_Client_ABC_2024.pdf", type: "PDF", size: "2.4 MB", modifiedAt: "Il y a 2 heures", modifiedBy: "Marie Dubois", status: "Signé", folder: "Contrats 2024", }, { id: "doc_002", name: "Rapport_Financier_Q1.xlsx", type: "Excel", size: "1.8 MB", modifiedAt: "Il y a 4 heures", modifiedBy: "Jean Martin", status: "En révision", folder: "Finance", }, { id: "doc_003", name: "Présentation_Produit_V2.pptx", type: "PowerPoint", size: "15.2 MB", modifiedAt: "Hier", modifiedBy: "Sophie Laurent", status: "Finalisé", folder: "Marketing", }, { id: "doc_004", name: "Cahier_des_charges_Projet_X.docx", type: "Word", size: "892 KB", modifiedAt: "Il y a 2 jours", modifiedBy: "Pierre Durand", status: "Brouillon", folder: "Projets", }, { id: "doc_005", name: "Facture_2024_001.pdf", type: "PDF", size: "156 KB", modifiedAt: "Il y a 3 jours", modifiedBy: "Marie Dubois", status: "Payée", folder: "Comptabilité", }, ]) setRecentActivity([ { id: "act_001", type: "upload", user: "Marie Dubois", action: "a téléchargé", target: "Contrat_Client_ABC_2024.pdf", time: "Il y a 2 heures", icon: Upload, color: "text-green-600", }, { id: "act_002", type: "edit", user: "Jean Martin", action: "a modifié", target: "Rapport_Financier_Q1.xlsx", time: "Il y a 4 heures", icon: Edit, color: "text-blue-600", }, { id: "act_003", type: "share", user: "Sophie Laurent", action: "a partagé", target: "Présentation_Produit_V2.pptx", time: "Hier", icon: Share2, color: "text-purple-600", }, { id: "act_004", type: "create", user: "Pierre Durand", action: "a créé le dossier", target: "Projets 2024", time: "Il y a 2 jours", icon: Folder, color: "text-orange-600", }, { id: "act_005", type: "download", user: "Marie Dubois", action: "a téléchargé", target: "Facture_2024_001.pdf", time: "Il y a 3 jours", icon: Download, color: "text-indigo-600", }, ]) setNotifications([ { id: "notif_001", type: "success", title: "Document signé", message: "Le contrat ABC a été signé par toutes les parties", time: "Il y a 1 heure", icon: CheckCircle, color: "text-green-600", bgColor: "bg-green-50", }, { id: "notif_002", type: "warning", title: "Stockage temporaire élevé", message: "45 Go utilisés sur 100 Go de stockage temporaire ce mois", time: "Il y a 2 heures", icon: AlertCircle, color: "text-orange-600", bgColor: "bg-orange-50", }, { id: "notif_003", type: "info", title: "Nouvel utilisateur", message: "Thomas Petit a rejoint l'équipe Marketing", time: "Hier", icon: Users, color: "text-blue-600", bgColor: "bg-blue-50", }, ]) } }, []) const getFileIcon = (type: string) => { switch (type.toLowerCase()) { case "pdf": return "📄" case "excel": return "📊" case "powerpoint": return "📈" case "word": return "📝" default: return "📄" } } const getStatusColor = (status: string) => { switch (status.toLowerCase()) { case "signé": case "finalisé": case "payée": return "bg-green-100 text-green-800" case "en révision": return "bg-orange-100 text-orange-800" case "brouillon": return "bg-gray-100 text-gray-800" default: return "bg-blue-100 text-blue-800" } } return (
{/* En-tête */}

Tableau de bord

Vue d'ensemble de votre espace documentaire sécurisé

{isMockMode && ( Données de démonstration )}
{/* Statistiques principales */}
{/* SUPPRIMER les cartes Documents, Dossiers, Collaborateurs */} {/* Conserver uniquement les autres indicateurs utiles (ex : Jetons utilisés, stockage, etc.) */}
{/* Nouveaux indicateurs de stockage */}
Stockage permanent
{stats.permanentStorage} Go

{stats.permanentStorage} Go / {stats.permanentStorageLimit} Go (1 To)

Stockage temporaire
{stats.temporaryStorage} Go
80 ? "bg-red-600" : stats.temporaryStorage > 60 ? "bg-orange-600" : "bg-green-600" }`} style={{ width: `${(stats.temporaryStorage / stats.temporaryStorageLimit) * 100}%` }} >

{stats.temporaryStorage} Go / {stats.temporaryStorageLimit} Go ce mois

Nouveaux dossiers
{stats.newFoldersThisMonth}

{stats.newFoldersThisMonth} / {stats.newFoldersLimit} ce mois

{/* Documents récents */} Documents récents
{recentDocuments.map((doc) => (
{getFileIcon(doc.type)}

{doc.name}

{doc.folder} {doc.size} {doc.modifiedAt}
{doc.status}
))}
{/* Activité récente */} Activité récente
{recentActivity.map((activity) => (

{activity.user} {activity.action}{" "} {activity.target}

{activity.time}

))}
{/* Sécurité */} Statut de sécurité

Sécurité optimale

Tous vos documents sont chiffrés et sécurisés par la technologie 4NK

Chiffrement bout en bout

Authentification 4NK

Audit complet

) }