Skip to content

Commit 847bd36

Browse files
committed
fix(native-chat): a pending attachment chip shows a spinner and its name, not a stacked icon
A local drop now waits as a pending chip, which drew the kind icon, the file name and a centered spinner on top of each other. Without a thumbnail the chip shows the spinner above the name; with one, the dimmed picture keeps a spinner strip along its bottom.
1 parent 7651123 commit 847bd36

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

‎src/renderer/src/components/native-chat/NativeChatImageAttachmentPreview.tsx‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,23 @@ function NativeChatImageThumbnail({
207207
alt={label}
208208
className={`size-full object-cover${isPending ? ' opacity-50' : ''}`}
209209
/>
210-
) : attachment.pendingName ? (
211-
<span className="flex max-w-full flex-col items-center gap-0.5 px-1">
212-
<KindIcon className="size-5 shrink-0 text-muted-foreground" />
213-
<span className="max-w-full truncate text-xs text-muted-foreground">
214-
{attachment.pendingName}
215-
</span>
210+
) : isPending ? (
211+
// Why: a chip still on its way shows only that it is loading and what it is.
212+
<span className="flex max-w-full flex-col items-center gap-1 px-1">
213+
<LoadingSpinner className="size-4 shrink-0 text-muted-foreground" />
214+
{attachment.pendingName ? (
215+
<span className="max-w-full truncate text-xs text-muted-foreground">
216+
{attachment.pendingName}
217+
</span>
218+
) : null}
216219
</span>
217220
) : (
218221
<KindIcon className="size-5 text-muted-foreground" />
219222
)}
220223
</button>
221-
{isPending ? (
222-
<span className="pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-chat-canvas/50">
223-
<LoadingSpinner className="size-4 text-muted-foreground" />
224+
{isPending && thumbnailSrc ? (
225+
<span className="pointer-events-none absolute inset-x-0 bottom-0 flex justify-center rounded-b-md bg-chat-canvas/90 py-0.5">
226+
<LoadingSpinner className="size-3 text-muted-foreground" />
224227
</span>
225228
) : null}
226229
<RemoveAttachmentButton onRemove={() => onRemove(attachment.id)} />

0 commit comments

Comments
 (0)