From 399a222b6561232c272dd5e6dc1644c0c9fa7443 Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Tue, 23 Jun 2026 00:26:33 +0300 Subject: [PATCH] =?UTF-8?q?fix(dashboard):=20=D0=BF=D1=83=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=B1=D0=BE=D0=BA=D1=81=20=D0=BA=D0=BE=D0=BB?= =?UTF-8?q?=D0=BE=D0=BD=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B5?= =?UTF-8?q?=D1=81=D1=81=D0=B0,=20=D0=BA=D0=BE=D0=B3=D0=B4=D0=B0=20=D1=84?= =?UTF-8?q?=D0=BB=D0=B5=D1=88=D0=BA=D0=B0=D1=80=D1=82=D1=8B=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #w-flashcard прятался, но он — секция внутри #w-progress-col (один .widget-бокс с рамкой/паддингом: карточка + прогресс по предметам + результаты). Если все секции скрыты (флешкарты выкл и нет данных), оставался пустой бокс. Добавлена syncProgressCol(): прячет #w-progress-col, если ни одна секция не видна (computed- display, учитывает и инъект-CSS флешкарт). Зовётся в конце loadFlashcardWidget / loadLastResultsWidget / loadSubjProgressWidget. Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/dashboard.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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) {