Images and GitHub issues/PRs now live in one draft-store list (ComposerAttachment union) with cwd persisted on the draft. Paperclip becomes a + drop-up menu; queue button removed. Each pill uses a shared AttachmentPill wrapper with a corner-X that mirrors the auto-update toast spec. Pill body opens the attachment: GitHub via openExternalUrl, images via a new fullscreen AttachmentLightbox. GitHub picker auto-closes on select.
31 lines
908 B
TypeScript
31 lines
908 B
TypeScript
import type { AttachmentMetadata, ComposerAttachment } from "@/attachments/types";
|
|
import type { AgentAttachment } from "@server/shared/messages";
|
|
import { buildGitHubAttachmentFromSearchItem } from "@/utils/review-attachments";
|
|
|
|
export type ImageAttachment = AttachmentMetadata;
|
|
|
|
export function splitComposerAttachmentsForSubmit(attachments: ComposerAttachment[]): {
|
|
images: ImageAttachment[];
|
|
attachments: AgentAttachment[];
|
|
} {
|
|
const images: ImageAttachment[] = [];
|
|
const reviewAttachments: AgentAttachment[] = [];
|
|
|
|
for (const attachment of attachments) {
|
|
if (attachment.kind === "image") {
|
|
images.push(attachment.metadata);
|
|
continue;
|
|
}
|
|
|
|
const reviewAttachment = buildGitHubAttachmentFromSearchItem(attachment.item);
|
|
if (reviewAttachment) {
|
|
reviewAttachments.push(reviewAttachment);
|
|
}
|
|
}
|
|
|
|
return {
|
|
images,
|
|
attachments: reviewAttachments,
|
|
};
|
|
}
|