diff options
| author | Adam Soltys <[email protected]> | 2026-11-18 08:15:18 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-11-18 08:15:18 -0700 |
| commit | cf45b6ea2daa0237f54e7b74ab0f07d47722d354 (patch) | |
| tree | 7976123543440d9d6bae4530090d505eac52c8b2 /src/features | |
| parent | 80f1b6c729ebfec2bbfcedb17adab18f9dce6e1f (diff) | |
| download | coinosv3-cf45b6ea2daa0237f54e7b74ab0f07d47722d354.tar.gz coinosv3-cf45b6ea2daa0237f54e7b74ab0f07d47722d354.zip | |
A post's run of pictures goes into one grid instead of a screen each. "on a note with lots of images like this could we put them into a masonry grid layout within the post kinda like we do on our images feed so they don't take up so much real estate as we scroll?" (Adam, 2026-11-18). Two or more pictures with only blank space between them now share one box of justified rows, laid out like the Images feed: 140 px rows, 100 px on a phone, each tile at its own proportions and cropped to fill. A thirteen-photo post that ran thirteen screens long now takes a few rows. A tap still opens the picture in the pager, with the post's others a swipe away. A lone picture is shown as before. feed-picture-pager-test (two pictures side by side at one height, a lone one not in a grid, pager unchanged), feed-media-views, compose-preview and features-smoke pass.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6TV6sjEZSpqqBen9T5
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/messages.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 8f8bdd4..a254295 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -10923,6 +10923,7 @@ export function messagesFeature(ctx) { // opens the thread — not on the picture. function onPicture(e) { const el = e.currentTarget; + if (el.closest('.note-gallery')) return true; // a gallery tile is all picture (cropped to fill) const r = el.getBoundingClientRect(); const nw = el.naturalWidth, nh = el.naturalHeight; if (!nw || !nh || !r.width || !r.height) return true; @@ -11381,6 +11382,31 @@ export function messagesFeature(ctx) { for (const p of splitEmoji(part, emojiAt)) out.push(...(typeof p === 'string' ? mdInline(p) : [emojiImg(p.code, p.url)])); } else out.push(...mdInline(part)); } + return pictureRuns(out); + } + // Two or more pictures in a row (only blank space between them) share one + // box of justified rows, the way the Images feed lays them out, instead of + // a screen each: a post of thirteen photos was thirteen screens to scroll + // past ("could we put them into a masonry grid layout within the post kinda + // like we do on our images feed", Adam, 2026-11-18). A tap still opens the + // picture in the pager, with the rest a swipe away. + const isNoteImg = (n) => !!n && n.nodeType === 1 && n.tagName === 'IMG' && n.classList.contains('note-img'); + function pictureRuns(nodes) { + const out = []; + for (let i = 0; i < nodes.length; i++) { + if (!isNoteImg(nodes[i])) { out.push(nodes[i]); continue; } + const run = [nodes[i]]; + let j = i + 1, last = i; + for (; j < nodes.length; j++) { + const n = nodes[j]; + if (isNoteImg(n)) { run.push(n); last = j; continue; } + if (typeof n === 'string' && !n.trim()) continue; + break; + } + if (run.length < 2) { out.push(nodes[i]); continue; } + out.push(h('div', { class: 'note-gallery' }, ...run)); + i = last; + } return out; } |
