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:
@@ -553,6 +553,41 @@ function formatTime(iso: string) {
|
|||||||
return formatJalaliDateTime(d);
|
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() {
|
function submitSearch() {
|
||||||
const q = globalSearch.value.trim();
|
const q = globalSearch.value.trim();
|
||||||
if (!q) return;
|
if (!q) return;
|
||||||
@@ -1058,7 +1093,10 @@ onUnmounted(() => {
|
|||||||
<div class="notif-backdrop" @click="closeNotif" />
|
<div class="notif-backdrop" @click="closeNotif" />
|
||||||
<div class="notif-panel" role="dialog" aria-label="اعلانها" :style="notifPos ?? undefined">
|
<div class="notif-panel" role="dialog" aria-label="اعلانها" :style="notifPos ?? undefined">
|
||||||
<header class="notif-head">
|
<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">
|
<div class="notif-head-actions">
|
||||||
<button v-if="hasUnread" class="linkish" type="button" @click="markAll">
|
<button v-if="hasUnread" class="linkish" type="button" @click="markAll">
|
||||||
همه خوانده شد
|
همه خوانده شد
|
||||||
@@ -1068,17 +1106,26 @@ onUnmounted(() => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</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">
|
<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)">
|
<button type="button" @click="markRead(item)">
|
||||||
<span class="title">{{ item.title }}</span>
|
<span class="notif-ico" aria-hidden="true">
|
||||||
<span v-if="item.body" class="body">{{ item.body }}</span>
|
<UiIcon :name="notifIcon(item.type)" :size="18" />
|
||||||
<span class="time">{{ formatTime(item.createdAt) }}</span>
|
</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>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p v-else class="muted">اعلانی نیست.</p>
|
<p v-else class="notif-empty">اعلانی نیست.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -2498,13 +2545,14 @@ onUnmounted(() => {
|
|||||||
.notif-panel {
|
.notif-panel {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
width: min(360px, calc(100vw - 1rem));
|
width: min(360px, calc(100vw - 1rem));
|
||||||
max-height: min(70vh, 480px);
|
max-height: min(70vh, 480px);
|
||||||
overflow: auto;
|
overflow: hidden;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid #e8eef3;
|
border: 1px solid #e8eef3;
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
padding: 0.85rem;
|
|
||||||
box-shadow: var(--shadow-lg);
|
box-shadow: var(--shadow-lg);
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
@@ -2513,59 +2561,140 @@ onUnmounted(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
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 {
|
.notif-head-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.35rem;
|
gap: 0.25rem;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.linkish {
|
.linkish {
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: #14b8a6;
|
color: var(--accent-deep);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font: inherit;
|
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;
|
font-size: 0.82rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notif-list {
|
.notif-list {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0.45rem;
|
||||||
display: grid;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
gap: 0.35rem;
|
gap: 0.35rem;
|
||||||
|
overflow: auto;
|
||||||
|
min-height: 0;
|
||||||
|
scrollbar-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notif-list::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notif-list button {
|
.notif-list button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
border: 0;
|
border: 1px solid #eef2f6;
|
||||||
background: #f8fafc;
|
background: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 0.65rem 0.7rem;
|
padding: 0.65rem 0.7rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: grid;
|
display: flex;
|
||||||
gap: 0.2rem;
|
align-items: flex-start;
|
||||||
|
gap: 0.65rem;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notif-list li.unread button {
|
.notif-ico {
|
||||||
background: #ecfdf8;
|
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-weight: 700;
|
||||||
font-size: 0.9rem;
|
font-size: 0.86rem;
|
||||||
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
.body,
|
.notif-body {
|
||||||
.time,
|
color: var(--ink-secondary);
|
||||||
.muted {
|
|
||||||
color: #94a3b8;
|
|
||||||
font-size: 0.8rem;
|
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 {
|
.content {
|
||||||
|
|||||||
Reference in New Issue
Block a user