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

View File

@@ -9,19 +9,26 @@
<link rel="shortcut icon" href="/static/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png">
<link rel="stylesheet" href="/static/style.css">
<script src="/static/app.js" defer></script>
</head>
<body>
<header class="topbar">
<span class="brand"><img src="/static/logo.png" alt="" class="brand-logo" width="28" height="28">MyWhoosh &rarr; Garmin Sync</span>
<nav>
{% if request.session.get('admin_authenticated') %}
<a href="/">Dashboard</a>
<a href="/system">System</a>
<div class="topbar-right">
<nav>
{% if request.session.get('admin_authenticated') %}
<a href="/">Dashboard</a>
<a href="/system">System</a>
{% endif %}
{% if request.session.get('self_service_user_id') %}
<a href="/account">My Account</a>
{% endif %}
</nav>
{% set next_tick = next_sync_tick(request) %}
{% if next_tick %}
<span class="sync-status">Next sync: <time class="next-sync" datetime="{{ next_tick.isoformat() }}" data-utc="{{ next_tick.isoformat() }}">{{ next_tick.strftime('%Y-%m-%d %H:%M UTC') }}</time></span>
{% endif %}
{% if request.session.get('self_service_user_id') %}
<a href="/account">My Account</a>
{% endif %}
</nav>
</div>
</header>
<main class="container">
{% block content %}{% endblock %}