[object Object]

← back to Ventura Corridor

feat(news): news counts in homepage build-status strip

b8a21eb71a2355e5c7cf0aaf1a0b563630a67faf · 2026-05-07 22:28:09 -0700 · SteveStudio2

Three new live counters in the always-visible strip across the top of /:
News articles | News biz | Fresh ‹7d. Click "News articles" to jump
to /news.html.

API change:
  /api/build-status   +news_total, +news_biz, +news_fresh_7d in counts{}

UI change:
  public/index.html   3 new b-strip cells; setNews() helper handles
                      the inner <a> wrapper so the link stays intact
                      when the count refreshes.

First-glance signal: 76 articles / 46 biz / 76 fresh in last 7 days
right now. Drops automatically as articles age out of the 7-day window.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit b8a21eb71a2355e5c7cf0aaf1a0b563630a67faf
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Thu May 7 22:28:09 2026 -0700

    feat(news): news counts in homepage build-status strip
    
    Three new live counters in the always-visible strip across the top of /:
    News articles | News biz | Fresh ‹7d. Click "News articles" to jump
    to /news.html.
    
    API change:
      /api/build-status   +news_total, +news_biz, +news_fresh_7d in counts{}
    
    UI change:
      public/index.html   3 new b-strip cells; setNews() helper handles
                          the inner <a> wrapper so the link stays intact
                          when the count refreshes.
    
    First-glance signal: 76 articles / 46 biz / 76 fresh in last 7 days
    right now. Drops automatically as articles age out of the 7-day window.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 public/index.html   | 7 +++++++
 src/server/index.ts | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/public/index.html b/public/index.html
index d476523..a2479d1 100644
--- a/public/index.html
+++ b/public/index.html
@@ -118,6 +118,9 @@
     <span>SEO scored</span><b id="b-scored">—</b>
     <span>Ownership classified</span><b id="b-enriched">—</b>
     <span>With LinkedIn contact</span><b id="b-owner">—</b>
+    <span><a href="/news.html" style="color:inherit;text-decoration:none;border-bottom:1px dotted var(--metal)">News articles</a></span><b id="b-news"><a href="/news.html" style="color:var(--metal-glow);text-decoration:none">—</a></b>
+    <span>News biz</span><b id="b-news-biz">—</b>
+    <span>Fresh ‹7d</span><b id="b-news-7d">—</b>
   </div>
   <div class="b-divider"></div>
   <div class="b-tier">
@@ -419,6 +422,10 @@ async function loadBuildStatus() {
     set('b-scored', c.scored);
     set('b-enriched', c.enriched);
     set('b-owner', c.with_owner_contact);
+    const setNews = (id, v) => { const e = document.getElementById(id); if (e) { const a = e.querySelector('a'); if (a) a.textContent = (v ?? 0).toLocaleString(); else e.textContent = (v ?? 0).toLocaleString(); } };
+    setNews('b-news', c.news_total);
+    setNews('b-news-biz', c.news_biz);
+    setNews('b-news-7d', c.news_fresh_7d);
     set('b-A', c.tier_a);
     set('b-B', c.tier_b);
     set('b-C', c.tier_c);
diff --git a/src/server/index.ts b/src/server/index.ts
index 070c535..d2a66d3 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -264,6 +264,9 @@ app.get('/api/build-status', async (_req, res) => {
       UNION ALL SELECT 'class_independent', COUNT(*)::text FROM business_enrichment WHERE ownership_class='independent'
       UNION ALL SELECT 'class_corporate', COUNT(*)::text FROM business_enrichment WHERE ownership_class='corporate'
       UNION ALL SELECT 'class_franchise', COUNT(*)::text FROM business_enrichment WHERE ownership_class='franchise'
+      UNION ALL SELECT 'news_total', COUNT(*)::text FROM news_items
+      UNION ALL SELECT 'news_biz', COUNT(DISTINCT business_id)::text FROM news_items
+      UNION ALL SELECT 'news_fresh_7d', COUNT(*)::text FROM news_items WHERE fetched_at > now() - interval '7 days'
     `);
     const out: Record<string, number> = {};
     for (const row of r.rows) out[row.key] = parseInt(row.value, 10);

← dab6585 feat(coverage): idea-loop feed bridge on /coverage.html  ·  back to Ventura Corridor  ·  feat(news): vertical filter dropdown on /news.html 8172d93 →