From 88f2e6f0f9d360201fc6d08fe9a97a2966f1bf3f Mon Sep 17 00:00:00 2001 From: Pierre Date: Tue, 20 Jan 2026 17:46:14 +0100 Subject: [PATCH] Added 404, 500 & Dashboard Page --- app/dashboard/page.tsx | 10 +- app/error.tsx | 75 ++++++++++++++ app/not-found.tsx | 52 ++++++++++ components/DashboardLayout.tsx | 182 ++++++++++++++++++++++++++++----- 4 files changed, 291 insertions(+), 28 deletions(-) create mode 100644 app/error.tsx create mode 100644 app/not-found.tsx diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index b0b55b7..9d8b118 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -12,10 +12,14 @@ export default async function DashboardPage() { return (
-

- Tableau de bord +

+ Content de vous revoir {user.name || user.email}

- + +

+ Bienvenue sur votre tableau de bord. +

+

diff --git a/app/error.tsx b/app/error.tsx new file mode 100644 index 0000000..c17e01e --- /dev/null +++ b/app/error.tsx @@ -0,0 +1,75 @@ +'use client'; + +import { useEffect } from 'react'; +import Link from 'next/link'; +import Image from 'next/image'; + +interface ErrorProps { + error: Error & { digest?: string }; + reset: () => void; +} + +export default function Error({ error, reset }: ErrorProps) { + useEffect(() => { + // Log l'erreur dans la console/terminal + console.error('Erreur serveur:', error); + }, [error]); + + return ( +
+
+ {/* Logo */} +
+ MAD Logo +
+ + {/* 500 Content */} +
+

500

+

+ Erreur serveur +

+

+ Une erreur inattendue s'est produite sur le serveur. +

+ {error.message && ( +

+ {error.message} +

+ )} + {!error.message && ( +

+ Veuillez réessayer dans quelques instants. +

+ )} + + {/* Action Buttons */} +
+ + + Retour au tableau de bord + +
+
+ + {/* Footer */} +
+ © 2025 MAD - Propulsé par LGX +
+
+
+ ); +} diff --git a/app/not-found.tsx b/app/not-found.tsx new file mode 100644 index 0000000..a5cd143 --- /dev/null +++ b/app/not-found.tsx @@ -0,0 +1,52 @@ +import Link from 'next/link'; +import Image from 'next/image'; + +export default function NotFound() { + return ( +
+
+ {/* Logo */} +
+ MAD Logo +
+ + {/* 404 Content */} +
+

404

+

+ Page non trouvée +

+

+ Désolé, la page que vous recherchez n'existe pas ou a été déplacée. +

+ + {/* Action Buttons */} +
+ + Retour au tableau de bord + + + Page de connexion + +
+
+ + {/* Footer */} +
+ © 2025 MAD - Propulsé par LGX +
+
+
+ ); +} diff --git a/components/DashboardLayout.tsx b/components/DashboardLayout.tsx index 3a638e5..0c92e6f 100644 --- a/components/DashboardLayout.tsx +++ b/components/DashboardLayout.tsx @@ -1,7 +1,9 @@ 'use client'; -import { useRouter } from 'next/navigation'; +import { useRouter, usePathname } from 'next/navigation'; import { useState } from 'react'; +import Image from 'next/image'; +import Link from 'next/link'; interface User { id: string; @@ -14,10 +16,84 @@ interface DashboardLayoutProps { children: React.ReactNode; } +interface NavItem { + label: string; + href: string; + icon: React.ReactNode; +} + export default function DashboardLayout({ user, children }: DashboardLayoutProps) { const router = useRouter(); + const pathname = usePathname(); const [loading, setLoading] = useState(false); + const navItems: NavItem[] = [ + { + label: 'Tableau de Board', + href: '/dashboard', + icon: ( + + + + ), + }, + { + label: 'Calendrier', + href: '/dashboard/calendrier', + icon: ( + + + + ), + }, + { + label: 'Chauffeurs', + href: '/dashboard/chauffeurs', + icon: ( + + + + + ), + }, + { + label: 'Adhérents', + href: '/dashboard/adherents', + icon: ( + + + + ), + }, + { + label: 'Univers Pro', + href: '/dashboard/univers-pro', + icon: ( + + + + ), + }, + { + label: 'Messagerie', + href: '/dashboard/messagerie', + icon: ( + + + + ), + }, + { + label: 'Factures', + href: '/dashboard/factures', + icon: ( + + + + ), + }, + ]; + const handleLogout = async () => { setLoading(true); try { @@ -32,34 +108,90 @@ export default function DashboardLayout({ user, children }: DashboardLayoutProps }; return ( -
- -
- {children} -
+ {/* Navigation */} + + + {/* Footer */} +
+

+ © 2025 MAD - Propulsé par LGX +

+
+ + + {/* Main Content Area */} +
+ {/* Top Navbar */} +
+
+

+
+ {/* Notification Icon */} + + + {/* Profile Avatar */} + +
+
+
+ + {/* Page Content */} +
+ {children} +
+
); }