diff --git a/ui/src/pages/IssueDetail.tsx b/ui/src/pages/IssueDetail.tsx index 7c80eb71..f62d3264 100644 --- a/ui/src/pages/IssueDetail.tsx +++ b/ui/src/pages/IssueDetail.tsx @@ -1218,7 +1218,9 @@ export function IssueDetail() { const isImageAttachment = (attachment: IssueAttachment) => attachment.contentType.startsWith("image/"); const attachmentList = attachments ?? []; const imageAttachments = attachmentList.filter(isImageAttachment); + const nonImageAttachments = attachmentList.filter((a) => !isImageAttachment(a)); const hasAttachments = attachmentList.length > 0; + const [confirmDeleteId, setConfirmDeleteId] = useState(null); const attachmentUploadButton = ( <> {attachmentError}

)} -
- {attachmentList.map((attachment) => ( -
-
- - {attachment.originalFilename ?? attachment.id} - - + {imageAttachments.length > 0 && ( +
+ {imageAttachments.map((attachment) => ( +
{ + const idx = imageAttachments.findIndex((a) => a.id === attachment.id); + setGalleryIndex(idx >= 0 ? idx : 0); + setGalleryOpen(true); + }} + > + {attachment.originalFilename +
+ {confirmDeleteId === attachment.id ? ( +
e.stopPropagation()} + > +

Delete?

+
+ + +
+
+ ) : ( + + )}
-

- {attachment.contentType} · {(attachment.byteSize / 1024).toFixed(1)} KB -

- {isImageAttachment(attachment) && ( - - )} -
- ))} -
+ ))} +
+ )} + + {nonImageAttachments.length > 0 && ( +
+ {nonImageAttachments.map((attachment) => ( +
+
+ + {attachment.originalFilename ?? attachment.id} + + +
+

+ {attachment.contentType} · {(attachment.byteSize / 1024).toFixed(1)} KB +

+
+ ))} +
+ )}
) : null}