feat(dashboard): version loading indicator + immediate first poll (#181)

* feat(dashboard): show version loading indicator and fire poll immediately

- Show "Verificando..." while /api/version resolves on first load
- Fire first version poll immediately instead of waiting 15s
- Fallback to "-" when version is unavailable

* i18n: localize the version-check loading label

The sidebar version indicator hard-coded the Spanish string 'Verificando...',
shipping it to every user regardless of locale. Route it through i18n instead:
new 'common.checking' key (en: 'Checking...', es: 'Verificando...'); all other
locales fall back to the English canonical, matching the rest of the UI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: ScreenTinker <hello@screentinker.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Fabian Mendoza 2026-07-14 13:59:42 -04:00 committed by GitHub
parent f10373551f
commit 87a1e02ff3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

View file

@ -570,10 +570,15 @@ let knownHash = null;
export function updateVersionIndicator({ version, latest_version, update_available }) {
const label = document.getElementById('versionLabel');
const badge = document.getElementById('versionBadge');
if (label) label.textContent = version ? 'v' + version : '';
if (label) label.textContent = version ? 'v' + version : '-';
if (badge) badge.hidden = !update_available;
}
setInterval(async () => {
// Show loading state while first poll resolves
const verLabel = document.getElementById('versionLabel');
if (verLabel) verLabel.textContent = t('common.checking');
async function checkVersion() {
try {
const res = await fetch('/api/version');
const data = await res.json();
@ -590,7 +595,9 @@ setInterval(async () => {
}
updateVersionIndicator(data);
} catch {}
}, 15000);
}
checkVersion(); // Fire first poll immediately
setInterval(checkVersion, 15000);
// Session timeout warning - check JWT expiry every minute
if (isAuthenticated()) {

View file

@ -35,6 +35,7 @@ export default {
'common.saving': 'Saving...',
'common.deleting': 'Deleting...',
'common.loading': 'Loading...',
'common.checking': 'Checking...',
'confirm_delete.type_label': 'Type "{name}" to confirm',
'confirm_delete.failed': 'Action failed',
'common.connected': 'Connected',

View file

@ -31,6 +31,7 @@ export default {
'common.edit': 'Editar',
'common.done': 'Listo',
'common.loading': 'Cargando...',
'common.checking': 'Verificando...',
'common.connected': 'Conectado',
'common.disconnected': 'Desconectado',
'common.never': 'Nunca',