# Pull Request Template ## Description This PR includes the following updates: 1. Updated the design system color tokens by introducing new tokens for surfaces, overlays, buttons, labels, and cards, along with refinements to existing shades. 2. Refreshed both light and dark themes with adjusted background, border, and solid colors. 3. Replaced static Inter font files with the Inter variable font (including italic), supporting weights from 100–900. 4. Added custom font weights (420, 440, 460, 520) along with custom typography classes to enable more fine-grained and consistent typography control. ## Type of change - [x] New feature (non-breaking change which adds functionality) ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Pranav <pranav@chatwoot.com>
173 lines
4.8 KiB
Vue
173 lines
4.8 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import Auth from 'dashboard/api/auth';
|
|
import { useMapGetter } from 'dashboard/composables/store';
|
|
import { useI18n } from 'vue-i18n';
|
|
import Avatar from 'next/avatar/Avatar.vue';
|
|
import SidebarProfileMenuStatus from './SidebarProfileMenuStatus.vue';
|
|
import { FEATURE_FLAGS } from 'dashboard/featureFlags';
|
|
|
|
import {
|
|
DropdownContainer,
|
|
DropdownBody,
|
|
DropdownSeparator,
|
|
DropdownItem,
|
|
} from 'next/dropdown-menu/base';
|
|
import CustomBrandPolicyWrapper from '../../components/CustomBrandPolicyWrapper.vue';
|
|
|
|
defineProps({
|
|
isCollapsed: { type: Boolean, default: false },
|
|
});
|
|
|
|
const emit = defineEmits(['close', 'openKeyShortcutModal']);
|
|
|
|
defineOptions({
|
|
inheritAttrs: false,
|
|
});
|
|
|
|
const { t } = useI18n();
|
|
|
|
const currentUser = useMapGetter('getCurrentUser');
|
|
const currentUserAvailability = useMapGetter('getCurrentUserAvailability');
|
|
const accountId = useMapGetter('getCurrentAccountId');
|
|
const globalConfig = useMapGetter('globalConfig/get');
|
|
const isFeatureEnabledonAccount = useMapGetter(
|
|
'accounts/isFeatureEnabledonAccount'
|
|
);
|
|
|
|
const showChatSupport = computed(() => {
|
|
return (
|
|
isFeatureEnabledonAccount.value(
|
|
accountId.value,
|
|
FEATURE_FLAGS.CONTACT_CHATWOOT_SUPPORT_TEAM
|
|
) && globalConfig.value.chatwootInboxToken
|
|
);
|
|
});
|
|
|
|
const menuItems = computed(() => {
|
|
return [
|
|
{
|
|
show: showChatSupport.value,
|
|
showOnCustomBrandedInstance: false,
|
|
label: t('SIDEBAR_ITEMS.CONTACT_SUPPORT'),
|
|
icon: 'i-lucide-life-buoy',
|
|
click: () => {
|
|
window.$chatwoot.toggle();
|
|
},
|
|
},
|
|
{
|
|
show: true,
|
|
showOnCustomBrandedInstance: true,
|
|
label: t('SIDEBAR_ITEMS.KEYBOARD_SHORTCUTS'),
|
|
icon: 'i-lucide-keyboard',
|
|
click: () => {
|
|
emit('openKeyShortcutModal');
|
|
},
|
|
},
|
|
{
|
|
show: true,
|
|
showOnCustomBrandedInstance: true,
|
|
label: t('SIDEBAR_ITEMS.PROFILE_SETTINGS'),
|
|
icon: 'i-lucide-user-pen',
|
|
link: { name: 'profile_settings_index' },
|
|
},
|
|
{
|
|
show: true,
|
|
showOnCustomBrandedInstance: true,
|
|
label: t('SIDEBAR_ITEMS.APPEARANCE'),
|
|
icon: 'i-lucide-palette',
|
|
click: () => {
|
|
const ninja = document.querySelector('ninja-keys');
|
|
ninja.open({ parent: 'appearance_settings' });
|
|
},
|
|
},
|
|
{
|
|
show: true,
|
|
showOnCustomBrandedInstance: false,
|
|
label: t('SIDEBAR_ITEMS.DOCS'),
|
|
icon: 'i-lucide-book',
|
|
link: 'https://www.chatwoot.com/hc/user-guide/en',
|
|
nativeLink: true,
|
|
target: '_blank',
|
|
},
|
|
{
|
|
show: true,
|
|
showOnCustomBrandedInstance: false,
|
|
label: t('SIDEBAR_ITEMS.CHANGELOG'),
|
|
icon: 'i-lucide-scroll-text',
|
|
link: 'https://www.chatwoot.com/changelog/',
|
|
nativeLink: true,
|
|
target: '_blank',
|
|
},
|
|
{
|
|
show: currentUser.value.type === 'SuperAdmin',
|
|
showOnCustomBrandedInstance: true,
|
|
label: t('SIDEBAR_ITEMS.SUPER_ADMIN_CONSOLE'),
|
|
icon: 'i-lucide-castle',
|
|
link: '/super_admin',
|
|
nativeLink: true,
|
|
target: '_blank',
|
|
},
|
|
{
|
|
show: true,
|
|
showOnCustomBrandedInstance: true,
|
|
label: t('SIDEBAR_ITEMS.LOGOUT'),
|
|
icon: 'i-lucide-power',
|
|
click: Auth.logout,
|
|
},
|
|
];
|
|
});
|
|
|
|
const allowedMenuItems = computed(() => {
|
|
return menuItems.value.filter(item => item.show);
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<DropdownContainer
|
|
class="relative min-w-0"
|
|
:class="isCollapsed ? 'w-auto' : 'w-full'"
|
|
@close="emit('close')"
|
|
>
|
|
<template #trigger="{ toggle, isOpen }">
|
|
<button
|
|
class="flex gap-2 items-center p-1 text-left rounded-lg cursor-pointer hover:bg-n-alpha-1"
|
|
:class="[
|
|
{ 'bg-n-alpha-1': isOpen },
|
|
isCollapsed ? 'justify-center' : 'w-full',
|
|
]"
|
|
:title="isCollapsed ? currentUser.available_name : undefined"
|
|
@click="toggle"
|
|
>
|
|
<Avatar
|
|
:size="32"
|
|
:name="currentUser.available_name"
|
|
:src="currentUser.avatar_url"
|
|
:status="currentUserAvailability"
|
|
class="flex-shrink-0"
|
|
rounded-full
|
|
/>
|
|
<div v-if="!isCollapsed" class="min-w-0">
|
|
<div class="text-sm font-medium leading-4 truncate text-n-slate-12">
|
|
{{ currentUser.available_name }}
|
|
</div>
|
|
<div class="text-xs truncate text-n-slate-11">
|
|
{{ currentUser.email }}
|
|
</div>
|
|
</div>
|
|
</button>
|
|
</template>
|
|
<DropdownBody class="bottom-12 z-50 mb-2 w-80 ltr:left-0 rtl:right-0">
|
|
<SidebarProfileMenuStatus />
|
|
<DropdownSeparator />
|
|
<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" />
|
|
</CustomBrandPolicyWrapper>
|
|
</template>
|
|
</DropdownBody>
|
|
</DropdownContainer>
|
|
</template>
|