mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-29 18:22:53 +00:00
This PR has the initial version of the new sidebar targeted for the next major redesign of the app. This PR includes the following changes - Components in the `layouts-next` and `base-next` directories in `dashboard/components` - Two generic components `Avatar` and `Icon` - `SidebarGroup` component to manage expandable sidebar groups with nested navigation items. This includes handling active states, transitions, and permissions. - `SidebarGroupHeader` component to display the header of each navigation group with optional icons and active state indication. - `SidebarGroupLeaf` component for individual navigation items within a group, supporting icons and active state. - `SidebarGroupSeparator` component to visually separate nested navigation items. (They look a lot like header) - `SidebarGroupEmptyLeaf` component to render empty state of any navigation groups. ---- Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Pranav <pranavrajs@gmail.com>
41 lines
1.1 KiB
Vue
41 lines
1.1 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import { useRoute } from 'vue-router';
|
|
import { useMapGetter } from 'dashboard/composables/store';
|
|
|
|
const emit = defineEmits(['openNotificationPanel']);
|
|
|
|
const notificationMetadata = useMapGetter('notifications/getMeta');
|
|
const route = useRoute();
|
|
const unreadCount = computed(() => {
|
|
if (!notificationMetadata.value.unreadCount) {
|
|
return '';
|
|
}
|
|
|
|
return notificationMetadata.value.unreadCount < 100
|
|
? `${notificationMetadata.value.unreadCount}`
|
|
: '99+';
|
|
});
|
|
|
|
function openNotificationPanel() {
|
|
if (route.name !== 'notifications_index') {
|
|
emit('openNotificationPanel');
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<button
|
|
class="size-8 rounded-lg hover:bg-n-alpha-1 flex-shrink-0 grid place-content-center relative"
|
|
@click="openNotificationPanel"
|
|
>
|
|
<span class="i-lucide-bell size-4" />
|
|
<span
|
|
v-if="unreadCount"
|
|
class="min-h-2 min-w-2 p-0.5 px-1 bg-n-ruby-9 rounded-lg absolute -top-1 -right-1.5 grid place-items-center text-[9px] leading-none text-n-ruby-3"
|
|
>
|
|
{{ unreadCount }}
|
|
</span>
|
|
</button>
|
|
</template>
|