From 30f00f6991b7ccdb168a7ac545c7b2cf3d0b70e0 Mon Sep 17 00:00:00 2001 From: omaroughriss Date: Tue, 21 Oct 2025 11:42:22 +0200 Subject: [PATCH] Demock folder components --- app/dashboard/documents/page.tsx | 21 +-- app/dashboard/folders/page.tsx | 294 ++----------------------------- app/dashboard/layout.tsx | 9 +- app/dashboard/page.tsx | 56 ++---- 4 files changed, 31 insertions(+), 349 deletions(-) diff --git a/app/dashboard/documents/page.tsx b/app/dashboard/documents/page.tsx index c46de15..19280d6 100644 --- a/app/dashboard/documents/page.tsx +++ b/app/dashboard/documents/page.tsx @@ -188,14 +188,7 @@ export default function DocumentsPage() { }) const [folders] = useState([ - { id: "contracts", name: "Contrats" }, - { id: "reports", name: "Rapports" }, - { id: "projects", name: "Projets" }, - { id: "finance", name: "Finance" }, - { id: "policies", name: "Politiques" }, - { id: "training", name: "Formation" }, - { id: "assets", name: "Assets" }, - { id: "archives", name: "Archives" }, + { id: "general", name: "Général" }, ]) const [users] = useState([ @@ -205,8 +198,7 @@ export default function DocumentsPage() { email: "marie.dubois@company.com", avatar: "MD", folderRoles: { - contracts: { role: "owner", assignedDate: new Date("2024-01-01") }, - finance: { role: "editor", assignedDate: new Date("2024-01-05") }, + general: { role: "owner", assignedDate: new Date("2024-01-01") }, }, spaceRole: "manager", spaceRoles: { @@ -220,8 +212,7 @@ export default function DocumentsPage() { email: "sophie.laurent@company.com", avatar: "SL", folderRoles: { - reports: { role: "owner", assignedDate: new Date("2024-01-02") }, - projects: { role: "contributor", assignedDate: new Date("2024-01-10") }, + general: { role: "editor", assignedDate: new Date("2024-01-02") }, }, spaceRole: "user", spaceRoles: { @@ -235,8 +226,7 @@ export default function DocumentsPage() { email: "jean.martin@company.com", avatar: "JM", folderRoles: { - projects: { role: "owner", assignedDate: new Date("2024-01-03") }, - reports: { role: "viewer", assignedDate: new Date("2024-01-15") }, + general: { role: "viewer", assignedDate: new Date("2024-01-03") }, }, spaceRole: "user", spaceRoles: { @@ -250,8 +240,7 @@ export default function DocumentsPage() { email: "pierre.durand@company.com", avatar: "PD", folderRoles: { - training: { role: "owner", assignedDate: new Date("2024-01-04") }, - policies: { role: "validator", assignedDate: new Date("2024-01-08") }, + general: { role: "contributor", assignedDate: new Date("2024-01-04") }, }, spaceRole: "user", spaceRoles: { diff --git a/app/dashboard/folders/page.tsx b/app/dashboard/folders/page.tsx index dbd26a0..66a6c8b 100644 --- a/app/dashboard/folders/page.tsx +++ b/app/dashboard/folders/page.tsx @@ -74,7 +74,7 @@ interface FolderData { favorite: boolean storageType: "temporary" | "permanent" status: "active" | "archived" | "pending" | "completed" | "validated" - type: "contracts" | "reports" | "projects" | "finance" | "hr" | "marketing" | "legal" | "general" + type: string expectedDocuments: Array<{ name: string required: boolean @@ -151,7 +151,7 @@ interface Role { level: "folder" | "space" | "global" } -type FolderType = "contrat" | "projet" | "rapport" | "finance" | "rh" | "marketing"; +type FolderType = string; export default function FoldersPage() { const router = useRouter() @@ -392,265 +392,7 @@ export default function FoldersPage() { useEffect(() => { // Simuler le chargement des dossiers const loadFolders = () => { - const mockFolders: FolderData[] = [ - { - id: 1, - name: "Contrats", - description: "Tous les contrats clients et fournisseurs", - documentsCount: 45, - subfoldersCount: 3, - size: "125 MB", - created: new Date("2024-01-01T10:00:00"), - modified: new Date("2024-01-15T14:30:00"), - owner: "Marie Dubois", - access: "shared", - members: ["Marie Dubois", "Jean Martin", "Sophie Laurent"], - tags: ["juridique", "contrats", "clients"], - color: "blue", - favorite: true, - storageType: "permanent", - status: "active", - type: "contracts", - expectedDocuments: [ - { name: "Contrat cadre", required: true, assignedRole: "owner", status: "received" }, - { name: "Conditions générales", required: true, assignedRole: "validator", status: "received" }, - { name: "Annexes techniques", required: false, assignedRole: "editor", status: "missing" }, - { name: "Certificat d'assurance", required: true, assignedRole: "contributor", status: "pending" }, - ], - activity: [ - { user: "Marie Dubois", action: "ajouté", item: "Contrat_ABC.pdf", time: "Il y a 2h" }, - { user: "Jean Martin", action: "modifié", item: "Contrat_XYZ.pdf", time: "Il y a 5h" }, - ], - permissions: { - canView: true, - canEdit: true, - canDelete: true, - canInvite: true, - canArchive: false, - canAnalyze: true, - }, - temporaryStorageConfig: { - duration: 90, - dataUsage: "Contrats clients et négociations commerciales", - thirdPartyAccess: "Avocats externes, clients contractants", - }, - documents: [ - { id: "doc1", name: "Contrat_ABC.pdf", hasCertificate: true, certificateId: "CERT-DOC-001" }, - { id: "doc2", name: "Contrat_XYZ.pdf", hasCertificate: true, certificateId: "CERT-DOC-002" }, - { id: "doc3", name: "Annexe_A.pdf", hasCertificate: false }, - { id: "doc4", name: "Conditions_Generales.pdf", hasCertificate: true, certificateId: "CERT-DOC-003" }, - ], - }, - { - id: 2, - name: "Rapports", - description: "Rapports mensuels et analyses", - documentsCount: 28, - subfoldersCount: 2, - size: "89 MB", - created: new Date("2024-01-05T09:15:00"), - modified: new Date("2024-01-14T16:45:00"), - owner: "Sophie Laurent", - access: "private", - members: ["Sophie Laurent", "Pierre Durand"], - tags: ["rapports", "analyse", "mensuel"], - color: "green", - favorite: false, - storageType: "temporary", - status: "pending", - type: "reports", - expectedDocuments: [ - { name: "Rapport mensuel", required: true, assignedRole: "owner", status: "received" }, - { name: "Analyse KPI", required: true, assignedRole: "editor", status: "missing" }, - { name: "Graphiques", required: false, assignedRole: "contributor", status: "received" }, - ], - activity: [ - { user: "Sophie Laurent", action: "créé", item: "Rapport_Nov.docx", time: "Il y a 1j" }, - { user: "Pierre Durand", action: "consulté", item: "Analyse_Q4.xlsx", time: "Il y a 2j" }, - ], - permissions: { - canView: true, - canEdit: true, - canDelete: true, - canInvite: true, - canArchive: true, - canAnalyze: true, - }, - temporaryStorageConfig: { - duration: 30, - dataUsage: "Analyses de performance et rapports internes", - thirdPartyAccess: "Consultants externes, auditeurs", - }, - documents: [ - { id: "doc5", name: "Rapport_Nov.docx", hasCertificate: true, certificateId: "CERT-DOC-004" }, - { id: "doc6", name: "Analyse_Q4.xlsx", hasCertificate: false }, - ], - }, - { - id: 3, - name: "Projets", - description: "Documentation des projets en cours", - documentsCount: 67, - subfoldersCount: 8, - size: "234 MB", - created: new Date("2023-12-15T11:30:00"), - modified: new Date("2024-01-15T09:20:00"), - owner: "Jean Martin", - access: "shared", - members: ["Jean Martin", "Marie Dubois", "Sophie Laurent", "Pierre Durand"], - tags: ["projets", "développement", "documentation"], - color: "purple", - favorite: true, - storageType: "temporary", - status: "active", - type: "projects", - expectedDocuments: [ - { name: "Cahier des charges", required: true, assignedRole: "owner", status: "received" }, - { name: "Spécifications techniques", required: true, assignedRole: "editor", status: "received" }, - { name: "Planning projet", required: true, assignedRole: "validator", status: "received" }, - { name: "Budget prévisionnel", required: true, assignedRole: "contributor", status: "missing" }, - ], - activity: [ - { user: "Jean Martin", action: "partagé", item: "Specs_Alpha.pdf", time: "Il y a 3h" }, - { user: "Marie Dubois", action: "commenté", item: "Design_Beta.figma", time: "Il y a 6h" }, - ], - permissions: { - canView: true, - canEdit: true, - canDelete: true, - canInvite: true, - canArchive: true, - canAnalyze: true, - }, - documents: [ - { id: "doc7", name: "Specs_Alpha.pdf", hasCertificate: true, certificateId: "CERT-DOC-005" }, - { id: "doc8", name: "Design_Beta.figma", hasCertificate: false }, - { id: "doc9", name: "Planning.xlsx", hasCertificate: true, certificateId: "CERT-DOC-006" }, - ], - }, - { - id: 4, - name: "Finance", - description: "Documents financiers et budgets", - documentsCount: 32, - subfoldersCount: 4, - size: "156 MB", - created: new Date("2024-01-08T14:20:00"), - modified: new Date("2024-01-13T11:10:00"), - owner: "Marie Dubois", - access: "private", - members: ["Marie Dubois", "Admin"], - tags: ["finance", "budget", "comptabilité"], - color: "orange", - favorite: false, - storageType: "permanent", - status: "completed", - type: "finance", - expectedDocuments: [ - { name: "Budget annuel", required: true, assignedRole: "owner", status: "received" }, - { name: "Bilan comptable", required: true, assignedRole: "validator", status: "received" }, - { name: "Factures", required: true, assignedRole: "editor", status: "received" }, - ], - activity: [ - { user: "Marie Dubois", action: "mis à jour", item: "Budget_2024.xlsx", time: "Il y a 1j" }, - { user: "Admin", action: "vérifié", item: "Factures_Dec.pdf", time: "Il y a 2j" }, - ], - permissions: { - canView: true, - canEdit: true, - canDelete: true, - canInvite: true, - canArchive: false, - canAnalyze: true, - }, - documents: [ - { id: "doc10", name: "Budget_2024.xlsx", hasCertificate: true, certificateId: "CERT-DOC-007" }, - { id: "doc11", name: "Factures_Dec.pdf", hasCertificate: true, certificateId: "CERT-DOC-008" }, - ], - }, - { - id: 5, - name: "Ressources Humaines", - description: "Politiques RH et documents employés", - documentsCount: 19, - subfoldersCount: 2, - size: "67 MB", - created: new Date("2024-01-10T08:45:00"), - modified: new Date("2024-01-12T15:30:00"), - owner: "Admin Système", - access: "shared", - members: ["Admin", "Marie Dubois", "Sophie Laurent"], - tags: ["RH", "politique", "employés"], - color: "red", - favorite: false, - storageType: "temporary", - status: "archived", - type: "hr", - expectedDocuments: [ - { name: "Politique RH", required: true, assignedRole: "owner", status: "received" }, - { name: "Contrats employés", required: true, assignedRole: "validator", status: "received" }, - { name: "Formation", required: false, assignedRole: "editor", status: "missing" }, - ], - activity: [ - { user: "Admin", action: "ajouté", item: "Politique_Télétravail.pdf", time: "Il y a 3j" }, - { user: "Sophie Laurent", action: "lu", item: "Guide_Onboarding.docx", time: "Il y a 4j" }, - ], - permissions: { - canView: true, - canEdit: true, - canDelete: true, - canInvite: true, - canArchive: true, - canAnalyze: true, - }, - documents: [ - { id: "doc12", name: "Politique_Télétravail.pdf", hasCertificate: false }, - { id: "doc13", name: "Guide_Onboarding.docx", hasCertificate: true, certificateId: "CERT-DOC-009" }, - ], - }, - { - id: 6, - name: "Marketing", - description: "Matériel marketing et campagnes", - documentsCount: 41, - subfoldersCount: 5, - size: "198 MB", - created: new Date("2023-12-20T16:00:00"), - modified: new Date("2024-01-11T13:45:00"), - owner: "Pierre Durand", - access: "shared", - members: ["Pierre Durand", "Jean Martin", "Design Team"], - tags: ["marketing", "campagne", "design"], - color: "pink", - favorite: true, - storageType: "temporary", - status: "validated", - type: "marketing", - expectedDocuments: [ - { name: "Brief campagne", required: true, assignedRole: "owner", status: "received" }, - { name: "Créations visuelles", required: true, assignedRole: "editor", status: "pending" }, - { name: "Plan média", required: true, assignedRole: "contributor", status: "missing" }, - { name: "Budget marketing", required: false, assignedRole: "validator", status: "received" }, - ], - activity: [ - { user: "Pierre Durand", action: "uploadé", item: "Campagne_Q1.psd", time: "Il y a 4j" }, - { user: "Design Team", action: "approuvé", item: "Logo_V2.png", time: "Il y a 5j" }, - ], - permissions: { - canView: true, - canEdit: false, - canDelete: false, - canInvite: true, - canArchive: true, - canAnalyze: true, - }, - documents: [ - { id: "doc14", name: "Campagne_Q1.psd", hasCertificate: true, certificateId: "CERT-DOC-010" }, - { id: "doc15", name: "Logo_V2.png", hasCertificate: true, certificateId: "CERT-DOC-011" }, - { id: "doc16", name: "Brief_campagne.pdf", hasCertificate: false }, - ], - }, - ] + const mockFolders: FolderData[] = [] setFolders(mockFolders) setStats({ @@ -1250,16 +992,7 @@ export default function FoldersPage() { setActionModal({ type: null, folder: null, folders: [] }) } - const typeFilter = searchParams.get("type") as - | "contracts" - | "reports" - | "projects" - | "finance" - | "hr" - | "marketing" - | "legal" - | "general" - | null + const typeFilter = searchParams.get("type") const filteredFolders = folders .filter((folder) => { @@ -1447,15 +1180,12 @@ export default function FoldersPage() { {menuOpen && (
- {['contrat', 'projet', 'rapport', 'finance', 'rh', 'marketing'].map((type) => ( - - ))} +
)} @@ -2522,13 +2252,13 @@ export default function FoldersPage() { {/* Modal */} - {folderType && ( + {isModalOpen && ( )} diff --git a/app/dashboard/layout.tsx b/app/dashboard/layout.tsx index 49ff5b3..da9856f 100644 --- a/app/dashboard/layout.tsx +++ b/app/dashboard/layout.tsx @@ -49,14 +49,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod const pathname = usePathname() const navigation: Array<{ name: string; href: string; icon: any; type?: string }> = [ { name: "My work", href: "/dashboard", icon: LayoutDashboard }, - { name: "Contrats", href: "/dashboard/folders?type=contracts", icon: Folder, type: "contracts" }, - { name: "Rapports", href: "/dashboard/folders?type=reports", icon: Folder, type: "reports" }, - { name: "Projets", href: "/dashboard/folders?type=projects", icon: Folder, type: "projects" }, - { name: "Finance", href: "/dashboard/folders?type=finance", icon: Folder, type: "finance" }, - { name: "RH", href: "/dashboard/folders?type=hr", icon: Folder, type: "hr" }, - { name: "Marketing", href: "/dashboard/folders?type=marketing", icon: Folder, type: "marketing" }, - { name: "Juridique", href: "/dashboard/folders?type=legal", icon: Folder, type: "legal" }, - { name: "Général", href: "/dashboard/folders?type=general", icon: Folder, type: "general" }, + { name: "Dossier", href: "/dashboard/folders", icon: Folder }, ] // Appliquer le thème global dès le chargement (préférence stockée) diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 9550af2..05141ea 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -37,7 +37,7 @@ import EventBus from "@/lib/4nk/EventBus" import { iframeUrl } from "../page" import Iframe from "@/components/4nk/Iframe" -type FolderType = "contrat" | "projet" | "rapport" | "finance" | "rh" | "marketing"; +type FolderType = string; export default function DashboardPage() { const [notification, setNotification] = useState<{ type: "success" | "error" | "info"; message: string } | null>(null) @@ -106,47 +106,27 @@ export default function DashboardPage() { modifiedAt: "Il y a 2 heures", modifiedBy: "Marie Dubois", status: "Signé", - folder: "Contrats 2024", + folder: "Général", }, { id: "doc_002", - name: "Rapport_Financier_Q1.xlsx", - type: "Excel", + name: "Contrat_Fournisseur_XYZ.pdf", + type: "PDF", size: "1.8 MB", modifiedAt: "Il y a 4 heures", modifiedBy: "Jean Martin", status: "En révision", - folder: "Finance", + folder: "Général", }, { 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", + name: "Avenant_Contrat_123.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é", + folder: "Général", }, ]) @@ -166,7 +146,7 @@ export default function DashboardPage() { type: "edit", user: "Jean Martin", action: "a modifié", - target: "Rapport_Financier_Q1.xlsx", + target: "Contrat_Fournisseur_XYZ.pdf", time: "Il y a 4 heures", icon: Edit, color: "text-blue-600", @@ -176,7 +156,7 @@ export default function DashboardPage() { type: "share", user: "Sophie Laurent", action: "a partagé", - target: "Présentation_Produit_V2.pptx", + target: "Contrat_Client_ABC_2024.pdf", time: "Hier", icon: Share2, color: "text-purple-600", @@ -186,21 +166,11 @@ export default function DashboardPage() { type: "create", user: "Pierre Durand", action: "a créé le dossier", - target: "Projets 2024", + target: "Dossier Général", 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([ @@ -227,10 +197,10 @@ export default function DashboardPage() { { id: "notif_003", type: "info", - title: "Nouvel utilisateur", - message: "Thomas Petit a rejoint l'équipe Marketing", + title: "Nouveau contrat", + message: "Un nouveau document a été ajouté au dossier Général", time: "Hier", - icon: Users, + icon: FileText, color: "text-blue-600", bgColor: "bg-blue-50", },