Skip to content

Composer attachments: first page previews, Library icons, lighter cards - #12261

Merged
shimmyshimmer merged 16 commits into
mainfrom
composer-attachment-previews
Sep 29, 2026
Merged

shimmyshimmer merged 16 commits into
mainfrom
composer-attachment-previews

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Composer attachment cards now show a preview of the file's first page for documents, and use the same icons as the Library.

Changes

First page previews

  • PDF, DOCX, XLSX/XLSM, CSV/TSV, PPTX, Markdown, text and code attachments render their first page in the card, above the name.
  • It reuses the existing DocumentView (the same renderer as the attachment preview dialog) at a fixed layout width, scaled down to the card.
  • The preview is inert and aria-hidden, so clicking the card still opens the full preview dialog.
  • Markdown renders through MarkdownPreview. Text and code show the first 8 KB.
  • PDF, Word and slide pages render on white. Sheets and text follow the theme.
  • Files over 10 MB, and any other file types, keep the icon. The PDF and Office viewers stay lazy loaded.
  • Composer only: sent messages show attachments as rows or chips, which are unchanged.

Icons

  • The kind icons now use the same shapes as the Library (features/library/file-kind.ts): Pdf01Icon, FlimSlateIcon, File02Icon, SheetIcon, InternetIcon. Colors are unchanged.
  • The one exception is video, which is lighter (text-pink-400, slightly scaled down) so it no longer stands out.
  • The generic file icon is now FileEmpty02Icon.
  • SheetIcon is imported relatively so the node tests can still load attachment-file-kind.ts.

Card styling

  • Image cards get the same hairline border as file cards.
  • Cards have no grey fill, so the name row sits on the composer background. Hover still tints.
  • Corner radius goes from 18px to 15px.
  • The caption is slightly smaller: 11.5px text, 13px icon, and tighter padding.

Testing

  • tsc -b passes.
  • The full frontend suite passes (npm test, 9353 tests).
  • Tried in the composer with PDF, Word, Excel, audio and image attachments.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T11:00:43.272485Z 1b7c06e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 1b7c06e45d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer
shimmyshimmer merged commit 6fabaab into main Sep 29, 2026
40 of 42 checks passed
@shimmyshimmer
shimmyshimmer deleted the composer-attachment-previews branch September 29, 2026 11:04
function docxRelationships(rels: Uint8Array | undefined, base: string): DocxRelationship[] {
if (!rels) return [];
const list: DocxRelationship[] = [];
const markup = strFromU8(rels).replace(XML_NON_ELEMENT_RE, "");

/** Each element tag's local name and attributes; comments, CDATA and text are skipped. */
function* docxElementTags(xml: string): Generator<{ local: string; attributes: Map<string, string> }> {
for (const tag of xml.replace(XML_NON_ELEMENT_RE, "").match(XML_ELEMENT_TAG_RE) ?? []) {
if (!part || !xml) continue;
// Just the referenced notes' elements, not the whole part.
const element = new RegExp(`<([\\w.-]+:)?${note}(?=[\\s/>])(?:"[^"]*"|'[^']*'|[^"'>])*>[\\s\\S]*?</\\1?${note}>`, "g");
const kept = [...strFromU8(xml).replace(XML_NON_ELEMENT_RE, "").matchAll(element)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants