ui: live timers, Berlin timestamps, ZIP failure reports, drop kill-switch/Fehler tab
* remove the kill-switch: auto-apply toggle is the single on/off; manual
'Bewerben' button now only gated by apply reachability; circuit breaker
stays but only gates auto-apply (manual bypasses, so a user can retry)
* Berlin-timezone date filter (de_dt) formats timestamps as DD.MM.YYYY HH:MM
everywhere; storage stays UTC
* Wohnungen: live 'entdeckt vor X' on every flat + 'nächste Aktualisierung in Xs'
countdown in the header, driven by /static/app.js; HTMX polls body every 30s
* drop the Fehler tab entirely; failed applications now carry a
'Fehler-Report herunterladen (ZIP)' link -> /bewerbungen/{id}/report.zip
bundles application.json, flat.json, profile_snapshot.json, forensics.json,
step_log.txt, page.html, console/errors/network JSONs, and decoded
screenshots/*.jpg for AI-assisted debugging
* trim the 'sensibel' blurb from the Profil tab
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c630b500ef
commit
332d9eea19
13 changed files with 429 additions and 343 deletions
49
web/static/app.js
Normal file
49
web/static/app.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// lazyflat — live time helpers.
|
||||
// Any element with [data-rel-utc="<iso>"] gets its text replaced every 5s
|
||||
// with a German relative-time string ("vor 3 min"). Elements with
|
||||
// [data-countdown-utc="<iso>"] show "in Xs" counting down each second.
|
||||
|
||||
function fmtRelative(iso) {
|
||||
const ts = Date.parse(iso);
|
||||
if (!iso || Number.isNaN(ts)) return "—";
|
||||
const diff = Math.max(0, Math.floor((Date.now() - ts) / 1000));
|
||||
if (diff < 5) return "gerade eben";
|
||||
if (diff < 60) return `vor ${diff} s`;
|
||||
if (diff < 3600) return `vor ${Math.floor(diff / 60)} min`;
|
||||
if (diff < 86400) return `vor ${Math.floor(diff / 3600)} h`;
|
||||
return `vor ${Math.floor(diff / 86400)} Tagen`;
|
||||
}
|
||||
|
||||
function fmtCountdown(iso) {
|
||||
const ts = Date.parse(iso);
|
||||
if (!iso || Number.isNaN(ts)) return "—";
|
||||
const secs = Math.floor((ts - Date.now()) / 1000);
|
||||
if (secs <= 0) return "Aktualisierung läuft…";
|
||||
if (secs < 60) return `in ${secs} s`;
|
||||
if (secs < 3600) return `in ${Math.floor(secs / 60)} min`;
|
||||
return `in ${Math.floor(secs / 3600)} h`;
|
||||
}
|
||||
|
||||
function updateRelativeTimes() {
|
||||
document.querySelectorAll("[data-rel-utc]").forEach((el) => {
|
||||
el.textContent = fmtRelative(el.dataset.relUtc);
|
||||
});
|
||||
}
|
||||
|
||||
function updateCountdowns() {
|
||||
document.querySelectorAll("[data-countdown-utc]").forEach((el) => {
|
||||
el.textContent = fmtCountdown(el.dataset.countdownUtc);
|
||||
});
|
||||
}
|
||||
|
||||
function tick() {
|
||||
updateRelativeTimes();
|
||||
updateCountdowns();
|
||||
}
|
||||
|
||||
// Run immediately + on intervals. Also re-run after HTMX swaps so freshly
|
||||
// injected DOM gets formatted too.
|
||||
document.addEventListener("DOMContentLoaded", tick);
|
||||
document.body && document.body.addEventListener("htmx:afterSwap", tick);
|
||||
setInterval(updateCountdowns, 1000);
|
||||
setInterval(updateRelativeTimes, 5000);
|
||||
Loading…
Add table
Add a link
Reference in a new issue