Show next scheduled sync time on every page

Exposes the scheduler's next_tick in the topbar via a safe Jinja
helper (falls back to nothing if the scheduler isn't running yet),
and converts the server-rendered UTC timestamp to the visitor's local
time client-side so it reads correctly regardless of timezone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Bastian Wagner
2026-08-16 10:58:53 +02:00
parent 5d75aa328d
commit a74ab95f3f
5 changed files with 93 additions and 8 deletions

10
app/web/static/app.js Normal file
View File

@@ -0,0 +1,10 @@
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("time[data-utc]").forEach((el) => {
const date = new Date(el.dataset.utc);
if (Number.isNaN(date.getTime())) {
return;
}
el.textContent = date.toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" });
el.title = `${el.dataset.utc} (UTC)`;
});
});

View File

@@ -64,12 +64,36 @@ a:hover {
border-radius: 7px;
}
.topbar-right {
display: flex;
align-items: center;
gap: 1.25rem;
flex-wrap: wrap;
}
.topbar nav {
display: flex;
gap: 1.25rem;
font-size: 0.9rem;
}
.sync-status {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.3rem 0.7rem;
border-radius: 999px;
background: var(--info-bg);
color: var(--info);
font-size: 0.78rem;
font-weight: 600;
white-space: nowrap;
}
.sync-status time {
font-weight: 700;
}
.container {
max-width: 960px;
margin: 0 auto;