fix: Update rendering logic for the "Read Documentation" link (#10965)

Update the rendering logic based on the branding installation type etc.
Used CustomBrandPolicyWrapper to render the child component
This commit is contained in:
Pranav
2025-02-24 16:04:43 -08:00
committed by GitHub
parent e97489f534
commit 9cdd11031b

View File

@@ -13,6 +13,7 @@ import {
DropdownSeparator, DropdownSeparator,
DropdownItem, DropdownItem,
} from 'next/dropdown-menu/base'; } from 'next/dropdown-menu/base';
import CustomBrandPolicyWrapper from '../../components/CustomBrandPolicyWrapper.vue';
const emit = defineEmits(['close', 'openKeyShortcutModal']); const emit = defineEmits(['close', 'openKeyShortcutModal']);
@@ -43,6 +44,7 @@ const menuItems = computed(() => {
return [ return [
{ {
show: showChatSupport.value, show: showChatSupport.value,
showOnCustomBrandedInstance: false,
label: t('SIDEBAR_ITEMS.CONTACT_SUPPORT'), label: t('SIDEBAR_ITEMS.CONTACT_SUPPORT'),
icon: 'i-lucide-life-buoy', icon: 'i-lucide-life-buoy',
click: () => { click: () => {
@@ -51,6 +53,7 @@ const menuItems = computed(() => {
}, },
{ {
show: true, show: true,
showOnCustomBrandedInstance: true,
label: t('SIDEBAR_ITEMS.KEYBOARD_SHORTCUTS'), label: t('SIDEBAR_ITEMS.KEYBOARD_SHORTCUTS'),
icon: 'i-lucide-keyboard', icon: 'i-lucide-keyboard',
click: () => { click: () => {
@@ -59,12 +62,14 @@ const menuItems = computed(() => {
}, },
{ {
show: true, show: true,
showOnCustomBrandedInstance: true,
label: t('SIDEBAR_ITEMS.PROFILE_SETTINGS'), label: t('SIDEBAR_ITEMS.PROFILE_SETTINGS'),
icon: 'i-lucide-user-pen', icon: 'i-lucide-user-pen',
link: { name: 'profile_settings_index' }, link: { name: 'profile_settings_index' },
}, },
{ {
show: true, show: true,
showOnCustomBrandedInstance: true,
label: t('SIDEBAR_ITEMS.APPEARANCE'), label: t('SIDEBAR_ITEMS.APPEARANCE'),
icon: 'i-lucide-palette', icon: 'i-lucide-palette',
click: () => { click: () => {
@@ -74,6 +79,7 @@ const menuItems = computed(() => {
}, },
{ {
show: true, show: true,
showOnCustomBrandedInstance: false,
label: t('SIDEBAR_ITEMS.DOCS'), label: t('SIDEBAR_ITEMS.DOCS'),
icon: 'i-lucide-book', icon: 'i-lucide-book',
link: 'https://www.chatwoot.com/hc/user-guide/en', link: 'https://www.chatwoot.com/hc/user-guide/en',
@@ -82,6 +88,7 @@ const menuItems = computed(() => {
}, },
{ {
show: currentUser.value.type === 'SuperAdmin', show: currentUser.value.type === 'SuperAdmin',
showOnCustomBrandedInstance: true,
label: t('SIDEBAR_ITEMS.SUPER_ADMIN_CONSOLE'), label: t('SIDEBAR_ITEMS.SUPER_ADMIN_CONSOLE'),
icon: 'i-lucide-castle', icon: 'i-lucide-castle',
link: '/super_admin', link: '/super_admin',
@@ -90,6 +97,7 @@ const menuItems = computed(() => {
}, },
{ {
show: true, show: true,
showOnCustomBrandedInstance: true,
label: t('SIDEBAR_ITEMS.LOGOUT'), label: t('SIDEBAR_ITEMS.LOGOUT'),
icon: 'i-lucide-power', icon: 'i-lucide-power',
click: Auth.logout, click: Auth.logout,
@@ -136,7 +144,11 @@ const allowedMenuItems = computed(() => {
<SidebarProfileMenuStatus /> <SidebarProfileMenuStatus />
<DropdownSeparator /> <DropdownSeparator />
<template v-for="item in allowedMenuItems" :key="item.label"> <template v-for="item in allowedMenuItems" :key="item.label">
<CustomBrandPolicyWrapper
:show-on-custom-branded-instance="item.showOnCustomBrandedInstance"
>
<DropdownItem v-if="item.show" v-bind="item" /> <DropdownItem v-if="item.show" v-bind="item" />
</CustomBrandPolicyWrapper>
</template> </template>
</DropdownBody> </DropdownBody>
</DropdownContainer> </DropdownContainer>