Skip to content

Commit 6c31b5e

Browse files
committed
Fix topbar earnings on all pages and theme label duplication
1 parent 7b11091 commit 6c31b5e

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

app/static/css/style.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,7 @@ img { max-width: 100%; }
288288
#theme-toggle .icon-moon { display: none; }
289289
:root[data-theme="light"] #theme-toggle .icon-sun { display: none; }
290290
:root[data-theme="light"] #theme-toggle .icon-moon { display: block; }
291-
/* Theme label text */
292-
#theme-toggle .theme-label::after { content: 'Light mode'; }
293-
:root[data-theme="light"] #theme-toggle .theme-label::after { content: 'Dark mode'; }
291+
/* Theme label text — set via JS updateLabel() */
294292

295293
/* Avatar button + dropdown */
296294
.topbar-avatar-wrap {

app/static/js/app.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ const CP = (() => {
149149
} catch { /* keep defaults */ }
150150
}
151151

152+
async function loadTopbarEarnings() {
153+
try {
154+
await loadExchangeRates();
155+
const data = await api('/api/earnings/summary');
156+
setTextContent('topbar-total', formatCurrency(data.total || 0));
157+
} catch {
158+
setTextContent('topbar-total', formatCurrency(0));
159+
}
160+
}
161+
152162
async function loadDashboard() {
153163
await loadExchangeRates();
154164
await Promise.all([
@@ -1650,6 +1660,9 @@ const CP = (() => {
16501660
_displayCurrency = localStorage.getItem('cp-display-currency') || detectDefaultCurrency();
16511661
initTopbarCurrency();
16521662

1663+
// Load topbar earnings on every page
1664+
loadTopbarEarnings();
1665+
16531666
const page = document.body.dataset.page;
16541667
switch (page) {
16551668
case 'dashboard':

0 commit comments

Comments
 (0)