diff options
| author | Adam Soltys <[email protected]> | 2026-11-17 17:08:55 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-11-17 17:08:55 -0700 |
| commit | 262c2e36096ae0a2c66a620d01ee9132de746670 (patch) | |
| tree | 67e1e542088968d0bc839869a6cdee7ed005c0fd | |
| parent | 8d2f2c72a7bb7087879e110f8575bcef00bbc2c0 (diff) | |
| download | coinosv3-262c2e36096ae0a2c66a620d01ee9132de746670.tar.gz coinosv3-262c2e36096ae0a2c66a620d01ee9132de746670.zip | |
The scroll date chip blends between posts and goes the moment you stop. "I'm good with blending. Can you make the chip appear and disappear faster? I want it gone as soon as I'm stopped to look at something" (Adam, 2026-11-17). The time now moves between the post at the top of the screen and the next one, in step with how far through that post you've scrolled. The clock rolls with the scroll instead of jumping from post to post, and runs quickly through a gap between posts. The chip leaves 250 ms after the last scroll event (was 1.2 s); a coast keeps sending events, so it stays while the page is still moving. It fades in over 80 ms and out over 120 ms. feed-when-test (blended time between the two posts, rolls with a few px of scroll, gone half a second after stopping) and feed-new-posts pass.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6SwkivduFDDkMmnXjZ
| -rw-r--r-- | src/features/messages.js | 26 | ||||
| -rw-r--r-- | src/style.css | 4 | ||||
| -rw-r--r-- | tools/feed-when-test.js | 11 |
3 files changed, 29 insertions, 12 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 6b3ff4c..72707a5 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -5445,7 +5445,7 @@ export function messagesFeature(ctx) { } // How far back you've scrolled: while the feed (or a profile's posts) // moves, a small chip under the top bar says when the post at the top of - // the screen was written, and fades a moment after the scrolling stops + // the screen was written, and goes the moment the scrolling stops // ("some sort of little counter that shows the date and time of posts // where I'm in the timeline", Adam, 2026-11-17). Painted straight into the // DOM, outside render(): it changes every frame of a fling. @@ -5476,13 +5476,22 @@ export function messagesFeature(ctx) { const head = document.querySelector('.brand-header'); const top = head ? Math.max(0, head.getBoundingClientRect().bottom) : 0; // the post at the top of the screen, below the bar - let key = null, box = null; - for (const r of rows) { - const b = r.getBoundingClientRect(); - if (b.bottom > top + 12) { key = r.getAttribute('data-key'); box = r.parentElement.getBoundingClientRect(); break; } + let key = null, box = null, frac = 0, nextKey = null; + for (let i = 0; i < rows.length; i++) { + const b = rows[i].getBoundingClientRect(); + if (b.bottom <= top + 12) continue; + key = rows[i].getAttribute('data-key'); + box = rows[i].parentElement.getBoundingClientRect(); + // how far through this post the top of the screen is, to blend its + // time toward the next post's: the clock rolls with the scroll + // instead of jumping post to post ("I'm good with blending", Adam) + frac = b.height > 0 ? Math.min(1, Math.max(0, (top + 12 - b.top) / b.height)) : 0; + nextKey = rows[i + 1]?.getAttribute('data-key'); + break; } if (whenIdx.list !== list) whenIdx = { list, map: list ? new Map(list.map((e) => [e.id, e])) : null }; const ev = key && whenIdx.map?.get(key); + const next = nextKey && whenIdx.map?.get(nextKey); // only once you're past the first screenful: at the top the posts' own times say it if (!ev || (window.scrollY || 0) < window.innerHeight * 0.75) { if (whenEl) whenEl.classList.remove('on'); return; } if (!whenEl) { @@ -5491,13 +5500,16 @@ export function messagesFeature(ctx) { whenEl.setAttribute('aria-hidden', 'true'); document.body.appendChild(whenEl); } - const label = whenLabel(ev.created_at); + const label = whenLabel(next ? ev.created_at + (next.created_at - ev.created_at) * frac : ev.created_at); if (whenEl.textContent !== label) whenEl.textContent = label; whenEl.style.top = (top + 8) + 'px'; whenEl.style.left = (box.left + box.width / 2) + 'px'; whenEl.classList.add('on'); clearTimeout(whenHide); - whenHide = setTimeout(() => whenEl && whenEl.classList.remove('on'), 1200); + // gone as soon as you stop to read ("I want it gone as soon as I'm + // stopped to look at something", Adam): a coast keeps sending scroll + // events, so this only fires once the page is still + whenHide = setTimeout(() => whenEl && whenEl.classList.remove('on'), 250); }); } async function loadOlderNotes(pk) { diff --git a/src/style.css b/src/style.css index 633d7f6..4024f3b 100644 --- a/src/style.css +++ b/src/style.css @@ -2208,6 +2208,6 @@ html:has(.call-overlay:not(.call-min)) { overflow: hidden; scrollbar-gutter: aut border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 2px 10px rgba(0, 0, 0, .14); - pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s; + pointer-events: none; opacity: 0; transition: opacity .12s, transform .12s; } -.feed-when.on { opacity: 1; transform: translate(-50%, 0); } +.feed-when.on { opacity: 1; transform: translate(-50%, 0); transition-duration: .08s; } diff --git a/tools/feed-when-test.js b/tools/feed-when-test.js index d9baa50..38be4ef 100644 --- a/tools/feed-when-test.js +++ b/tools/feed-when-test.js @@ -119,11 +119,16 @@ try { }); const ev = shown && seeded.find((e) => e.id === shown.key); check('the chip shows while scrolling, under the top bar', !!shown && shown.y >= shown.head, JSON.stringify(shown)); - const want = ev && await page.evaluate((s) => new Date(s * 1000).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' }), ev.created_at); - check('...with the time of the post at the top of the screen', !!want && shown.text.includes(want), shown?.text + ' / ' + want); + // seeded posts are two hours apart: the chip's minute is one of those between this post and the next + const between = ev && await page.evaluate((s) => Array.from({ length: 121 }, (_, m) => new Date((s - m * 60) * 1000).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' })), ev.created_at); + check('...with a time between the top post and the next', !!between && between.some((x) => shown.text.includes(x)), shown?.text); check('...and how long ago', /ago|yesterday/i.test(shown?.text || ''), shown?.text); if (process.env.SHOT) await page.screenshot({ path: process.env.SHOT }); - await sleep(1700); + // the clock rolls between posts: a few px down the same post moves it on + const at = (y) => page.evaluate(async (y) => { scrollBy(0, y); await new Promise((r) => setTimeout(r, 60)); return document.querySelector('.feed-when')?.textContent; }, y); + const a = await at(1), b = await at(60); + check('the time blends between posts as you scroll', !!a && !!b && a !== b, a + ' → ' + b); + await sleep(450); check('it fades once the scrolling stops', !(await page.$('.feed-when.on'))); check('no page errors', !errors.length, errors.join('; ')); } finally { |
