Skip to content

Commit 3a1ec27

Browse files
authored
feat(app): show full names on composer attachment chips (anomalyco#21306)
1 parent 3c96bf8 commit 3a1ec27

1 file changed

Lines changed: 30 additions & 27 deletions

File tree

packages/app/src/components/prompt-input/image-attachments.tsx

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, For, Show } from "solid-js"
22
import { Icon } from "@opencode-ai/ui/icon"
3+
import { Tooltip } from "@opencode-ai/ui/tooltip"
34
import type { ImageAttachmentPart } from "@/context/prompt"
45

56
type PromptImageAttachmentsProps = {
@@ -22,34 +23,36 @@ export const PromptImageAttachments: Component<PromptImageAttachmentsProps> = (p
2223
<div class="flex flex-wrap gap-2 px-3 pt-3">
2324
<For each={props.attachments}>
2425
{(attachment) => (
25-
<div class="relative group">
26-
<Show
27-
when={attachment.mime.startsWith("image/")}
28-
fallback={
29-
<div class={fallbackClass}>
30-
<Icon name="folder" class="size-6 text-text-weak" />
31-
</div>
32-
}
33-
>
34-
<img
35-
src={attachment.dataUrl}
36-
alt={attachment.filename}
37-
class={imageClass}
38-
onClick={() => props.onOpen(attachment)}
39-
/>
40-
</Show>
41-
<button
42-
type="button"
43-
onClick={() => props.onRemove(attachment.id)}
44-
class={removeClass}
45-
aria-label={props.removeLabel}
46-
>
47-
<Icon name="close" class="size-3 text-text-weak" />
48-
</button>
49-
<div class={nameClass}>
50-
<span class="text-10-regular text-white truncate block">{attachment.filename}</span>
26+
<Tooltip value={attachment.filename} placement="top" contentClass="break-all">
27+
<div class="relative group">
28+
<Show
29+
when={attachment.mime.startsWith("image/")}
30+
fallback={
31+
<div class={fallbackClass}>
32+
<Icon name="folder" class="size-6 text-text-weak" />
33+
</div>
34+
}
35+
>
36+
<img
37+
src={attachment.dataUrl}
38+
alt={attachment.filename}
39+
class={imageClass}
40+
onClick={() => props.onOpen(attachment)}
41+
/>
42+
</Show>
43+
<button
44+
type="button"
45+
onClick={() => props.onRemove(attachment.id)}
46+
class={removeClass}
47+
aria-label={props.removeLabel}
48+
>
49+
<Icon name="close" class="size-3 text-text-weak" />
50+
</button>
51+
<div class={nameClass}>
52+
<span class="text-10-regular text-white truncate block">{attachment.filename}</span>
53+
</div>
5154
</div>
52-
</div>
55+
</Tooltip>
5356
)}
5457
</For>
5558
</div>

0 commit comments

Comments
 (0)