Files
kanbante/static/js/wall.js
T
Spark af59417d07 feat(wall): Wallboard plein écran /wall — issue #14 de la feuille de route
Rotation automatique entre projets actifs (30 s), compteurs des
six colonnes, cartes en vol avec âge, fermées du jour (journal),
horloge; rafraîchissement en direct par le flux SSE (rechargement,
aucune interaction à protéger) + filet de sécurité à 5 min.
?repo= fige un projet. Lien de navigation ajouté partout.
2026-10-11 12:26:12 -04:00

43 lines
1.5 KiB
JavaScript

/**
* Kanbante — Wallboard: slide rotation, clock, live refresh.
*
* The wall is a display, not a workspace: no interaction to protect,
* so a realtime event simply reloads the page (plus a slow safety
* reload in case the stream drops silently).
*/
(function () {
var slides = Array.from(document.querySelectorAll('.wall-slide'));
var ROTATE_MS = 30000;
var current = 0;
if (slides.length > 1) {
setInterval(function () {
slides[current].classList.remove('active');
current = (current + 1) % slides.length;
slides[current].classList.add('active');
}, ROTATE_MS);
}
function tickClock() {
var now = new Date();
var time = now.toLocaleTimeString('fr-CA', { hour: '2-digit', minute: '2-digit' });
var date = now.toLocaleDateString('fr-CA', {
weekday: 'long', day: 'numeric', month: 'long',
});
document.querySelectorAll('[data-clock]').forEach(function (el) { el.textContent = time; });
document.querySelectorAll('[data-date]').forEach(function (el) { el.textContent = date; });
}
tickClock();
setInterval(tickClock, 15000);
// Live: any board activity refreshes the wall.
try {
var source = new EventSource('/api/stream');
source.onmessage = function () { location.reload(); };
} catch (err) {
console.warn('Wallboard live stream unavailable:', err);
}
// Safety net.
setTimeout(function () { location.reload(); }, 5 * 60 * 1000);
})();