From af54d8061cc3c896a7268e7e56d196589f261f4b Mon Sep 17 00:00:00 2001 From: robin Date: Fri, 26 Dec 2025 21:35:41 +0100 Subject: [PATCH] fix: Use username field instead of display_name in profile - Updated profile-actions.ts to use username column - Updated ProfileForm.tsx to use username - Updated settings page to pass username - Matches database schema (profiles.username) --- src/app/settings/page.tsx | 2 +- src/components/ProfileForm.tsx | 16 ++++++++-------- src/services/profile-actions.ts | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index 9b34496..4c3b163 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -44,7 +44,7 @@ export default async function SettingsPage() { diff --git a/src/components/ProfileForm.tsx b/src/components/ProfileForm.tsx index c85bc58..ae19499 100644 --- a/src/components/ProfileForm.tsx +++ b/src/components/ProfileForm.tsx @@ -8,12 +8,12 @@ import { updateProfile } from '@/services/profile-actions'; interface ProfileFormProps { initialData: { email?: string; - display_name?: string | null; + username?: string | null; }; } export default function ProfileForm({ initialData }: ProfileFormProps) { - const [displayName, setDisplayName] = useState(initialData.display_name || ''); + const [username, setUsername] = useState(initialData.username || ''); const [isPending, startTransition] = useTransition(); const [status, setStatus] = useState<'idle' | 'success' | 'error'>('idle'); const [error, setError] = useState(null); @@ -24,7 +24,7 @@ export default function ProfileForm({ initialData }: ProfileFormProps) { setError(null); const formData = new FormData(); - formData.set('display_name', displayName); + formData.set('username', username); startTransition(async () => { const result = await updateProfile(formData); @@ -66,16 +66,16 @@ export default function ProfileForm({ initialData }: ProfileFormProps) {

E-Mail kann nicht geƤndert werden

- {/* Display Name */} + {/* Username */}
setDisplayName(e.target.value)} - placeholder="Dein Name" + value={username} + onChange={(e) => setUsername(e.target.value)} + placeholder="Dein Benutzername" className="w-full px-4 py-3 bg-zinc-800 border border-zinc-700 rounded-xl text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-orange-500 focus:border-transparent" />
diff --git a/src/services/profile-actions.ts b/src/services/profile-actions.ts index 800c9ee..f88800e 100644 --- a/src/services/profile-actions.ts +++ b/src/services/profile-actions.ts @@ -20,13 +20,13 @@ export async function updateProfile(formData: FormData): Promise