fix: added unread notification count
This commit is contained in:
parent
39fd9a6603
commit
f95f211dbe
@ -14,8 +14,23 @@
|
|||||||
:icon="NotificationsIcon"
|
:icon="NotificationsIcon"
|
||||||
:isCollapsed="isSidebarCollapsed"
|
:isCollapsed="isSidebarCollapsed"
|
||||||
@click="() => toggleNotificationPanel()"
|
@click="() => toggleNotificationPanel()"
|
||||||
class="mx-2 my-0.5"
|
class="relative mx-2 my-0.5"
|
||||||
/>
|
>
|
||||||
|
<template #right>
|
||||||
|
<Badge
|
||||||
|
v-if="
|
||||||
|
!isSidebarCollapsed &&
|
||||||
|
notificationsStore().unreadNotificationsCount
|
||||||
|
"
|
||||||
|
:label="notificationsStore().unreadNotificationsCount"
|
||||||
|
variant="subtle"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
v-else-if="notificationsStore().unreadNotificationsCount"
|
||||||
|
class="absolute z-20 top-0 left-0 h-1.5 w-1.5 translate-x-6 translate-y-1 rounded-full bg-gray-800"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</SidebarLink>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="view in allViews" :key="view.label">
|
<div v-for="view in allViews" :key="view.label">
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -5,26 +5,29 @@
|
|||||||
@click="handleClick"
|
@click="handleClick"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex items-center duration-300 ease-in-out"
|
class="flex w-full justify-between items-center duration-300 ease-in-out"
|
||||||
:class="isCollapsed ? 'p-1' : 'px-2 py-1'"
|
:class="isCollapsed ? 'p-1' : 'px-2 py-1'"
|
||||||
>
|
>
|
||||||
<Tooltip :text="label" placement="right">
|
<div class="flex items-center">
|
||||||
<slot name="icon">
|
<Tooltip :text="label" placement="right">
|
||||||
<span class="grid h-5 w-6 flex-shrink-0 place-items-center">
|
<slot name="icon">
|
||||||
<component :is="icon" class="h-4 w-4 text-gray-700" />
|
<span class="grid h-5 w-6 flex-shrink-0 place-items-center">
|
||||||
</span>
|
<component :is="icon" class="h-4 w-4 text-gray-700" />
|
||||||
</slot>
|
</span>
|
||||||
</Tooltip>
|
</slot>
|
||||||
<span
|
</Tooltip>
|
||||||
class="flex-shrink-0 text-sm duration-300 ease-in-out"
|
<span
|
||||||
:class="
|
class="flex-1 flex-shrink-0 text-sm duration-300 ease-in-out"
|
||||||
isCollapsed
|
:class="
|
||||||
? 'ml-0 w-0 overflow-hidden opacity-0'
|
isCollapsed
|
||||||
: 'ml-2 w-auto opacity-100'
|
? 'ml-0 w-0 overflow-hidden opacity-0'
|
||||||
"
|
: 'ml-2 w-auto opacity-100'
|
||||||
>
|
"
|
||||||
{{ label }}
|
>
|
||||||
</span>
|
{{ label }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<slot name="right" />
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -22,6 +22,9 @@ export const notificationsStore = defineStore('crm-notifications', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const allNotifications = computed(() => notifications.data || [])
|
const allNotifications = computed(() => notifications.data || [])
|
||||||
|
const unreadNotificationsCount = computed(
|
||||||
|
() => notifications.data?.filter((n) => !n.read).length || 0
|
||||||
|
)
|
||||||
|
|
||||||
function mark_comment_as_read(comment) {
|
function mark_comment_as_read(comment) {
|
||||||
mark_as_read.params = { comment: comment }
|
mark_as_read.params = { comment: comment }
|
||||||
@ -32,6 +35,7 @@ export const notificationsStore = defineStore('crm-notifications', () => {
|
|||||||
return {
|
return {
|
||||||
visible,
|
visible,
|
||||||
allNotifications,
|
allNotifications,
|
||||||
|
unreadNotificationsCount,
|
||||||
mark_as_read,
|
mark_as_read,
|
||||||
mark_comment_as_read,
|
mark_comment_as_read,
|
||||||
toggle,
|
toggle,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user