From 1e0b638a1973c27e883c13b4af23f317faf42768 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Thu, 5 Nov 2026 15:29:40 +0330 Subject: [PATCH] fix(web): tidy the notification panel with status icons Keep cards neutral, show type through icon and color only, and hide the panel scrollbar. Co-authored-by: Cursor --- apps/web/src/layouts/AppLayout.vue | 181 ++++++++++++++++++++++++----- 1 file changed, 155 insertions(+), 26 deletions(-) diff --git a/apps/web/src/layouts/AppLayout.vue b/apps/web/src/layouts/AppLayout.vue index b896eac..dc4a7de 100644 --- a/apps/web/src/layouts/AppLayout.vue +++ b/apps/web/src/layouts/AppLayout.vue @@ -553,6 +553,41 @@ function formatTime(iso: string) { return formatJalaliDateTime(d); } +type NotifTone = 'overdue' | 'reminder' | 'assigned' | 'moved' | 'neutral'; + +function notifTone(type: string): NotifTone { + if (type === 'activity_overdue' || type === 'routine_task_overdue') return 'overdue'; + if ( + type === 'activity_reminder' || + type === 'note_reminder' || + type === 'routine_task_reminder' || + type === 'cheque_due' + ) { + return 'reminder'; + } + if (type === 'deal_moved') return 'moved'; + if ( + type === 'activity_assigned' || + type === 'ticket_assigned' || + type === 'routine_task_assigned' || + type === 'automation' + ) { + return 'assigned'; + } + return 'neutral'; +} + +function notifIcon(type: string) { + if (type === 'activity_overdue' || type === 'routine_task_overdue') return 'warning' as const; + if (type === 'cheque_due') return 'dollar' as const; + if (type.includes('reminder')) return 'clock' as const; + if (type === 'deal_moved') return 'trend' as const; + if (type === 'automation') return 'sparkle' as const; + if (type === 'ticket_assigned') return 'mail' as const; + if (type.endsWith('_assigned')) return 'check' as const; + return 'bell' as const; +} + function submitSearch() { const q = globalSearch.value.trim(); if (!q) return; @@ -1058,7 +1093,10 @@ onUnmounted(() => {
@@ -2498,13 +2545,14 @@ onUnmounted(() => { .notif-panel { position: fixed; z-index: 1; + display: flex; + flex-direction: column; width: min(360px, calc(100vw - 1rem)); max-height: min(70vh, 480px); - overflow: auto; + overflow: hidden; background: #fff; border: 1px solid #e8eef3; border-radius: var(--radius); - padding: 0.85rem; box-shadow: var(--shadow-lg); pointer-events: auto; } @@ -2513,59 +2561,140 @@ onUnmounted(() => { display: flex; justify-content: space-between; align-items: center; - margin-bottom: 0.55rem; + gap: 0.5rem; + flex-shrink: 0; + padding: 0.75rem 0.85rem; + border-bottom: 1px solid #e8eef3; +} + +.notif-head-copy { + display: flex; + align-items: center; + gap: 0.45rem; + min-width: 0; +} + +.notif-head-copy strong { + font-size: 0.95rem; + color: var(--ink); +} + +.notif-count { + font-size: 0.72rem; + font-weight: 700; + color: var(--accent-deep); + background: var(--accent-subtle); + border-radius: 999px; + padding: 0.12rem 0.45rem; + white-space: nowrap; } .notif-head-actions { display: flex; align-items: center; - gap: 0.35rem; + gap: 0.25rem; + flex-shrink: 0; } .linkish { border: 0; background: transparent; - color: #14b8a6; + color: var(--accent-deep); cursor: pointer; font: inherit; + font-size: 0.78rem; + font-weight: 600; + padding: 0.2rem 0.35rem; +} + +.notif-empty { + margin: 0; + padding: 1.4rem 0.9rem; + text-align: center; + color: var(--muted); font-size: 0.82rem; } .notif-list { list-style: none; margin: 0; - padding: 0; - display: grid; + padding: 0.45rem; + display: flex; + flex-direction: column; gap: 0.35rem; + overflow: auto; + min-height: 0; + scrollbar-width: none; +} + +.notif-list::-webkit-scrollbar { + display: none; + width: 0; + height: 0; } .notif-list button { width: 100%; text-align: right; - border: 0; - background: #f8fafc; + border: 1px solid #eef2f6; + background: #fff; border-radius: 12px; padding: 0.65rem 0.7rem; cursor: pointer; - display: grid; - gap: 0.2rem; + display: flex; + align-items: flex-start; + gap: 0.65rem; font: inherit; } -.notif-list li.unread button { - background: #ecfdf8; +.notif-ico { + display: grid; + place-items: center; + width: 28px; + height: 28px; + flex-shrink: 0; + color: var(--muted); } -.title { +.notif-copy { + display: grid; + gap: 0.15rem; + min-width: 0; +} + +.notif-title { font-weight: 700; - font-size: 0.9rem; + font-size: 0.86rem; + color: var(--ink); } -.body, -.time, -.muted { - color: #94a3b8; +.notif-body { + color: var(--ink-secondary); font-size: 0.8rem; + line-height: 1.55; +} + +.notif-time { + color: var(--muted); + font-size: 0.74rem; +} + +.notif-list li.tone-overdue .notif-ico { + color: var(--danger); +} +.notif-list li.tone-reminder .notif-ico { + color: var(--warning-deep); +} +.notif-list li.tone-assigned .notif-ico { + color: var(--accent-deep); +} +.notif-list li.tone-moved .notif-ico { + color: #2563eb; +} + +.notif-list li:not(.unread) .notif-body, +.notif-list li:not(.unread) .notif-time { + color: var(--muted); } .content {