import { prisma } from '@/lib/db'; import { isAuthenticated, logoutAdmin, addButton, deleteButton } from '@/app/actions/admin'; import { redirect } from 'next/navigation'; import { GlassCard } from '@/components/GlassCard'; import { Trash2, LogOut, PlusCircle, Globe } from 'lucide-react'; export default async function AdminPage() { const auth = await isAuthenticated(); if (!auth) { redirect('/admin/login'); } const buttons = await prisma.button.findMany({ orderBy: { order: 'asc' }, }); return (

Panel d'Administration

{/* Form to add button */}

Ajouter un bouton

{/* List of buttons */}

Boutons configurés

{buttons.length === 0 ? (

Aucun bouton configuré pour le moment.

) : (
{buttons.map((btn: any) => (
{btn.name}
{btn.url}
{ 'use server'; await deleteButton(btn.id); }}>
))}
)}
); }