mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-31 19:17:48 +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>
32 lines
698 B
Vue
32 lines
698 B
Vue
<script setup>
|
|
import { usePolicy } from 'dashboard/composables/usePolicy';
|
|
import { computed } from 'vue';
|
|
|
|
const props = defineProps({
|
|
as: {
|
|
type: String,
|
|
default: 'div',
|
|
},
|
|
permissions: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
featureFlag: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
});
|
|
|
|
const { checkFeatureAllowed, checkPermissions } = usePolicy();
|
|
|
|
const isFeatureAllowed = computed(() => checkFeatureAllowed(props.featureFlag));
|
|
const hasPermission = computed(() => checkPermissions(props.permissions));
|
|
</script>
|
|
|
|
<!-- eslint-disable vue/no-root-v-if -->
|
|
<template>
|
|
<component :is="as" v-if="isFeatureAllowed && hasPermission">
|
|
<slot />
|
|
</component>
|
|
</template>
|