diff --git a/frontend/css/ls.css b/frontend/css/ls.css index fd023b2..337a090 100644 --- a/frontend/css/ls.css +++ b/frontend/css/ls.css @@ -528,32 +528,53 @@ body { .notif-drop { position: fixed; left: 246px; - width: 320px; - max-height: 420px; + width: 340px; + max-height: 460px; overflow-y: auto; background: #fff; border: 1.5px solid var(--border-h); - border-radius: 16px; - box-shadow: 0 12px 48px rgba(15,23,42,0.14); + border-radius: 18px; + box-shadow: 0 16px 56px rgba(15,23,42,.16), 0 4px 16px rgba(15,23,42,.06); z-index: 1000; display: none; - font-size: 0.82rem; + font-size: .82rem; color: var(--text-2); } .notif-drop.open { display: block; } -.notif-drop-header { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px 9px; border-bottom: 1px solid var(--border); } -.notif-drop-title { font-family: 'Unbounded', sans-serif; font-size: 0.77rem; font-weight: 800; } -.notif-read-all { background: none; border: none; font-size: 0.72rem; color: var(--violet); cursor: pointer; font-family: 'Manrope', sans-serif; font-weight: 600; padding: 0; } +.notif-drop-header { + display: flex; align-items: center; justify-content: space-between; + padding: 14px 16px 11px; border-bottom: 1px solid var(--border); + position: sticky; top: 0; background: #fff; z-index: 1; + border-radius: 18px 18px 0 0; +} +.notif-drop-header-left { display: flex; align-items: center; gap: 8px; } +.notif-drop-title { font-family: 'Unbounded', sans-serif; font-size: .77rem; font-weight: 800; color: var(--text); } +.notif-unread-badge { background: var(--violet); color: #fff; font-size: .62rem; font-weight: 800; + padding: 2px 7px; border-radius: 20px; font-family: 'Unbounded', sans-serif; line-height: 1.4; } +.notif-read-all { background: none; border: none; font-size: .72rem; color: var(--violet); + cursor: pointer; font-family: 'Manrope', sans-serif; font-weight: 600; + padding: 0; white-space: nowrap; } .notif-read-all:hover { text-decoration: underline; } -.notif-item { display: flex; gap: 9px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; text-decoration: none; color: inherit; transition: background var(--tr); } -.notif-item:last-child { border-bottom: none; } -.notif-item:hover { background: rgba(155,93,229,0.04); } -.notif-item.unread { background: rgba(155,93,229,0.06); } -.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--violet); flex-shrink: 0; margin-top: 5px; } -.notif-dot.read { background: transparent; border: 1.5px solid var(--border-h); } -.notif-msg { font-size: 0.79rem; line-height: 1.4; flex: 1; } -.notif-time { font-size: 0.68rem; color: var(--text-3); margin-top: 2px; } -.notif-empty { padding: 26px 16px; text-align: center; color: var(--text-3); font-size: 0.83rem; } + +.notif-item { display: flex; gap: 11px; padding: 11px 16px; cursor: pointer; + text-decoration: none; color: inherit; transition: background .15s; + position: relative; align-items: flex-start; } +.notif-item + .notif-item { border-top: 1px solid var(--border); } +.notif-item:hover { background: rgba(155,93,229,.04); } +.notif-item.unread { background: rgba(155,93,229,.05); } +.notif-item.unread::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; + width: 3px; background: var(--violet); border-radius: 0 2px 2px 0; } + +.notif-icon { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; + display: flex; align-items: center; justify-content: center; + background: var(--ni, rgba(155,93,229,.1)); color: var(--nc, #9B5DE5); + margin-top: 1px; } +.notif-icon .ic { width: 15px; height: 15px; } + +.notif-body { flex: 1; min-width: 0; } +.notif-msg { font-size: .81rem; line-height: 1.45; color: var(--text); } +.notif-time { font-size: .67rem; color: var(--text-3); margin-top: 3px; font-weight: 500; } +.notif-empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: .83rem; } /* ══════════════════════════════════════════ PAGE TRANSITIONS (View Transitions API) diff --git a/js/notifications.js b/js/notifications.js index b660d7a..4c963d8 100644 --- a/js/notifications.js +++ b/js/notifications.js @@ -3,6 +3,30 @@ let _notifOpen = false; let _sse = null; + const _ICONS = { + achievement: { bg:'#FEF3C7', c:'#D97706', + svg:'' }, + assignment: { bg:'#DBEAFE', c:'#2563EB', + svg:'' }, + grade: { bg:'#DCFCE7', c:'#16A34A', + svg:'' }, + revision: { bg:'#FEE2E2', c:'#DC2626', + svg:'' }, + submission: { bg:'#E0F2FE', c:'#0284C7', + svg:'' }, + session: { bg:'rgba(155,93,229,.12)', c:'#9B5DE5', + svg:'' }, + join: { bg:'#F0FDF4', c:'#16A34A', + svg:'' }, + announcement: { bg:'#EDE9FE', c:'#7C3AED', + svg:'' }, + }; + function _icon(type) { + const t = _ICONS[type] || { bg:'rgba(155,93,229,.1)', c:'#9B5DE5', + svg:'' }; + return `
`; + } + function renderNotifDrop(data) { const drop = document.getElementById('notif-drop'); const badge = document.getElementById('notif-badge'); @@ -11,13 +35,19 @@ else badge.style.display = 'none'; drop.innerHTML = `