mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 16:03:21 +00:00
refactor: gestion des erreurs
This commit is contained in:
@ -34,6 +34,7 @@ import { fetchEstablishment } from '@/app/actions/schoolAction';
|
||||
import ProtectedRoute from '@/components/ProtectedRoute';
|
||||
import { getGravatarUrl } from '@/utils/gravatar';
|
||||
import Footer from '@/components/Footer';
|
||||
import { getRightStr, RIGHTS } from '@/utils/rights';
|
||||
|
||||
export default function Layout({
|
||||
children,
|
||||
@ -75,6 +76,20 @@ export default function Layout({
|
||||
|
||||
const dropdownItems = [
|
||||
{
|
||||
type: 'info',
|
||||
content: (
|
||||
<div className="px-4 py-2">
|
||||
<div className="font-medium">{user?.email || 'Utilisateur'}</div>
|
||||
<div className="text-xs text-gray-400">{getRightStr(user?.role) || ''}</div>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
content: <hr className="my-2 border-gray-200" />
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
label: 'Déconnexion',
|
||||
onClick: handleDisconnect,
|
||||
icon: LogOut,
|
||||
@ -111,8 +126,10 @@ export default function Layout({
|
||||
fetchUser();
|
||||
}, [session]);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<ProtectedRoute>
|
||||
<ProtectedRoute requiredRight={RIGHTS.ADMIN}>
|
||||
{!isLoading && (
|
||||
<div className="flex min-h-screen bg-gray-50 relative">
|
||||
{/* Sidebar avec hauteur forcée */}
|
||||
@ -163,7 +180,7 @@ export default function Layout({
|
||||
}
|
||||
items={dropdownItems}
|
||||
buttonClassName=""
|
||||
menuClassName="absolute right-0 mt-2 w-48 bg-white border border-gray-200 rounded shadow-lg"
|
||||
menuClassName="absolute right-0 mt-2 w-64 bg-white border border-gray-200 rounded shadow-lg"
|
||||
/>
|
||||
</header>
|
||||
{/* Main Content */}
|
||||
|
||||
Reference in New Issue
Block a user