Added few configurations & mores
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import { getCurrentUser } from '@/lib/auth';
|
||||
import { hasPageAccess } from '@/lib/permissions';
|
||||
import DashboardLayout from '@/components/DashboardLayout';
|
||||
import DashboardContent from '@/components/DashboardContent';
|
||||
|
||||
export default async function DashboardPage() {
|
||||
const user = await getCurrentUser();
|
||||
@@ -9,46 +11,15 @@ export default async function DashboardPage() {
|
||||
redirect('/login');
|
||||
}
|
||||
|
||||
// Vérifier les permissions
|
||||
const hasAccess = await hasPageAccess(user.id, '/dashboard');
|
||||
if (!hasAccess) {
|
||||
redirect('/dashboard/parametres'); // Rediriger vers une page accessible ou afficher une erreur
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardLayout user={user}>
|
||||
<div className="p-6">
|
||||
<h1 className="text-3xl font-semibold text-cblack mb-1">
|
||||
Content de vous revoir <span className="text-dyellow">{user.name || user.email}</span>
|
||||
</h1>
|
||||
|
||||
<p className="text-sm text-cgray mb-6">
|
||||
Bienvenue sur votre tableau de bord.
|
||||
</p>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-2">
|
||||
Bienvenue
|
||||
</h3>
|
||||
<p className="text-gray-600 dark:text-gray-400">
|
||||
{user.name || user.email}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-2">
|
||||
Statistiques
|
||||
</h3>
|
||||
<p className="text-gray-600 dark:text-gray-400">
|
||||
Contenu à venir
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-2">
|
||||
Activité récente
|
||||
</h3>
|
||||
<p className="text-gray-600 dark:text-gray-400">
|
||||
Contenu à venir
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DashboardContent userName={user.name} />
|
||||
</DashboardLayout>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user