import { createClient } from "@/lib/supabase-server" import { Button } from "@/components/ui/button" import Link from "next/link" import { Plus } from "lucide-react" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table" import { Badge } from "@/components/ui/badge" export default async function UsersPage() { const supabase = createClient() const { data: { user } } = await supabase.auth.getUser() // Protected Route Check (Simple) const { data: currentUserProfile } = await supabase .from('profiles') .select('role') .eq('id', user?.id) .single() // Only verify if we have profiles, if not (first run), maybe allow? // But for safety, blocking non-admins. if (currentUserProfile?.role !== 'admin') { return (

Yetkisiz Erişim

Bu sayfayı görüntüleme yetkiniz yok.

) } const { data: profiles } = await supabase .from("profiles") .select("*") .order("created_at", { ascending: false }) return (

Kullanıcı Yönetimi

Ad Soyad Rol Kayıt Tarihi İşlemler {profiles?.map((profile) => ( {profile.full_name} {profile.role === 'admin' ? 'Yönetici' : 'Kullanıcı'} {new Date(profile.created_at).toLocaleDateString('tr-TR')} ))}
) }