From fa9d54aab5ba3fc28c8c8930154394e653515576 Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Thu, 11 Jun 2026 15:03:33 -0700 Subject: [PATCH] fixes --- js/desktop/src/components/human-avatar.tsx | 6 ++- .../features/settings/avatar-edit-dialog.tsx | 43 ++++++++++--------- js/desktop/src/lib/avatar-image.ts | 5 +++ 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/js/desktop/src/components/human-avatar.tsx b/js/desktop/src/components/human-avatar.tsx index 9f4d982..865efee 100644 --- a/js/desktop/src/components/human-avatar.tsx +++ b/js/desktop/src/components/human-avatar.tsx @@ -2,8 +2,10 @@ import * as React from 'react'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { useAvatarUrl } from '@/hooks/use-avatar-url'; -interface HumanAvatarProps - extends Omit, 'children'> { +interface HumanAvatarProps extends Omit< + React.ComponentProps, + 'children' +> { /** Object id of the human's profile picture, if any. */ avatarObjectId?: string | null; /** Initials rendered while loading or when no picture is set. */ diff --git a/js/desktop/src/features/settings/avatar-edit-dialog.tsx b/js/desktop/src/features/settings/avatar-edit-dialog.tsx index 2bdd767..14f23a6 100644 --- a/js/desktop/src/features/settings/avatar-edit-dialog.tsx +++ b/js/desktop/src/features/settings/avatar-edit-dialog.tsx @@ -14,6 +14,7 @@ import { Button } from '@/components/ui/button'; import { Muted } from '@/components/ui/typography'; import { apiClient } from '@/api/client'; import { useAuthStore } from '@/stores/auth-store'; +import { useMediaDevicesStore } from '@/stores/media-devices-store'; import { useAvatarUrl } from '@/hooks/use-avatar-url'; import { useFileInput } from '@/hooks/use-file-input'; import { toAvatarBlob } from '@/lib/avatar-image'; @@ -30,7 +31,10 @@ interface AvatarEditDialogProps { onOpenChange: (open: boolean) => void; } -export function AvatarEditDialog({ open, onOpenChange }: AvatarEditDialogProps) { +export function AvatarEditDialog({ + open, + onOpenChange, +}: AvatarEditDialogProps) { const user = useAuthStore((s) => s.user); const refreshUser = useAuthStore((s) => s.refreshUser); const currentUrl = useAvatarUrl(user?.avatar_object_id); @@ -156,11 +160,7 @@ export function AvatarEditDialog({ open, onOpenChange }: AvatarEditDialogProps)
{previewUrl ? ( - + ) : ( {initials} @@ -221,12 +221,7 @@ export function AvatarEditDialog({ open, onOpenChange }: AvatarEditDialogProps) Remove )} -
- diff --git a/js/desktop/src/lib/avatar-image.ts b/js/desktop/src/lib/avatar-image.ts index 14c41a8..2fc7aac 100644 --- a/js/desktop/src/lib/avatar-image.ts +++ b/js/desktop/src/lib/avatar-image.ts @@ -11,6 +11,11 @@ export async function toAvatarBlob( { size = 512, mirror = false }: { size?: number; mirror?: boolean } = {}, ): Promise { const side = Math.min(source.width, source.height); + if (side === 0) { + // A not-yet-decoded