Show midnight change below heading
pull-request / validate (pull_request) Successful in 12s

This commit is contained in:
2026-09-17 14:53:05 +02:00
parent b5bbde8acb
commit 0c86cf3b59
2 changed files with 10 additions and 0 deletions
+6
View File
@@ -47,6 +47,7 @@ HOME_HTML = """\
<div class="mx-auto max-w-lg px-4 py-6">
<header class="text-center mb-8">
<h1 class="text-3xl font-bold text-gray-900">BTC Price</h1>
<p id="midnight-change" class="mt-1 text-sm text-gray-400">&nbsp;</p>
</header>
<div id="price-panel" hx-ext="ws" ws-connect="/ws/price">
<div id="price-display">
@@ -101,6 +102,11 @@ HOME_HTML = """\
const change = currentPrice - midnightPrice;
const formattedChange = formatPriceChange(change);
document.title = price + ' | ' + formattedChange;
const midnightChange = document.getElementById('midnight-change');
midnightChange.textContent = formattedChange;
midnightChange.className = 'mt-1 text-sm font-bold ' + (
change > 0 ? 'text-green-600' : change < 0 ? 'text-red-600' : 'text-gray-500'
);
} else if (price) {
document.title = price + ' | BTC Price';
}