feat(dashboard): командный центр администратора на /dashboard

Админ при входе на /dashboard видит редизайн-обзор (порт макета
admin-dashboard-redesign.html) на реальных данных /api/admin/overview:
KPI-пульс со спарклайнами, инбокс «Требует внимания» с табами
(блокировки/зависшие/брошенные), лента топ-сессий, распределение по
предметам, здоровье контента, топ/худшие результаты, быстрые действия.
Стили заскоуплены под #admin-command-center. Учитель/ученик без изменений.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-05-31 10:58:43 +03:00
parent 29301ff87d
commit 8629616a04
2 changed files with 847 additions and 17 deletions
+94 -17
View File
@@ -67,20 +67,78 @@
text-decoration: none;
}
.ab-btn:hover { background: rgba(255,255,255,0.25); }
.action-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ac-card {
display: flex; align-items: center; gap: 12px;
padding: 14px 16px; border-radius: 14px;
background: #fff; border: 1.5px solid rgba(15,23,42,0.07);
text-decoration: none; color: inherit; transition: all 0.15s;
box-shadow: 0 2px 8px rgba(15,23,42,0.04);
/* ── Hero cards row (Reading · Lab of day · Pet) ── */
.hero-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hero-card {
position: relative; border-radius: 18px; padding: 18px 20px;
display: flex; flex-direction: column; min-height: 196px;
text-decoration: none; color: inherit; overflow: hidden;
transition: transform 0.16s, box-shadow 0.16s;
}
.ac-card:hover { border-color: rgba(155,93,229,0.25); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(15,23,42,0.08); }
.ac-emoji { font-size: 1.4rem; flex-shrink: 0; }
.ac-body { flex: 1; min-width: 0; }
.ac-title { font-size: 0.84rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-sub { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-badge { font-family: 'Unbounded', sans-serif; font-size: 0.82rem; font-weight: 800; color: var(--violet); flex-shrink: 0; }
.hero-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(15,23,42,0.16); }
.hc-tag {
display: inline-flex; align-items: center; gap: 7px;
font-size: 0.66rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
margin-bottom: 12px;
}
.hc-tag svg { width: 15px; height: 15px; }
.hc-h { font-family: 'Unbounded', sans-serif; font-size: 1.15rem; font-weight: 800; line-height: 1.15; }
.hc-p { font-size: 0.76rem; line-height: 1.45; margin-top: 7px; }
.hc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; }
.hc-meta { font-size: 0.7rem; font-weight: 600; }
.hc-btn {
display: inline-flex; align-items: center; gap: 6px;
padding: 7px 15px; border-radius: 99px; flex-shrink: 0;
font-family: 'Manrope', sans-serif; font-size: 0.78rem; font-weight: 700;
border: none; cursor: pointer; transition: filter 0.15s, transform 0.12s;
}
.hc-btn svg { width: 14px; height: 14px; }
.hc-btn:hover { filter: brightness(1.08); }
.hc-btn:active { transform: translateY(1px); }
.hc-progress { height: 6px; border-radius: 99px; margin-top: 12px; overflow: hidden; }
.hc-progress > i { display: block; height: 100%; border-radius: 99px; }
/* Card 1 — Reading (warm gradient) */
.hc-read { background: linear-gradient(135deg, #d9742a 0%, #b3531a 100%); color: #fff; }
.hc-read .hc-tag { color: rgba(255,255,255,.82); }
.hc-read .hc-p { color: rgba(255,255,255,.78); }
.hc-read .hc-meta { color: rgba(255,255,255,.7); }
.hc-read .hc-progress { background: rgba(255,255,255,.2); }
.hc-read .hc-progress > i { background: rgba(255,255,255,.92); }
.hc-read .hc-pct { font-family: 'Unbounded', sans-serif; font-weight: 800; font-size: 0.82rem; color: #fff; }
.hc-read .hc-btn { background: #fff; color: #b3531a; }
/* Card 2 — Lab of day (dark) */
.hc-lab { background: linear-gradient(150deg, #16131f 0%, #1d1830 100%); color: #fff; border: 1px solid rgba(155,93,229,.18); }
.hc-lab .hc-bg { position: absolute; inset: 0; opacity: .5; z-index: 0; }
.hc-lab .hc-bg svg { width: 100%; height: 100%; }
.hc-lab > *:not(.hc-bg) { position: relative; z-index: 1; }
.hc-lab .hc-tag { color: #06D6E0; }
.hc-lab .hc-tag svg { stroke: #06D6E0; }
.hc-lab .hc-p { color: rgba(255,255,255,.74); }
.hc-lab .hc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hc-lab .hc-chip { font-size: 0.66rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.82); }
.hc-lab .hc-chip.subj { background: rgba(6,214,224,.16); color: #06D6E0; }
.hc-lab .hc-meta { color: rgba(255,255,255,.6); }
.hc-lab .hc-btn { background: rgba(255,255,255,.12); color: #fff; backdrop-filter: blur(6px); }
/* Card 3 — Pet (light, accent top) */
.hc-pet { background: var(--surface, #fff); border: 1.5px solid rgba(15,23,42,.07); border-top: 3px solid #F9C74F; }
.hc-pet .hc-tag { color: #b3531a; }
.hc-pet .hc-tag svg { stroke: #F9C74F; }
.hc-pet .hc-pet-top { display: flex; align-items: center; gap: 10px; }
.hc-pet .hc-pet-name { font-family: 'Unbounded', sans-serif; font-size: 1.15rem; font-weight: 800; }
.hc-pet .hc-pet-art { width: 50px; height: 50px; margin-left: auto; flex-shrink: 0; }
.hc-pet .hc-pet-art svg { width: 100%; height: 100%; }
.hc-pet .hc-xp-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 12px; font-size: 0.7rem; color: var(--text-3); }
.hc-pet .hc-xp-row b { color: var(--text); font-weight: 800; }
.hc-pet .hc-progress { background: rgba(15,23,42,.07); }
.hc-pet .hc-progress > i { background: linear-gradient(90deg, #F9C74F, #F98231); }
.hc-pet .hc-pet-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.hc-pet .hc-pchip { text-align: center; padding: 6px 2px; border-radius: 10px; background: rgba(15,23,42,.04); }
.hc-pet .hc-pchip b { display: block; font-family: 'Unbounded', sans-serif; font-size: 0.86rem; font-weight: 800; color: var(--text); }
.hc-pet .hc-pchip span { display: block; font-size: 0.58rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-top: 2px; }
.hc-pet .hc-btn { background: rgba(249,199,79,.16); color: #b3531a; align-self: flex-start; }
/* ── ZONE 3: Three-Column Grid ── */
.main-grid {
@@ -1176,6 +1234,7 @@
/* Grids <svg class="ic" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg> single column */
.main-grid { grid-template-columns: 1fr; }
.action-cards { grid-template-columns: 1fr; }
.hero-row { grid-template-columns: 1fr; }
.admin-grid { grid-template-columns: 1fr; gap: 14px; }
.adm-actions { grid-template-columns: 1fr; gap: 10px; }
.adm-act-group { grid-template-columns: 1fr 1fr; }
@@ -1461,6 +1520,9 @@
</div>
</div>
<!-- ADMIN COMMAND CENTER: full redesign overview (admin only) -->
<div id="admin-command-center" style="display:none"></div>
<!-- ZONE 3: Three-Column Grid -->
<div class="main-grid">
<!-- Col 1: Assignments -->
@@ -1658,7 +1720,10 @@
<script src="/js/sound.js"></script>
<script src="/js/sidebar.js"></script>
<script src="/js/notifications.js"></script>
<script src="/js/pet-sprite.js"></script>
<script src="/js/lab-previews.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
<script src="/js/dashboard-admin-center.js"></script>
<script>
const { user, isTeacher, isAdmin } = LS.initPage();
if (!user) throw new Error('Not logged in');
@@ -1676,8 +1741,16 @@
document.getElementById('dh-sub').textContent = user?.role === 'admin' ? 'Панель администратора' : 'Панель учителя';
// teacher/admin: hide student-only widgets, show admin compact layout
document.querySelectorAll('.action-zone,.main-grid,#w-theory-progress,.full-row').forEach(el => { if (el) el.style.display = 'none'; });
document.getElementById('admin-actions-zone').style.display = '';
document.getElementById('admin-grid').style.display = '';
if (isAdmin) {
// admin: full command center (redesign) instead of compact layout
const dh = document.querySelector('.dash-header'); if (dh) dh.style.display = 'none';
document.getElementById('admin-actions-zone').style.display = 'none';
document.getElementById('admin-grid').style.display = 'none';
document.getElementById('admin-command-center').style.display = '';
} else {
document.getElementById('admin-actions-zone').style.display = '';
document.getElementById('admin-grid').style.display = '';
}
} else {
// Приветствие по времени суток
const h = new Date().getHours();
@@ -4098,8 +4171,12 @@
}).join('');
}
if (isTeacher) {
// Admin/Teacher: compact admin layout
if (isAdmin) {
// Admin: command center (redesign) on real /api/admin/overview data
const ccEl = document.getElementById('admin-command-center');
if (ccEl && window.DashAdminCenter) DashAdminCenter.mount(ccEl);
} else if (isTeacher) {
// Teacher: compact admin layout
loadAdminStats();
loadTeacherKPIs();
loadAdminAssignments();