import { prisma } from '@/lib/db'; import { getSession } from '@/lib/auth'; import { redirect } from 'next/navigation'; import { UserPlus, Trash2, KeyRound, ShieldCheck } from 'lucide-react'; import { createUser, deleteUser, changePassword } from './actions'; export default async function UsersAdminPage() { const session = await getSession(); if (!session) redirect('/admin/login'); const users = await prisma.user.findMany({ orderBy: { createdAt: 'asc' }, }); return (

Kullanıcı Yönetimi

{/* Sol: Kullanıcı listesi */}
{/* Yeni kullanıcı ekle */}

Yeni Kullanıcı Ekle

{/* Mevcut kullanıcılar */}

Mevcut Kullanıcılar ({users.length})

{users.map((user: any) => (

{user.username}

{new Date(user.createdAt).toLocaleDateString('tr-TR', { day: 'numeric', month: 'long', year: 'numeric', })}

{users.length > 1 && (
)}
))} {users.length === 0 && (

Kullanıcı bulunamadı.

)}
{/* Sağ: Şifre değiştir */}

Şifre Değiştir

); }