← back to build-pages
home: per-project today-PT chip on each project card + 1 smoke
f1d86dbac5a4af1fc7d3fec3095d6d1aea8a7586 · 2026-05-13 20:48:18 -0700 · SteveStudio2
Files touched
M public/css/site.cssM server.jsM test/smoke.js
Diff
commit f1d86dbac5a4af1fc7d3fec3095d6d1aea8a7586
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date: Wed May 13 20:48:18 2026 -0700
home: per-project today-PT chip on each project card + 1 smoke
---
public/css/site.css | 2 ++
server.js | 19 ++++++++++++++++---
test/smoke.js | 1 +
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/public/css/site.css b/public/css/site.css
index 744ce58..2cbef27 100644
--- a/public/css/site.css
+++ b/public/css/site.css
@@ -116,6 +116,8 @@ h2 { font-size: 20px; font-weight: 700; margin: 36px 0 14px; letter-spacing: -0.
.bp-delta-up { color: #1f7a30; background: rgba(31,122,48,0.12); }
.bp-delta-dn { color: #b14747; background: rgba(177,71,71,0.12); }
.bp-delta-eq { color: var(--muted); background: var(--chip-bg); }
+.bp-today { color: #1f7a30; background: rgba(31,122,48,0.10); padding: 1px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; }
+@media (prefers-color-scheme: dark) { .bp-today { color: #5cd278; } }
@media (prefers-color-scheme: dark) {
.bp-delta-up { color: #5cd278; }
.bp-delta-dn { color: #ff7373; }
diff --git a/server.js b/server.js
index 11b225c..094026e 100644
--- a/server.js
+++ b/server.js
@@ -342,12 +342,25 @@ app.get('/api/version', (_req, res) => {
app.get('/', async (req, res, next) => {
const t0 = Date.now();
try {
+ // Today-PT window — computed once, applied per project so each card shows
+ // its own today contribution alongside fleet-wide totals.
+ const tzPT = 'America/Los_Angeles';
+ const todayStartMs = startOfDayInTz(todayInTz(tzPT), tzPT);
+ const todayEndMs = todayStartMs + 86400000;
const entries = await Promise.all(Object.entries(PROJECTS).map(async ([slug, p]) => {
const bundle = await getProjectBundle(slug, p).catch(() => null);
const count = bundle ? bundle.commits.length : 0;
const latest = bundle && bundle.commits[0] ? bundle.commits[0].dateISO.slice(0, 10) : '';
const ideas = bundle ? bundle.facets.ideas.length : 0;
- return { slug, p, count, latest, ideas };
+ let today = 0;
+ if (bundle) {
+ for (const c of bundle.commits) {
+ const t = new Date(c.dateISO).getTime();
+ if (t >= todayStartMs && t < todayEndMs) today++;
+ else if (t < todayStartMs) break; // commits are newest-first
+ }
+ }
+ return { slug, p, count, latest, ideas, today };
}));
const totalCommits = entries.reduce((a, e) => a + e.count, 0);
const totalIdeas = entries.reduce((a, e) => a + e.ideas, 0);
@@ -382,10 +395,10 @@ app.get('/', async (req, res, next) => {
const dayBuckets = fleetSpark.buckets;
const last24 = fleetSpark.last24;
const last7d = fleetSpark.last7d;
- const rows = entries.map(({ slug, p, count, latest, ideas }) => `<li class="bp-card">
+ const rows = entries.map(({ slug, p, count, latest, ideas, today }) => `<li class="bp-card">
<a href="/p/${esc(slug)}"><h2>${esc(p.name)}</h2></a>
<p>${esc(p.blurb)}</p>
- <p class="bp-meta">${count} commits · ${ideas} ideas · latest ${esc(latest)}</p>
+ <p class="bp-meta">${count} commits · ${ideas} ideas · latest ${esc(latest)}${today > 0 ? ` · <span class="bp-today" title="${today} commits today (PT)">${today} today</span>` : ''}</p>
</li>`).join('\n');
const jsonld = {
'@context': 'https://schema.org',
diff --git a/test/smoke.js b/test/smoke.js
index 26cae44..2562173 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -98,6 +98,7 @@ function check(name, cond, hint = '') {
check('home: top skills rail', /Top skills \+ agents/.test(r.body));
check('home: velocity line', /last 24h: <strong>\d+<\/strong>/.test(r.body));
check('home: delta arrow', /class="bp-delta bp-delta-(up|dn|eq)"/.test(r.body));
+ check('home: per-project today', /class="bp-today"/.test(r.body));
check('home: load badge', /class="bp-load (bp-load-ok|bp-load-warn|bp-load-hot)"/.test(r.body));
check('home: 7-day sparkline', /class="bp-spark"/.test(r.body));
check('home: deepest rationale rail', /Deepest rationale/.test(r.body));
← 83730dd home: trend delta arrow (↑/↓/—) between today and yesterday
·
back to build-pages
·
home: linkify 'latest YYYY-MM-DD' to its commit detail page 3d15f85 →