Text chat 28: GIF picker (#278) #441

Manually merged
charles merged 0 commits from textchat-28-ui-gif-picker into textchat 2026-11-13 12:28:30 +00:00
Owner

Stacked on: textchat-27-ui-expression-picker

What

The GIFs tab of the expression picker (crates/fluxer-ui/src/screens/main/expressions/gifs.rs), spec §3.4 GIF part / §9.5:

  • Default view: "Search {provider}" field (provider display name from the discovery document, "Search Klipy" on the fixtures), then the Favorites tile, the "Trending GIFs" tile and the featured category tiles (name over a darkened preview; Favorites in the brand colour).
  • Trending, Favorites (newest first, "No favorite GIFs yet") and category views: back button ("Back to GIF categories") and the view's title.
  • Search with the store's debounces; suggestion pills fill the search; "No search results" once a search answered empty.
  • Masonry: columns(w) = floor((w+8)/208) clamped 2..=8, 8 px gaps, each tile into the shortest lane; category tiles at 200 × 96.
  • Skeleton grid (max(columns × 3, 12) tiles) once the store's 800 ms skeleton timer fired.
  • Hovering a GIF shows its star; the star emits ToggleFavoriteGif.
  • Previews are the tinywebp proxy variant (falling back to another still-picture format), requested only for tiles in view and added to the animated list, so they play while visible.
  • Picking emits PickGif { shift }; Shift keeps the picker open. Showing the tab emits OpenGifView(Default) (which fetches featured once per session). Ctrl+G toggles the tab.

Tests

  • crates/fluxer-ui/tests/gif_picker.rs: columns_formula, masonry_places_shortest_column, views_and_back, pick_emits_with_shift, star_toggles_favorite, skeleton_after_800ms, plus previews_are_the_tiny_webp_of_visible_tiles. They were written first and failed to compile against the base before the module existed.
  • Screenshots gif_picker_categories and gif_picker_results (stand-in gradients for the previews).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. One earlier run hit the known teardown SIGSEGV of the fluxer lib tests (#304); a rerun passed.

Deviations / outside the Files list

  • Small edits outside the listed files, all needed to wire the tab up: app.rs (Ctrl+G), screens/main/mod.rs (the composer's GIF button emits OpenGifView(Default)), screens/main/media.rs (one line adding the GIF previews to the animated list), theme/icons.rs and two Phosphor SVGs (trend-up-regular, arrow-left-regular), the crate README and docs/screenshots/README.md (the suite test requires the latter).
  • Not built: favourites import/export buttons (these need a file dialog and save path), video previews (the original prefers mp4/webm; we show the animated WebP the spec names), thumbhash placeholders, the error state (the store does not expose fetch errors), and Enter to flush the search (the store's 1 s max wait applies).
  • The Favorites tile previews the newest favourite instead of a random one. A favourite's preview is only shown when its GIF is in a list the store currently holds or its proxy_src is a picture, because GifRef keeps no media variants.
  • A typed search can show "No search results" for the debounce window (up to 1 s) before the request is sent, because the store does not expose a pending search.
  • Side-by-side screenshots against the Electron app are not attached.

Closes #278

🤖 Generated with Claude Code

Stacked on: textchat-27-ui-expression-picker ## What The GIFs tab of the expression picker (`crates/fluxer-ui/src/screens/main/expressions/gifs.rs`), spec §3.4 GIF part / §9.5: - Default view: "Search {provider}" field (provider display name from the discovery document, "Search Klipy" on the fixtures), then the Favorites tile, the "Trending GIFs" tile and the featured category tiles (name over a darkened preview; Favorites in the brand colour). - Trending, Favorites (newest first, "No favorite GIFs yet") and category views: back button ("Back to GIF categories") and the view's title. - Search with the store's debounces; suggestion pills fill the search; "No search results" once a search answered empty. - Masonry: `columns(w) = floor((w+8)/208)` clamped 2..=8, 8 px gaps, each tile into the shortest lane; category tiles at 200 × 96. - Skeleton grid (`max(columns × 3, 12)` tiles) once the store's 800 ms skeleton timer fired. - Hovering a GIF shows its star; the star emits `ToggleFavoriteGif`. - Previews are the `tinywebp` proxy variant (falling back to another still-picture format), requested only for tiles in view and added to the animated list, so they play while visible. - Picking emits `PickGif { shift }`; Shift keeps the picker open. Showing the tab emits `OpenGifView(Default)` (which fetches featured once per session). Ctrl+G toggles the tab. ## Tests - `crates/fluxer-ui/tests/gif_picker.rs`: `columns_formula`, `masonry_places_shortest_column`, `views_and_back`, `pick_emits_with_shift`, `star_toggles_favorite`, `skeleton_after_800ms`, plus `previews_are_the_tiny_webp_of_visible_tiles`. They were written first and failed to compile against the base before the module existed. - Screenshots `gif_picker_categories` and `gif_picker_results` (stand-in gradients for the previews). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. One earlier run hit the known teardown SIGSEGV of the `fluxer` lib tests (#304); a rerun passed. ## Deviations / outside the Files list - Small edits outside the listed files, all needed to wire the tab up: `app.rs` (Ctrl+G), `screens/main/mod.rs` (the composer's GIF button emits `OpenGifView(Default)`), `screens/main/media.rs` (one line adding the GIF previews to the animated list), `theme/icons.rs` and two Phosphor SVGs (`trend-up-regular`, `arrow-left-regular`), the crate README and `docs/screenshots/README.md` (the suite test requires the latter). - Not built: favourites import/export buttons (these need a file dialog and save path), video previews (the original prefers mp4/webm; we show the animated WebP the spec names), thumbhash placeholders, the error state (the store does not expose fetch errors), and Enter to flush the search (the store's 1 s max wait applies). - The Favorites tile previews the newest favourite instead of a random one. A favourite's preview is only shown when its GIF is in a list the store currently holds or its `proxy_src` is a picture, because `GifRef` keeps no media variants. - A typed search can show "No search results" for the debounce window (up to 1 s) before the request is sent, because the store does not expose a pending search. - Side-by-side screenshots against the Electron app are not attached. Closes #278 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Text chat 21-24 landed. The inline edit box now replaces only the text in
the new message row (attachments, embeds, stickers, forward and reactions
stay below it); the row's new events are routed next to the editor's. The
13 goldens Text chat 22-24 added were regenerated on lavapipe: only the
list's position moved, the composer box being taller.

Refs #275

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	crates/fluxer-ui/README.md
#	crates/fluxer-ui/src/screens/main/media.rs
#	crates/fluxer-ui/src/screens/main/messages.rs
#	crates/fluxer-ui/src/theme/icons.rs
#	crates/fluxer-ui/src/widgets/message_row.rs
#	crates/fluxer-ui/tests/screenshots.rs
#	docs/screenshots/README.md
#	fixtures/golden/attachment_file_card.png
#	fixtures/golden/attachment_spoiler.png
#	fixtures/golden/attachments_mosaic_4.png
#	fixtures/golden/attachments_mosaic_7.png
#	fixtures/golden/embed_article.png
#	fixtures/golden/embed_gifv.png
#	fixtures/golden/embed_rich_fields.png
#	fixtures/golden/embed_youtube.png
#	fixtures/golden/message_forwarded.png
#	fixtures/golden/message_reactions.png
#	fixtures/golden/message_reply.png
#	fixtures/golden/message_system_pin.png
#	fixtures/golden/reactors_modal.png
The expression picker popout of Text chat spec §3.4/§9.5
(ExpressionPickerPopout.tsx, EmojiPicker.tsx, StickersPicker.tsx,
pickers/memes/*): 592 x 690, resizable from its top and left edges with
the width snapped to 64 + n x 48 (min 360), tabs GIFs/Media/Stickers/
Emojis, a virtualised emoji grid (48 px cells, >= 5 columns) with the
category rail and guild icons, search, the inspector footer, the skin
tone selector and the premium banner; the sticker grid (120 px tracks)
and the saved media masonry. Opened from the composer's buttons,
Ctrl+E/Ctrl+S and (Text chat 29) Message::Open with a reaction target;
Shift keeps it open. Only the cells in view request images.

Refs #277

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The GIFs tab of the expression picker: the default view (Favorites,
Trending GIFs, featured category tiles), trending, favourites and
category views with a back button, search ("Search {provider}") with
suggestions, a masonry of 200 px lanes (columns floor((w+8)/208) in
2..=8, 8 px gaps, shortest lane first), the skeleton grid once the
store's 800 ms timer fires, the hover star toggling a favourite, the
tiny animated WebP previews of the tiles in view playing, and Ctrl+G.

Refs #278

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #278

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Independent review: Text chat 28, GIF picker

Scope: git diff 31e58b34..origin/textchat-28-ui-gif-picker (280ab0b).

Plan tests: all six named tests are in crates/fluxer-ui/tests/gif_picker.rs (columns_formula, masonry_places_shortest_column, views_and_back, pick_emits_with_shift, star_toggles_favorite, skeleton_after_800ms), plus a previews test. They check the spec §3.4 values: floor((w+8)/208) clamped to 2..=8, 8 px gaps, shortest lane first, a skeleton timer of exactly 800 ms, Shift keeps the picker open and inserts, and "Search Klipy". Both goldens (gif_picker_categories, gif_picker_results) are present and listed in docs/screenshots/README.md.

Interfaces: the default view (Favorites, Trending, categories), the trending, favourites and category views, search with suggestions, the masonry, the skeleton, the star, the tinywebp previews that play only while visible, and Ctrl+G are all present. The picker uses the store's existing UserAction::{OpenGifView, GifSearch, PickGif, ToggleFavoriteGif} and the gif_picker selector unchanged. Picking a favourite by its URL matches pick_gif in fluxer-core, which looks favourites up by URL.

Invariants: no fluxer-core, proto or fixture changes. fluxer-ui gets no new I/O path: images go through media.images (the sanctioned ImageLoader). No secrets, signed URLs or file paths. Server data cannot cause a panic: NaN and zero widths, zero sizes and unparsable URLs are all handled.

Findings

  1. minor: gifs::body returns NoResults when the query is not empty, the store is not loading and the results are empty. During the 350–1000 ms search debounce, a typed query therefore briefly shows "No search results" before the request goes out. The implementer reported this. Fixing it needs a pending flag from the store, so it belongs in a follow-up issue.
  2. minor: masonry sizes each tile from the server's width/height with no bound. A GIF with an extreme aspect ratio (for example 1×100000) gives one very tall tile. It does not panic, but the lane is unusable. A clamp, as the original's grid applies, would fix it.
  3. minor: parts of the spec are not built: importing and exporting favourites (the empty-favourites hint still says "import a list"), thumbhash placeholders and the error state. The Favorites tile shows the newest favourite, not a random one. Please file follow-up issues and link them from this PR before merge.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree: all steps passed (exit 0, including the screenshot tests).

Verdict: approve. No blocking findings and CI is green locally.

## Independent review: Text chat 28, GIF picker Scope: `git diff 31e58b34..origin/textchat-28-ui-gif-picker` (280ab0b). **Plan tests:** all six named tests are in `crates/fluxer-ui/tests/gif_picker.rs` (`columns_formula`, `masonry_places_shortest_column`, `views_and_back`, `pick_emits_with_shift`, `star_toggles_favorite`, `skeleton_after_800ms`), plus a previews test. They check the spec §3.4 values: `floor((w+8)/208)` clamped to 2..=8, 8 px gaps, shortest lane first, a skeleton timer of exactly 800 ms, Shift keeps the picker open and inserts, and "Search Klipy". Both goldens (`gif_picker_categories`, `gif_picker_results`) are present and listed in `docs/screenshots/README.md`. **Interfaces:** the default view (Favorites, Trending, categories), the trending, favourites and category views, search with suggestions, the masonry, the skeleton, the star, the `tinywebp` previews that play only while visible, and Ctrl+G are all present. The picker uses the store's existing `UserAction::{OpenGifView, GifSearch, PickGif, ToggleFavoriteGif}` and the `gif_picker` selector unchanged. Picking a favourite by its URL matches `pick_gif` in fluxer-core, which looks favourites up by URL. **Invariants:** no fluxer-core, proto or fixture changes. fluxer-ui gets no new I/O path: images go through `media.images` (the sanctioned ImageLoader). No secrets, signed URLs or file paths. Server data cannot cause a panic: NaN and zero widths, zero sizes and unparsable URLs are all handled. **Findings** 1. *minor*: `gifs::body` returns `NoResults` when the query is not empty, the store is not loading and the results are empty. During the 350–1000 ms search debounce, a typed query therefore briefly shows "No search results" before the request goes out. The implementer reported this. Fixing it needs a pending flag from the store, so it belongs in a follow-up issue. 2. *minor*: `masonry` sizes each tile from the server's `width`/`height` with no bound. A GIF with an extreme aspect ratio (for example 1×100000) gives one very tall tile. It does not panic, but the lane is unusable. A clamp, as the original's grid applies, would fix it. 3. *minor*: parts of the spec are not built: importing and exporting favourites (the empty-favourites hint still says "import a list"), thumbhash placeholders and the error state. The Favorites tile shows the newest favourite, not a random one. Please file follow-up issues and link them from this PR before merge. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree: **all steps passed** (exit 0, including the screenshot tests). **Verdict: approve.** No blocking findings and CI is green locally.
charles manually merged commit ba7cf9d2ec into textchat 2026-11-13 12:28:30 +00:00
Sign in to join this conversation.
No description provided.