[object Object]

← back to Ventura Corridor

feat(news): "Hot only" toggle on /news.html filter bar

4927f547d91b39d9be4d3b15ca856cace9a2873f · 2026-05-07 23:00:16 -0700 · SteveStudio2

Editors can isolate the 10 hot publishers (fresh_7d >= 3) from the
firehose with one click. Toggle button next to the search/sort/vertical
controls; reuses /api/news/leaderboard to fetch the hot biz ID set on
first activation, then filters client-side. Restores to all-rows on
toggle off.

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

Files touched

Diff

commit 4927f547d91b39d9be4d3b15ca856cace9a2873f
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Thu May 7 23:00:16 2026 -0700

    feat(news): "Hot only" toggle on /news.html filter bar
    
    Editors can isolate the 10 hot publishers (fresh_7d >= 3) from the
    firehose with one click. Toggle button next to the search/sort/vertical
    controls; reuses /api/news/leaderboard to fetch the hot biz ID set on
    first activation, then filters client-side. Restores to all-rows on
    toggle off.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 public/news.html | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/public/news.html b/public/news.html
index 4e07741..c2ff8fe 100644
--- a/public/news.html
+++ b/public/news.html
@@ -84,6 +84,7 @@ select{background:var(--noir-rise);color:var(--ink);border:1px solid var(--rule)
         <option value="biz">By business A→Z</option>
         <option value="title">By title A→Z</option>
       </select>
+      <button id="hot-only" type="button" style="background:transparent;border:1px solid var(--rule);color:var(--ink-mute);padding:9px 14px;font-family:inherit;font-size:11px;letter-spacing:.18em;text-transform:uppercase;cursor:pointer">🔥 Hot only</button>
     </div>
     <div style="font-family:'JetBrains Mono',monospace;font-size:10px;color:var(--ink-mute)" id="status">loading…</div>
   </div>
@@ -105,6 +106,8 @@ const truncate = (s, n) => {
   return s.length > n ? s.slice(0, n - 1).replace(/\s+\S*$/, '') + '…' : s;
 };
 
+let HOT_ONLY = false;
+let HOT_BIZ_IDS = null; // populated from /api/news/leaderboard on demand
 function render() {
   const q = (document.getElementById('q').value || '').toLowerCase().trim();
   const sort = document.getElementById('sort').value;
@@ -120,6 +123,9 @@ function render() {
   if (vertical) {
     rows = rows.filter(r => (r.category || '').toLowerCase().startsWith(vertical.toLowerCase()));
   }
+  if (HOT_ONLY && HOT_BIZ_IDS) {
+    rows = rows.filter(r => HOT_BIZ_IDS.has(r.business_id));
+  }
   rows = rows.slice();
   if (sort === 'biz') {
     rows.sort((a, b) => (a.business_name||'').localeCompare(b.business_name||''));
@@ -188,6 +194,26 @@ async function load() {
 document.getElementById('q').addEventListener('input', () => render());
 document.getElementById('sort').addEventListener('change', () => render());
 document.getElementById('vertical').addEventListener('change', () => render());
+document.getElementById('hot-only').addEventListener('click', async () => {
+  HOT_ONLY = !HOT_ONLY;
+  const btn = document.getElementById('hot-only');
+  if (HOT_ONLY) {
+    btn.style.background = 'var(--metal-glow)';
+    btn.style.color = '#0a0a0c';
+    btn.style.borderColor = 'var(--metal-glow)';
+    if (!HOT_BIZ_IDS) {
+      try {
+        const lb = await fetch('/api/news/leaderboard').then(r => r.json());
+        HOT_BIZ_IDS = new Set((lb.rows || []).filter(r => Number(r.fresh_7d) >= 3).map(r => Number(r.id)));
+      } catch { HOT_BIZ_IDS = new Set(); }
+    }
+  } else {
+    btn.style.background = 'transparent';
+    btn.style.color = 'var(--ink-mute)';
+    btn.style.borderColor = 'var(--rule)';
+  }
+  render();
+});
 load();
 </script>
 </body>

← df2073d feat(coverage): per-type accept-rate mini-bars in idea-loop  ·  back to Ventura Corridor  ·  feat(fleet): Mac1+Mac2 dashboard bridge on corridor homepage 4a0ab3d →