From 93be8add4ee42279f895b0b0dbf6fd3f08f5db99 Mon Sep 17 00:00:00 2001 From: Alessio Date: Tue, 2 Jun 2026 12:27:03 +0200 Subject: [PATCH] profile-image --- src/components/profile/AccountCard.tsx | 10 ++++++---- src/components/profile/ProfilePageClient.tsx | 4 +++- src/components/shared/navigation/MobileSidebar.tsx | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/profile/AccountCard.tsx b/src/components/profile/AccountCard.tsx index 3e493c1..8846eff 100644 --- a/src/components/profile/AccountCard.tsx +++ b/src/components/profile/AccountCard.tsx @@ -26,7 +26,7 @@ export function AccountCard({ }: { onDeleteAvatar: () => Promise; onEditAccount: () => void; - onEditAvatar: () => void; + onEditAvatar: () => Promise; onEditPassword: () => void; onSelectAvatar: (file: File) => void; savingAvatar: boolean; @@ -76,9 +76,11 @@ export function AccountCard({ disabled={savingAvatar} icon={user.avatarUrl ? LuPencil : LuImagePlus} label={user.avatarUrl ? "Modifica avatar" : "Carica avatar"} - onClick={() => - user.avatarUrl ? onEditAvatar() : inputRef.current?.click() - } + onClick={async () => { + if (!user.avatarUrl || !(await onEditAvatar())) { + inputRef.current?.click(); + } + }} /> {user.avatarUrl ? ( - +