Text chat 22: Attachments, stickers, lightbox, audio player (#272) #379
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-22-ui-attachments-media"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on: origin/textchat-16-core-navigation-read
What this builds (spec §3.5, §9.3, §9.4)
widgets/message_content/(new):attachments(model + view: mosaic, single picturefit(w, h, 550, 350), ThumbHash placeholder until the picture loads, GIFs playing withgif_auto_playor on hover, video poster + play that opens externally viaOpenUrl, ALT badge with the alt text as tooltip, hover toolbar with Download, expired attachments dimmed under "This attachment has expired"),mosaic(layout(n) -> Vec<Tile { col, row, col_span, row_span, aspect }>for 1–10 on one 6-column grid,placeat the available width, max 550 px, 4 px gaps),file_card(400 px card, extension icon asgetFileTypeIcon,formatFileSize, download / "Attachment expired"),spoiler(cover + "SPOILER" pill,render_spoilersincl. if-moderator),audio(card bound toPlayAttachment/StopAttachmentviamedia_playback),sticker(10 rem, 320 px URLs,animate_stickers).MediaPolicy { downloads }(default true) hides Download / Open in browser / Copy link.inline_attachment_mediaoff → file cards.screens/main/media_viewer.rs(new): lightbox over everything fromapp.chat.media.lightbox: backdrop 78 %, prev/next wrapping (step), zoom 1–5, step 1.25, double click 2.5 at the pointer, drag-pan clamped to the overhang, quarter-turn rotation, reset (Transform, pure); toolbar Close, Open in browser, Copy link, Download, rotate ×2, reset, zoom in/out, Reply. Escape closes it.message_rowdraws attachments + stickers under the text (no more "[n attachments]" placeholder) and includes them in the height estimate;media::wantedloads the pictures, stickers and the lightbox picture; 22 Phosphor icons added throughtheme::icons.Fork sources for dimensions:
MessageAttachmentUtils.ts,AttachmentLayoutGrid.module.css,AttachmentMosaic.module.css,MediaDimensionConfig.ts,Attachment.tsx/Attachment.module.css,AttachmentFile.tsx/AttachmentFile.module.css,SpoilerOverlay.module.css,AltTextBadge.module.css,MediaButtons.module.css,InlineAudioPlayer.tsx,MediaViewerModal.tsx,MediaModal.module.css,MediaControls.tsx,PanZoomMath.ts,MediaRotationMath.ts. No Electron reference screenshots were taken (no live instance from this task).Tests
tests/attachments.rs:mosaic_layout_table_1_to_10,single_image_fit_550x350,spoiler_hidden_until_clicked_and_setting_always,expired_overlay,file_card_icon_by_extension,audio_card_emits_play, plusmedia_clicks_open_the_lightbox_or_the_browser,stickers_are_160px_squares(data fromfixtures/textchat/history.json).tests/media_viewer.rs:lightbox_zoom_bounds_and_step,lightbox_prev_next.fluxer-native-shotsimage):attachments_mosaic_4,attachments_mosaic_7,attachment_file_card,attachment_spoiler,media_viewer. The whole fluxer-ui screenshot suite (37) passes there; hostcargo xtask cigreen (screenshot step run in the container because this host has no lavapipe).Deviations
screens/main/messages.rs(routeMessage::AttachmenttoUserActions, revealed attachment spoilers as view state),widgets/mod.rs(module),app.rs(Copy link viaiced::clipboard::write, Escape closes the lightbox),README.md,docs/screenshots/README.md.media::State::viewer(no newLocalfield).widgets/message_content/mod.rs,message_row.rs,messages.rs,media.rs,icons.rs(both add modules/arms; keep both).attachments::fitduplicatesembed_media::fitfrom 23 (same algorithm); one can call the other after both merge.Closes #272
🤖 Generated with Claude Code
Independent review: Text chat 22 (attachments, stickers, lightbox, audio player)
Reviewed
git diff eee47d56..origin/textchat-22-ui-attachments-media(ea4e439), read cold.Gate: local
cargo xtask ciin the review worktree: all steps passed (fmt, clippy, deny, core-isolation, parity, tests). The screenshot step was skipped (FLUXER_SCREENSHOT_TESTSnot set, no lavapipe on this host). I looked at theattachments_mosaic_7andmedia_viewergoldens and they look right. The Linux runner has to confirm the screenshot suite.Checks
mosaic_layout_table_1_to_10,single_image_fit_550x350,spoiler_hidden_until_clicked_and_setting_always,expired_overlay,file_card_icon_by_extension,audio_card_emits_play,lightbox_zoom_bounds_and_step,lightbox_prev_next), and so do the 5 screenshot tests and goldens. The mosaic table matches spec §3.5 for 2–10 (1:1 pair; 2fr + 1fr; 2 × 2 at 3:2; 3:2 over 1:1; 3 × 2; 16:9 hero + 3 × 2; 2 + 3 × 2; 3 × 3; hero + 3 × 3) with 4 px gaps at 550 px. The single image fits 550 × 350 and never grows. Zoom is 1–5, step 1.25, double click 2.5.mosaic::layout(n) -> Vec<Tile { col, row, col_span, row_span, aspect }>andattachments::fit(w, h, max_w, max_h)exist as written.PlayAttachment,StopAttachment,SaveAttachment,OpenMedia/CloseMedia,OpenUrlandmedia_playbackare used as Task 16 provides them. The lightbox index uses core'sis_visualnumbering, which matches core.fluxer-ui, docs and goldens. There are nofluxer-corechanges, no new dependencies and no new fixtures (the tests use the existingtextchat/history.json). Pictures go only throughImages/ImageLoader. "Copy link" uses iced's own clipboard. The hand-writtenDebugonDownload,MediaandViewerModelleaves out signed URLs. Server data:fit/place/step/format_size/format_durationhandle zero, huge and non-finite values.OpenUrldrops anything that does not parse as a URL.uihas no logging. Nothing in the diff writes URLs to logs or--record.Findings
message_row::estimate_heightnow subtracts a line for every message with empty content. Messages with embeds only, and system messages, still draw their placeholder line, so their estimate is one line short. Scroll estimates only; nothing breaks.is_visualcounts them; the row draws them as file cards).fittedthen draws them at 1 × 1 px. Nothing panics. A fallback size for the image's own decoded size would be better.attachments::fitduplicatesembed_media::fit(Task 23), as the implementer said. Dedupe when the branches meet.Verdict: approve. No blocking findings and local CI is green. The screenshot suite still needs to pass on the Linux runner.