hbox-docs/docs/js/standup.js

23 lines
1.4 KiB
JavaScript

/* Standup diario (27-oct-2026): si el bot ya te dejó tu parte del día y no has contestado, franja arriba con la liga
a /tableros/standup/. Lo dice GET /api/standup/estado. No aparece en la propia página del standup. */
(function () {
if (/\/tableros\/standup\/?$/.test(location.pathname)) return;
function arrancar() {
fetch('/api/standup/estado', { cache: 'no-store', credentials: 'same-origin' })
.then(function (r) { return r.ok ? r.json() : null; })
.then(function (j) {
if (!j || !j.pendiente || document.querySelector('.hg-standup')) return;
var d = document.createElement('div');
d.className = 'hg-standup'; d.setAttribute('role', 'status');
var hoy = new Date(); var f = hoy.getFullYear() + '-' + String(hoy.getMonth() + 1).padStart(2, '0') + '-' + String(hoy.getDate()).padStart(2, '0');
d.innerHTML = '<b>Tu standup ' + (j.fecha === f ? 'de hoy' : 'del ' + j.fecha.slice(8) + '/' + j.fecha.slice(5, 7)) + ' te espera:</b> '
+ 'tus instrucciones del día y tres preguntas sobre tus pendientes. <a href="/tableros/standup/">Contestar (2 minutos)</a>';
var main = document.querySelector('.md-main');
if (main) main.parentNode.insertBefore(d, main); else document.body.insertBefore(d, document.body.firstChild);
})
.catch(function () {});
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', arrancar);
else arrancar();
})();