diff --git a/client/lib/database.types.ts b/client/lib/database.types.ts index c396b352..6d0459ef 100644 --- a/client/lib/database.types.ts +++ b/client/lib/database.types.ts @@ -290,6 +290,7 @@ export type Database = { user_profiles: { Row: { avatar_url: string | null; + banner_url: string | null; bio: string | null; created_at: string; experience_level: diff --git a/client/pages/Dashboard.tsx b/client/pages/Dashboard.tsx index f3ef2e79..de92c8d7 100644 --- a/client/pages/Dashboard.tsx +++ b/client/pages/Dashboard.tsx @@ -134,6 +134,7 @@ export default function Dashboard() { !!p?.bio, !!p?.location, !!p?.avatar_url, + !!p?.banner_url, !!(p?.website_url || p?.github_url || p?.linkedin_url || p?.twitter_url), ]; const pct = Math.round((checks.filter(Boolean).length / checks.length) * 100); @@ -575,6 +576,24 @@ export default function Dashboard() { } }} /> +
+ + { + const file = e.target.files?.[0]; + if (!file || !user) return; + try { + const path = `${user.id}/banner-${Date.now()}-${file.name}`; + const { error } = await supabase.storage.from("banners").upload(path, file, { upsert: true }); + if (error) throw error; + const { data } = supabase.storage.from("banners").getPublicUrl(path); + await updateProfile({ banner_url: data.publicUrl } as any); + computeProfileCompletion({ ...(profile as any), banner_url: data.publicUrl }); + aethexToast.success({ title: "Banner updated" }); + } catch (err: any) { + aethexToast.error({ title: "Upload failed", description: err?.message || "Unable to upload image" }); + } + }} /> +