Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Site: the star count in the nav matches the tile, and the last few stars keep arriving after you scroll past it

Eric Brownrout9b820f04a270
diff --git a/site/public/marketing/activity.mjs b/site/public/marketing/activity.mjs
index dfffb598..1e39a084 100644
--- a/site/public/marketing/activity.mjs
+++ b/site/public/marketing/activity.mjs
@@ -5,7 +5,8 @@ const section = document.querySelector('#progress'),
clip = section.querySelector('.chart-clip'),
chart = section.querySelector('.star-chart'),
points = Array.from(section.querySelector('.chart-line').points),
- reduce = matchMedia('(prefers-reduced-motion: reduce)')
+ reduce = matchMedia('(prefers-reduced-motion: reduce)'),
+ nav = document.querySelector('.nav-stars')
let total = Number(number.textContent.replaceAll(',', ''))
const format = new Intl.NumberFormat('en')
number.setAttribute('aria-hidden', 'true')
@@ -23,6 +24,9 @@ let started = false,
tailTimer = 0,
tailRemaining = tailGaps[0],
tailMark = 0
+// The nav shows the same count as the tile: the starting count until the tile has played, then each later star with it.
+const showNav = count => { nav.querySelector('span').textContent = navStars(count) }
+if (!finished) showNav(base)
// Interpolate the same straight segment that is visible at the clipping edge.
function heightAt(progress) {
if (progress === 0 || progress === 1 || points.length < 2) return progress
@@ -63,16 +67,18 @@ function rest() {
clock?.cancel()
clock = null
updateCount(1)
+ showNav(total)
section.dataset.stars = 'complete'
}
function scheduleTail() {
- if (tailTimer || !visible || document.hidden || reduce.matches || finished) return
+ if (tailTimer || document.hidden || reduce.matches || finished) return
tailMark = performance.now()
tailTimer = setTimeout(() => {
tailTimer = 0
tailValue = Math.min(total, tailValue + 1)
tailRemaining = tailGaps[tailValue - base] ?? 0
number.textContent = format.format(tailValue)
+ showNav(tailValue)
if (tailValue === total) rest()
else scheduleTail()
}, tailRemaining)
@@ -116,10 +122,11 @@ function sync() {
clock = null
finished = true
paint(1)
+ showNav(total)
section.dataset.stars = 'still'
return
}
- if (!visible || document.hidden) {
+ if (document.hidden || (!visible && !tailStage)) {
stop()
return
}
@@ -188,7 +195,6 @@ new IntersectionObserver(([entry])=>{
document.addEventListener('visibilitychange',syncStatusPulse)
reduce.addEventListener('change',syncStatusPulse)
-const nav = document.querySelector('.nav-stars')
const releaseCount = section.querySelector('.oss-calendar .oss-figure')
const releaseLink = section.querySelector('.oss-latest')
const version = releaseLink.querySelector('.release-version strong')
@@ -220,7 +226,7 @@ async function refresh() {
base = total - tailSize
tailValue = Math.min(total, base + ticks)
const label = format.format(total)
- nav.querySelector('span').textContent = navStars(total)
+ showNav(finished ? total : tailStage ? tailValue : base)
nav.setAttribute('aria-label', 'Yogurt on GitHub, ' + label + ' stars')
section.querySelector('.oss-history').setAttribute('aria-label', label + ' GitHub stars. View on GitHub')
number.parentElement.setAttribute('aria-label', label + ' GitHub stars')
diff --git a/site/scripts/stars.test.mjs b/site/scripts/stars.test.mjs
index a502b393..601ecb92 100644
--- a/site/scripts/stars.test.mjs
+++ b/site/scripts/stars.test.mjs
@@ -134,6 +134,7 @@ function chartPage(reduced = false) {
constructor(effect) { return animation(effect.frames, effect.options) }
},
document: doc,
+ navStars: count => count.toLocaleString('en'),
window: { addEventListener() {}, removeEventListener() {} },
innerHeight: 800,
Intl,
@@ -165,6 +166,7 @@ function chartPage(reduced = false) {
})
return {
number,
+ nav: () => query('span').textContent,
enter: (ratio = 1) => observe([{ isIntersecting: true, intersectionRatio: ratio }]),
clip: () => query('.chart-clip').style.transform,
fill: () => query('.chart-fill').style.transform,
@@ -183,6 +185,7 @@ function chartPage(reduced = false) {
}
}
const chart = chartPage()
+assert.equal(chart.nav(), '128') // The nav starts on the count the tile will land on.
assert.equal(chart.clip(), 'scaleX(0)')
assert.equal(chart.number.textContent, '0')
chart.enter(.2)
@@ -202,26 +205,26 @@ chart.finishCountUp()
assert.equal(chart.clip(), 'scaleX(1)')
assert.equal(chart.number.textContent, '128')
assert.equal(chart.timer().ms, 3000)
-chart.advance(1500)
-chart.leave()
-assert.equal(chart.timer(), null)
-chart.enter()
-assert.equal(chart.timer().ms, 1500)
-for (const [i, delay] of [1500, 8000, 15000, 24000, 35000, 48000].entries()) {
+assert.equal(chart.nav(), '128')
+chart.leave() // Later stars keep arriving after the reader scrolls away from the tile.
+assert.equal(chart.timer().ms, 3000)
+for (const [i, delay] of [3000, 8000, 15000, 24000, 35000, 48000].entries()) {
const t = chart.timer()
assert.equal(t.ms, delay)
chart.advance(delay)
t.fn()
assert.equal(chart.number.textContent, String(129 + i))
+ assert.equal(chart.nav(), chart.number.textContent) // The nav and the tile change together.
}
assert.equal(chart.state(), 'complete')
const still = chartPage(true)
still.enter()
assert.equal(still.number.textContent, '134')
+assert.equal(still.nav(), '134')
assert(!still.timer())
assert.equal(still.clip(), 'scaleX(1)')
assert.equal(still.timing(), undefined)
-console.log('Shared chart and count timing, linear axes, growing intervals, offscreen pause and reduced-motion total passed.')
+console.log('Shared chart and count timing, linear axes, growing intervals, nav in step with the tile, later stars continuing offscreen and reduced-motion total passed.')
const template=load('../content/home.html')
const featureSection=template.match(/<section aria-labelledby="features-title"[\s\S]*?<\/section>/)[0]