Skip to content

The VS Code of video editing, built for agents.

TypeScript

Refactor attachment display in agent chat components

konstantin-pauluse0ff7ecaeaba
diff --git a/apps/web/src/agent-chat/attachments.tsx b/apps/web/src/agent-chat/attachments.tsx
index 3bcc225b..d54f1d29 100644
--- a/apps/web/src/agent-chat/attachments.tsx
+++ b/apps/web/src/agent-chat/attachments.tsx
@@ -184,7 +184,7 @@ export function AttachmentTile(props: AttachmentTileProps) {
export function AttachmentChip(props: { path: string }) {
const attachment = () => attachmentFromPath(props.path);
return (
- <span class="inline-flex h-5 max-w-full items-center gap-0.5 rounded bg-input pl-0.5 pr-1.5 text-[11px] text-muted-foreground" title={props.path}>
+ <span class="inline-flex h-5 max-w-full items-center gap-0.5 rounded border border-border bg-transparent pl-0.5 pr-1.5 text-[11px] text-muted-foreground" title={props.path}>
<Icon name={attachment().kind === "folder" ? "navigation.folder" : "attachment"} class="size-4" />
<span class="truncate">{attachment().name}</span>
</span>
diff --git a/apps/web/src/agent-chat/items.tsx b/apps/web/src/agent-chat/items.tsx
index 024cbb1c..edd05ea9 100644
--- a/apps/web/src/agent-chat/items.tsx
+++ b/apps/web/src/agent-chat/items.tsx
@@ -19,13 +19,17 @@ type Of<K extends Item["kind"]> = Extract<Item, { kind: K }>;
export function UserItem(props: { item: Of<"user"> }) {
return (
- <div class="rounded-md bg-muted px-2 py-1.5">
- <div class="whitespace-pre-wrap break-words text-[12px] leading-5 text-foreground">{props.item.text}</div>
+ <div class="flex flex-col gap-1">
<Show when={props.item.attachments?.length}>
- <div class="mt-1 flex flex-wrap gap-1">
+ <div class="flex flex-col items-end gap-1">
<For each={props.item.attachments}>{(path) => <AttachmentChip path={path} />}</For>
</div>
</Show>
+ <Show when={props.item.text.trim()}>
+ <div class="whitespace-pre-wrap break-words rounded-md bg-muted px-2 py-1.5 text-[12px] leading-5 text-foreground">
+ {props.item.text}
+ </div>
+ </Show>
</div>
);
}