[claude] Re-implement Bitcoin block height counter (#480) (#495)
Some checks failed
Deploy Nexus / deploy (push) Has been cancelled

This commit was merged in pull request #495.
This commit is contained in:
2026-03-25 03:06:48 +00:00
parent 518717f820
commit 6ae5e40cc7
3 changed files with 74 additions and 0 deletions

32
app.js
View File

@@ -1695,4 +1695,36 @@ function triggerHarnessPulse() {
}
}
// === BITCOIN BLOCK HEIGHT ===
(function initBitcoin() {
const blockHeightDisplay = document.getElementById('block-height-display');
const blockHeightValue = document.getElementById('block-height-value');
if (!blockHeightDisplay || !blockHeightValue) return;
let lastKnownBlockHeight = null;
async function fetchBlockHeight() {
try {
const res = await fetch('https://blockstream.info/api/blocks/tip/height');
if (!res.ok) return;
const height = parseInt(await res.text(), 10);
if (isNaN(height)) return;
if (lastKnownBlockHeight !== null && height !== lastKnownBlockHeight) {
blockHeightDisplay.classList.remove('fresh');
void blockHeightDisplay.offsetWidth;
blockHeightDisplay.classList.add('fresh');
}
lastKnownBlockHeight = height;
blockHeightValue.textContent = height.toLocaleString();
} catch (_) {
// Network unavailable
}
}
fetchBlockHeight();
setInterval(fetchBlockHeight, 60000);
})();
init();

View File

@@ -155,6 +155,12 @@
</div>
</div>
<!-- Bitcoin Block Height -->
<div id="block-height-display">
<span class="block-height-label">⛏ BLOCK</span>
<span id="block-height-value"></span>
</div>
<!-- Click to Enter -->
<div id="enter-prompt" style="display:none;">
<div class="enter-content">

View File

@@ -625,6 +625,42 @@ canvas#nexus-canvas {
color: var(--color-primary);
}
/* === BITCOIN BLOCK HEIGHT === */
#block-height-display {
position: fixed;
bottom: 12px;
right: 12px;
z-index: 20;
font-family: var(--font-body);
font-size: 11px;
letter-spacing: 0.15em;
color: var(--color-primary);
background: rgba(0, 0, 8, 0.7);
border: 1px solid var(--color-secondary);
padding: 4px 10px;
pointer-events: none;
white-space: nowrap;
}
.block-height-label {
color: var(--color-text-muted);
margin-right: 6px;
font-size: 10px;
}
#block-height-value {
color: var(--color-primary);
}
#block-height-display.fresh #block-height-value {
animation: block-flash 0.6s ease-out;
}
@keyframes block-flash {
0% { color: #ffffff; text-shadow: 0 0 8px #4488ff; }
100% { color: var(--color-primary); text-shadow: none; }
}
/* Mobile adjustments */
@media (max-width: 480px) {
.chat-panel {