diff --git a/frontend/dashboard.html b/frontend/dashboard.html index 396d170..6f3b6eb 100644 --- a/frontend/dashboard.html +++ b/frontend/dashboard.html @@ -3670,12 +3670,25 @@ document.getElementById('act-cal-pane').classList.toggle('visible', tab === 'calendar'); } + /* Колонка прогресса (#w-progress-col) — это один .widget-бокс с тремя секциями + (карточка / по предметам / результаты). Если все секции скрыты (напр. флешкарты + отключены и нет данных) — прячем сам бокс, иначе висит пустая рамка. */ + function syncProgressCol() { + const col = document.getElementById('w-progress-col'); + if (!col) return; + const any = ['w-flashcard', 'w-subj-progress', 'w-last-results'].some(id => { + const e = document.getElementById(id); + return e && getComputedStyle(e).display !== 'none'; + }); + col.style.display = any ? '' : 'none'; + } + /* ══ WIDGET: Last results (compact, 5 items) ══════════════════════ */ function loadLastResultsWidget(rows) { const w = document.getElementById('w-last-results'); if (!w) return; const completed = (rows || []).filter(r => r.score !== null && r.total > 0).slice(0, 5); - if (!completed.length) { w.style.display = 'none'; return; } + if (!completed.length) { w.style.display = 'none'; syncProgressCol(); return; } w.style.display = ''; document.getElementById('last-results-list').innerHTML = completed.map(h => { const pct = Math.round(h.score / h.total * 100); @@ -3689,6 +3702,7 @@ `; }).join(''); + syncProgressCol(); } /* ══ WIDGET: Subject progress bars ════════════════════════════════ */ @@ -3702,7 +3716,7 @@ bySubj[r.subject_slug].scores.push(Math.round(r.score / r.total * 100)); }); const entries = Object.entries(bySubj); - if (!entries.length) { w.style.display = 'none'; return; } + if (!entries.length) { w.style.display = 'none'; syncProgressCol(); return; } w.style.display = ''; document.getElementById('subj-progress-bars').innerHTML = entries.map(([slug, d]) => { const avg = Math.round(d.scores.reduce((a, b) => a + b, 0) / d.scores.length); @@ -3713,6 +3727,7 @@ ${avg}% `; }).join(''); + syncProgressCol(); } /* ══ WIDGET: Theory progress ══════════════════════════════════════ */ @@ -4298,6 +4313,7 @@ renderFlashcardWidget(r); w.style.display = ''; } catch { /* фича выключена или ошибка — оставляем скрытым */ } + syncProgressCol(); // если карточка скрыта и нет прогресса/результатов — спрятать бокс } function renderFlashcardWidget(r) {