Actualiser assets/js/app.js
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled

This commit is contained in:
2026-06-17 12:40:27 +00:00
parent b97845553e
commit df0a47e336
+18 -1
View File
@@ -1333,12 +1333,25 @@ function _showExportModal() {
document.getElementById('modal-overlay').style.display = 'flex';
}
const LOCATIONS = {
let LOCATIONS = {
'dispensa': { icon: '🗄️', label: t('locations.dispensa') },
'frigo': { icon: '🧊', label: t('locations.frigo') },
'freezer': { icon: '❄️', label: t('locations.freezer') },
'altro': { icon: '📦', label: t('locations.altro') },
};
async function loadCustomLocations() {
try {
const result = await api('locations_list', {}, 'GET');
if (result.success && Array.isArray(result.locations)) {
result.locations.forEach(loc => {
if (loc.is_builtin) return; // built-ins already have translated labels above
LOCATIONS[loc.key] = { icon: loc.icon || '📦', label: loc.label };
});
}
} catch (e) {
console.warn('[EverShelf] Could not load custom locations:', e);
}
}
const CATEGORY_ICONS = {
'latticini': '🥛', 'carne': '🥩', 'pesce': '🐟', 'frutta': '🍎',
'verdura': '🥬', 'pasta': '🍝', 'pane': '🍞', 'surgelati': '🧊',
@@ -19524,11 +19537,15 @@ function startHeartbeat() {
_runHeartbeat(); // immediate first probe
}
async function _initApp() {
// ── Startup health check (runs during splash, blocks app if critical) ──────
const _startupOk = await _runStartupCheck();
if (!_startupOk) return; // preloader stays visible with error; app does not start
// Load custom locations (merges into LOCATIONS before any UI renders)
await loadCustomLocations();
// Check for setup wizard resume (after language change)
const resumeStep = localStorage.getItem('evershelf_setup_step');
const resumeData = localStorage.getItem('evershelf_setup_data');