import { createClient } from "@/lib/supabase/server" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table" import { Button } from "@/components/ui/button" import { Plus, UserCog } from "lucide-react" import Link from "next/link" import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" export default async function UsersPage() { const supabase = await createClient() const { data: profiles } = await supabase .from('profiles') .select('*') .order('created_at', { ascending: false }) // We might also want to get email from auth.users, but we can't join that easily with RLS/client. // However, usually profiles table should have email or we just show name. // In the schema, profiles has: id, role, full_name. No email. // This is a limitation. We can only show what's in profiles. // Unless we have a way to query auth.users (requires admin). return (

Kullanıcı Yönetimi

Sisteme erişimi olan kullanıcıları yönetin.

İsim Soyisim Rol Oluşturulma Tarihi İşlemler {profiles?.length === 0 ? ( Kullanıcı bulunamadı. ) : ( profiles?.map((profile) => (
{profile.full_name?.substring(0, 2).toUpperCase() || 'US'}
{profile.full_name || 'İsimsiz Kullanıcı'}
{profile.role === 'admin' ? 'Yönetici' : 'Personel'} {new Date(profile.created_at).toLocaleDateString('tr-TR')}
)) )}
{/* Mobile View */}
{profiles?.map((profile) => ( {profile.full_name || 'İsimsiz'} {profile.role === 'admin' ? 'Yönetici' : 'Personel'}
Kayıt: {new Date(profile.created_at).toLocaleDateString('tr-TR')}
))}
) }