import { createClient } from "@/lib/supabase-server" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { UserForm } from "@/components/dashboard/user-form" import { getProfile } from "@/lib/data" export default async function ProfilePage() { const supabase = createClient() const { data: { user } } = await supabase.auth.getUser() if (!user) { // Should be protected by middleware but just in case return
Lütfen giriş yapın.
} // Fetch profile data const profile = await getProfile(user.id) if (!profile) { // Fallback for user without profile row? // Or create one on the fly? return
Profil verisi bulunamadı.
} // Improved name parsing logic const fullName = (profile.full_name || "").trim() const firstSpaceIndex = fullName.indexOf(' ') let firstName = fullName let lastName = "" if (firstSpaceIndex > 0) { firstName = fullName.substring(0, firstSpaceIndex) lastName = fullName.substring(firstSpaceIndex + 1) } const initialData = { firstName, lastName, phone: profile.phone || "", email: user.email || "", role: profile.role || "user" } return (

Profil

Genel Bilgiler Kişisel profil bilgilerinizi buradan güncelleyebilirsiniz.
PK
) }