diff --git a/assets/js/app.js b/assets/js/app.js index b479b61..c468d6e 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -5197,20 +5197,30 @@ function _applyInsightPhase() { // ===== DASHBOARD ===== function renderDashboardLocationCards(counts) { - const container = document.getElementById('dashboard-location-cards'); - if (!container) return; + const statsContainer = document.getElementById('dashboard-stats'); + if (!statsContainer) return; const keys = Object.keys(LOCATIONS); - container.innerHTML = keys.map(key => { + const cardsHtml = keys.map(key => { const info = LOCATIONS[key]; const count = counts[key] !== undefined ? counts[key] : '-'; return ` -
+
${info.icon} ${count} ${escapeHtml(info.label)}
`; }).join(''); + + // Remove previously injected location cards (keep the static "Courses" card) + statsContainer.querySelectorAll('.stat-card-location').forEach(el => el.remove()); + // Insert before the Courses card (first remaining child) + const shoppingCard = statsContainer.querySelector('.stat-card'); + if (shoppingCard) { + shoppingCard.insertAdjacentHTML('beforebegin', cardsHtml); + } else { + statsContainer.insertAdjacentHTML('afterbegin', cardsHtml); + } } async function loadDashboard() { // Render one card per known location, with shimmer while loading