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 <cursoragent@cursor.com>
This commit is contained in:
2026-11-05 15:29:40 +03:30
co-authored by Cursor
parent 3db9c1c0fe
commit 1e0b638a19
+155 -26
View File
@@ -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(() => {
<div class="notif-backdrop" @click="closeNotif" />
<div class="notif-panel" role="dialog" aria-label="اعلان‌ها" :style="notifPos ?? undefined">
<header class="notif-head">
<strong>اعلان‌ها</strong>
<div class="notif-head-copy">
<strong>اعلان‌ها</strong>
<span v-if="hasUnread" class="notif-count">{{ toFaDigits(unreadCount) }} خوانده‌نشده</span>
</div>
<div class="notif-head-actions">
<button v-if="hasUnread" class="linkish" type="button" @click="markAll">
همه خوانده شد
@@ -1068,17 +1106,26 @@ onUnmounted(() => {
</button>
</div>
</header>
<p v-if="loading && !items.length" class="muted">در حال بارگذاری…</p>
<p v-if="loading && !items.length" class="notif-empty">در حال بارگذاری…</p>
<ul v-else-if="items.length" class="notif-list">
<li v-for="item in items" :key="item.id" :class="{ unread: !item.readAt }">
<li
v-for="item in items"
:key="item.id"
:class="['tone-' + notifTone(item.type), { unread: !item.readAt }]"
>
<button type="button" @click="markRead(item)">
<span class="title">{{ item.title }}</span>
<span v-if="item.body" class="body">{{ item.body }}</span>
<span class="time">{{ formatTime(item.createdAt) }}</span>
<span class="notif-ico" aria-hidden="true">
<UiIcon :name="notifIcon(item.type)" :size="18" />
</span>
<span class="notif-copy">
<span class="notif-title">{{ item.title }}</span>
<span v-if="item.body" class="notif-body">{{ item.body }}</span>
<span class="notif-time">{{ formatTime(item.createdAt) }}</span>
</span>
</button>
</li>
</ul>
<p v-else class="muted">اعلانی نیست.</p>
<p v-else class="notif-empty">اعلانی نیست.</p>
</div>
</div>
@@ -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 {