diff --git a/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx b/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx index d040472d6..2b3986c34 100644 --- a/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx +++ b/apps/dokploy/components/dashboard/settings/profile/profile-form.tsx @@ -257,8 +257,8 @@ export const ProfileForm = () => { onValueChange={(e) => { field.onChange(e); }} - defaultValue={field.value} - value={field.value} + defaultValue={field.value?.startsWith('data:') ? 'upload' : field.value} + value={field.value?.startsWith('data:') ? 'upload' : field.value} className="flex flex-row flex-wrap gap-2 max-xl:justify-center" > @@ -279,6 +279,54 @@ export const ProfileForm = () => { + + + + + + document.getElementById('avatar-upload')?.click()} + > + {field.value?.startsWith('data:') ? ( + + ) : ( + + + + )} + + { + const file = e.target.files?.[0]; + if (file) { + // max file size 5mb + if (file.size > 5 * 1024 * 1024) { + toast.error('Image size must be less than 5MB'); + return; + } + const reader = new FileReader(); + reader.onload = (event) => { + const result = event.target?.result as string; + field.onChange(result); + }; + reader.readAsDataURL(file); + } + }} + /> + + {availableAvatars.map((image) => (