hata ayıklama ve kod temizliği

This commit is contained in:
2026-01-11 23:58:09 +03:00
parent b2a915240f
commit 32009b4886
22 changed files with 117 additions and 92 deletions

View File

@@ -2,7 +2,7 @@ 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 { notFound } from "next/navigation"
import { getProfile } from "@/lib/data"
export default async function ProfilePage() {
@@ -23,9 +23,17 @@ export default async function ProfilePage() {
return <div>Profil verisi bulunamadı.</div>
}
const parts = (profile.full_name || "").split(' ')
const firstName = parts[0] || ""
const lastName = parts.slice(1).join(' ') || ""
// 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,