Skip to content

Commit 8f35f19

Browse files
committed
fix(ui): implement UI/UX improvements for file attachments
1 parent 43b5a23 commit 8f35f19

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

src/integrations/misc/process-files.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export async function selectFiles(): Promise<ProcessedFiles> {
7373
openLabel: "Select",
7474
filters: {
7575
"All Files": ["*"],
76-
Images: ["png", "jpg", "jpeg", "webp", "gif", "bmp", "svg", "ico"],
7776
},
7877
}
7978

webview-ui/src/components/chat/ChatTextArea.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,9 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
858858
/>
859859
</div>
860860
)}
861+
{selectedFiles && selectedFiles.length > 0 && setSelectedFiles && (
862+
<FileAttachment files={selectedFiles} setFiles={setSelectedFiles} className="mb-2" />
863+
)}
861864
<div
862865
className={cn(
863866
"relative",
@@ -1043,16 +1046,6 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
10431046
/>
10441047
)}
10451048

1046-
{selectedFiles && selectedFiles.length > 0 && setSelectedFiles && (
1047-
<FileAttachment
1048-
files={selectedFiles}
1049-
setFiles={setSelectedFiles}
1050-
style={{
1051-
marginBottom: "8px",
1052-
}}
1053-
/>
1054-
)}
1055-
10561049
<div className={cn("flex", "justify-between", "items-center", "mt-auto")}>
10571050
<div className={cn("flex", "items-center", "gap-1", "min-w-0")}>
10581051
<div className="shrink-0">

webview-ui/src/components/chat/FileAttachment.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ const FileAttachment: React.FC<FileAttachmentProps> = ({ files, setFiles, style,
4545
onMouseEnter={() => setHoveredIndex(index)}
4646
onMouseLeave={() => setHoveredIndex(null)}>
4747
<i className={cn("codicon", `codicon-file-${getFileIcon(file.type)}`)} />
48-
<span className="text-sm">{file.path}</span>
48+
<span className="text-sm" title={file.path}>
49+
{file.path.length > 30 ? `${file.path.substring(0, 27)}...` : file.path}
50+
</span>
4951
{isDeletable && hoveredIndex === index && (
5052
<div
5153
onClick={() => handleDelete(index)}

0 commit comments

Comments
 (0)