2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
2022-10-12 00:58:52 +00:00
|
|
|
<li v-show="isMenuItemVisible" class="sidebar-item">
|
2022-07-18 05:46:36 +00:00
|
|
|
<div v-if="hasSubMenu" class="secondary-menu--wrap">
|
2022-09-02 12:37:17 +00:00
|
|
|
<span class="secondary-menu--header fs-small">
|
2022-07-18 05:46:36 +00:00
|
|
|
{{ $t(`SIDEBAR.${menuItem.label}`) }}
|
|
|
|
</span>
|
|
|
|
<div v-if="isHelpCenterSidebar" class="submenu-icons">
|
2022-09-02 12:37:17 +00:00
|
|
|
<woot-button
|
|
|
|
size="tiny"
|
|
|
|
variant="clear"
|
|
|
|
color-scheme="secondary"
|
|
|
|
class="submenu-icon"
|
|
|
|
@click="onClickOpen"
|
|
|
|
>
|
2022-08-10 05:18:41 +00:00
|
|
|
<fluent-icon icon="add" size="16" />
|
2022-09-02 12:37:17 +00:00
|
|
|
</woot-button>
|
2022-07-18 05:46:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-12-02 05:32:43 +00:00
|
|
|
<router-link
|
|
|
|
v-else
|
|
|
|
class="secondary-menu--title secondary-menu--link fs-small"
|
|
|
|
:class="computedClass"
|
2022-01-17 03:48:54 +00:00
|
|
|
:to="menuItem && menuItem.toState"
|
2019-08-25 05:34:33 +00:00
|
|
|
>
|
2021-12-02 05:32:43 +00:00
|
|
|
<fluent-icon
|
|
|
|
:icon="menuItem.icon"
|
|
|
|
class="secondary-menu--icon"
|
|
|
|
size="14"
|
|
|
|
/>
|
2021-12-01 07:15:39 +00:00
|
|
|
{{ $t(`SIDEBAR.${menuItem.label}`) }}
|
2022-07-18 05:46:36 +00:00
|
|
|
<span
|
|
|
|
v-if="isHelpCenterSidebar"
|
|
|
|
class="count-view"
|
|
|
|
:class="computedClass"
|
|
|
|
>
|
|
|
|
{{ `${menuItem.count}` }}
|
|
|
|
</span>
|
2022-02-15 18:06:29 +00:00
|
|
|
<span
|
2022-10-12 00:58:52 +00:00
|
|
|
v-if="menuItem.beta"
|
2022-02-15 18:06:29 +00:00
|
|
|
data-view-component="true"
|
|
|
|
label="Beta"
|
|
|
|
class="beta"
|
2022-03-01 08:44:23 +00:00
|
|
|
>
|
|
|
|
{{ $t('SIDEBAR.BETA') }}
|
2022-02-15 18:06:29 +00:00
|
|
|
</span>
|
2021-12-02 05:32:43 +00:00
|
|
|
</router-link>
|
|
|
|
|
|
|
|
<ul v-if="hasSubMenu" class="nested vertical menu">
|
|
|
|
<secondary-child-nav-item
|
2019-08-14 09:48:44 +00:00
|
|
|
v-for="child in menuItem.children"
|
2019-10-29 07:20:54 +00:00
|
|
|
:key="child.id"
|
2019-08-25 05:34:33 +00:00
|
|
|
:to="child.toState"
|
2021-12-01 07:15:39 +00:00
|
|
|
:label="child.label"
|
|
|
|
:label-color="child.color"
|
|
|
|
:should-truncate="child.truncateLabel"
|
|
|
|
:icon="computedInboxClass(child)"
|
2022-06-07 12:20:51 +00:00
|
|
|
:warning-icon="computedInboxErrorClass(child)"
|
2022-07-18 05:46:36 +00:00
|
|
|
:is-help-center-sidebar="isHelpCenterSidebar"
|
|
|
|
:child-item-count="child.count"
|
2021-12-01 07:15:39 +00:00
|
|
|
/>
|
|
|
|
<router-link
|
2021-12-02 05:32:43 +00:00
|
|
|
v-if="showItem(menuItem)"
|
2021-12-01 07:15:39 +00:00
|
|
|
v-slot="{ href, isActive, navigate }"
|
|
|
|
:to="menuItem.toState"
|
|
|
|
custom
|
2019-08-14 09:48:44 +00:00
|
|
|
>
|
2021-12-01 07:15:39 +00:00
|
|
|
<li>
|
|
|
|
<a
|
|
|
|
:href="href"
|
|
|
|
class="button small clear menu-item--new secondary"
|
|
|
|
:class="{ 'is-active': isActive }"
|
|
|
|
@click="e => newLinkClick(e, navigate)"
|
|
|
|
>
|
2021-12-14 12:07:25 +00:00
|
|
|
<fluent-icon icon="add" size="16" />
|
2021-12-01 07:15:39 +00:00
|
|
|
<span class="button__content">
|
|
|
|
{{ $t(`SIDEBAR.${menuItem.newLinkTag}`) }}
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</li>
|
2019-08-14 09:48:44 +00:00
|
|
|
</router-link>
|
2022-08-10 05:18:41 +00:00
|
|
|
<p v-if="isHelpCenterSidebar && isCategoryEmpty" class="empty-text">
|
|
|
|
{{ $t('SIDEBAR.HELP_CENTER.CATEGORY_EMPTY_MESSAGE') }}
|
|
|
|
</p>
|
2019-08-14 09:48:44 +00:00
|
|
|
</ul>
|
2021-12-01 07:15:39 +00:00
|
|
|
</li>
|
2019-08-14 09:48:44 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
|
2021-12-02 05:32:43 +00:00
|
|
|
import adminMixin from '../../../mixins/isAdmin';
|
2022-06-07 12:20:51 +00:00
|
|
|
import {
|
|
|
|
getInboxClassByType,
|
|
|
|
getInboxWarningIconClass,
|
|
|
|
} from 'dashboard/helper/inbox';
|
2021-12-01 07:15:39 +00:00
|
|
|
|
2021-12-02 05:32:43 +00:00
|
|
|
import SecondaryChildNavItem from './SecondaryChildNavItem';
|
2021-12-01 07:15:39 +00:00
|
|
|
|
2019-08-14 09:48:44 +00:00
|
|
|
export default {
|
2021-12-02 05:32:43 +00:00
|
|
|
components: { SecondaryChildNavItem },
|
2021-09-15 14:45:06 +00:00
|
|
|
mixins: [adminMixin],
|
2019-08-25 05:34:33 +00:00
|
|
|
props: {
|
|
|
|
menuItem: {
|
|
|
|
type: Object,
|
2021-12-01 07:15:39 +00:00
|
|
|
default: () => ({}),
|
2019-08-25 05:34:33 +00:00
|
|
|
},
|
2022-07-18 05:46:36 +00:00
|
|
|
isHelpCenterSidebar: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2022-08-10 05:18:41 +00:00
|
|
|
isCategoryEmpty: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2019-08-25 05:34:33 +00:00
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
computed: {
|
2022-10-12 00:58:52 +00:00
|
|
|
...mapGetters({
|
|
|
|
activeInbox: 'getSelectedInbox',
|
|
|
|
accountId: 'getCurrentAccountId',
|
|
|
|
isFeatureEnabledonAccount: 'accounts/isFeatureEnabledonAccount',
|
|
|
|
}),
|
2021-12-02 05:32:43 +00:00
|
|
|
hasSubMenu() {
|
|
|
|
return !!this.menuItem.children;
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2022-10-12 00:58:52 +00:00
|
|
|
isMenuItemVisible() {
|
2022-10-17 21:59:44 +00:00
|
|
|
if (!this.menuItem.featureFlag) {
|
2022-10-12 00:58:52 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return this.isFeatureEnabledonAccount(
|
|
|
|
this.accountId,
|
2022-10-17 21:59:44 +00:00
|
|
|
this.menuItem.featureFlag
|
2022-10-12 00:58:52 +00:00
|
|
|
);
|
|
|
|
},
|
2022-01-27 12:09:21 +00:00
|
|
|
isInboxConversation() {
|
|
|
|
return (
|
|
|
|
this.$store.state.route.name === 'inbox_conversation' &&
|
|
|
|
this.menuItem.toStateName === 'home'
|
|
|
|
);
|
|
|
|
},
|
|
|
|
isTeamsSettings() {
|
|
|
|
return (
|
|
|
|
this.$store.state.route.name === 'settings_teams_edit' &&
|
|
|
|
this.menuItem.toStateName === 'settings_teams_list'
|
|
|
|
);
|
|
|
|
},
|
|
|
|
isInboxsSettings() {
|
|
|
|
return (
|
|
|
|
this.$store.state.route.name === 'settings_inbox_show' &&
|
|
|
|
this.menuItem.toStateName === 'settings_inbox_list'
|
|
|
|
);
|
|
|
|
},
|
|
|
|
isIntegrationsSettings() {
|
|
|
|
return (
|
|
|
|
this.$store.state.route.name === 'settings_integrations_webhook' &&
|
|
|
|
this.menuItem.toStateName === 'settings_integrations'
|
|
|
|
);
|
|
|
|
},
|
|
|
|
isApplicationsSettings() {
|
|
|
|
return (
|
|
|
|
this.$store.state.route.name === 'settings_applications_integration' &&
|
|
|
|
this.menuItem.toStateName === 'settings_applications'
|
|
|
|
);
|
|
|
|
},
|
2022-08-10 05:18:41 +00:00
|
|
|
isArticlesView() {
|
|
|
|
return this.$store.state.route.name === this.menuItem.toStateName;
|
2022-07-26 06:09:53 +00:00
|
|
|
},
|
2022-01-27 12:09:21 +00:00
|
|
|
|
2019-08-14 09:48:44 +00:00
|
|
|
computedClass() {
|
|
|
|
// If active Inbox is present
|
|
|
|
// donot highlight conversations
|
|
|
|
if (this.activeInbox) return ' ';
|
2022-07-18 05:46:36 +00:00
|
|
|
if (this.hasSubMenu) {
|
|
|
|
if (
|
|
|
|
this.isInboxConversation ||
|
|
|
|
this.isTeamsSettings ||
|
|
|
|
this.isInboxsSettings ||
|
|
|
|
this.isIntegrationsSettings ||
|
|
|
|
this.isApplicationsSettings
|
|
|
|
) {
|
|
|
|
return 'is-active';
|
|
|
|
}
|
|
|
|
return ' ';
|
2019-08-14 09:48:44 +00:00
|
|
|
}
|
2022-07-26 06:09:53 +00:00
|
|
|
if (this.isHelpCenterSidebar) {
|
2022-08-10 05:18:41 +00:00
|
|
|
if (this.isArticlesView) {
|
2022-07-26 06:09:53 +00:00
|
|
|
return 'is-active';
|
|
|
|
}
|
|
|
|
return ' ';
|
|
|
|
}
|
2022-07-18 05:46:36 +00:00
|
|
|
return '';
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
computedInboxClass(child) {
|
2020-10-04 17:27:11 +00:00
|
|
|
const { type, phoneNumber } = child;
|
2021-12-01 07:15:39 +00:00
|
|
|
if (!type) return '';
|
2020-10-04 17:27:11 +00:00
|
|
|
const classByType = getInboxClassByType(type, phoneNumber);
|
2020-02-19 05:00:34 +00:00
|
|
|
return classByType;
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2022-06-07 12:20:51 +00:00
|
|
|
computedInboxErrorClass(child) {
|
|
|
|
const { type, reauthorizationRequired } = child;
|
|
|
|
if (!type) return '';
|
|
|
|
const warningClass = getInboxWarningIconClass(
|
|
|
|
type,
|
|
|
|
reauthorizationRequired
|
|
|
|
);
|
|
|
|
return warningClass;
|
|
|
|
},
|
2021-12-01 07:15:39 +00:00
|
|
|
newLinkClick(e, navigate) {
|
|
|
|
if (this.menuItem.newLinkRouteName) {
|
|
|
|
navigate(e);
|
|
|
|
} else if (this.menuItem.showModalForNewItem) {
|
|
|
|
if (this.menuItem.modalName === 'AddLabel') {
|
|
|
|
e.preventDefault();
|
2021-06-18 14:38:58 +00:00
|
|
|
this.$emit('add-label');
|
2021-05-08 13:36:41 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
showItem(item) {
|
2022-10-17 21:59:44 +00:00
|
|
|
return this.isAdmin && !!item.newLink;
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2022-08-10 05:18:41 +00:00
|
|
|
onClickOpen() {
|
|
|
|
this.$emit('open');
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
2020-03-22 06:14:40 +00:00
|
|
|
<style lang="scss" scoped>
|
2021-12-01 07:15:39 +00:00
|
|
|
.sidebar-item {
|
2021-12-02 05:32:43 +00:00
|
|
|
margin: var(--space-smaller) 0 0;
|
2021-12-01 07:15:39 +00:00
|
|
|
}
|
2021-12-02 05:32:43 +00:00
|
|
|
|
2022-07-18 05:46:36 +00:00
|
|
|
.secondary-menu--wrap {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
2022-09-02 12:37:17 +00:00
|
|
|
margin-top: var(--space-small);
|
2022-07-18 05:46:36 +00:00
|
|
|
}
|
|
|
|
|
2022-09-02 12:37:17 +00:00
|
|
|
.secondary-menu--header {
|
|
|
|
color: var(--s-700);
|
|
|
|
display: flex;
|
|
|
|
font-weight: var(--font-weight-bold);
|
|
|
|
line-height: var(--space-normal);
|
|
|
|
margin: var(--space-small) 0;
|
|
|
|
padding: 0 var(--space-small);
|
|
|
|
}
|
2021-12-02 05:32:43 +00:00
|
|
|
.secondary-menu--title {
|
2021-12-01 07:15:39 +00:00
|
|
|
color: var(--s-600);
|
2021-12-02 05:32:43 +00:00
|
|
|
display: flex;
|
2022-09-02 12:37:17 +00:00
|
|
|
font-weight: var(--font-weight-medium);
|
|
|
|
line-height: var(--space-normal);
|
2021-12-02 05:32:43 +00:00
|
|
|
margin: var(--space-small) 0;
|
|
|
|
padding: 0 var(--space-small);
|
|
|
|
}
|
|
|
|
|
|
|
|
.secondary-menu--link {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
margin: 0;
|
|
|
|
padding: var(--space-small);
|
|
|
|
font-weight: var(--font-weight-medium);
|
|
|
|
border-radius: var(--border-radius-normal);
|
2022-09-02 12:37:17 +00:00
|
|
|
color: var(--s-700);
|
2021-12-02 05:32:43 +00:00
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: var(--s-25);
|
|
|
|
color: var(--s-600);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
border-color: var(--w-300);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.router-link-exact-active,
|
|
|
|
&.is-active {
|
|
|
|
background: var(--w-25);
|
|
|
|
color: var(--w-500);
|
|
|
|
border-color: var(--w-25);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.secondary-menu--icon {
|
|
|
|
margin-right: var(--space-smaller);
|
|
|
|
min-width: var(--space-normal);
|
2021-12-01 07:15:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.sub-menu-link {
|
|
|
|
color: var(--s-600);
|
2020-03-22 06:14:40 +00:00
|
|
|
}
|
2020-06-25 15:34:03 +00:00
|
|
|
|
|
|
|
.wrap {
|
|
|
|
display: flex;
|
2021-03-14 08:40:16 +00:00
|
|
|
align-items: center;
|
2020-06-25 15:34:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.label-color--display {
|
2021-12-01 07:15:39 +00:00
|
|
|
border-radius: var(--space-smaller);
|
|
|
|
height: var(--space-normal);
|
|
|
|
margin-right: var(--space-small);
|
|
|
|
min-width: var(--space-normal);
|
|
|
|
width: var(--space-normal);
|
|
|
|
}
|
|
|
|
|
|
|
|
.inbox-icon {
|
|
|
|
position: relative;
|
|
|
|
top: -1px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-item .button.menu-item--new {
|
|
|
|
display: inline-flex;
|
|
|
|
height: var(--space-medium);
|
|
|
|
margin: var(--space-smaller) 0;
|
|
|
|
padding: var(--space-smaller);
|
|
|
|
color: var(--s-500);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--w-500);
|
|
|
|
}
|
2020-06-25 15:34:03 +00:00
|
|
|
}
|
2022-07-18 05:46:36 +00:00
|
|
|
|
2022-02-15 18:06:29 +00:00
|
|
|
.beta {
|
|
|
|
padding-right: var(--space-smaller) !important;
|
|
|
|
padding-left: var(--space-smaller) !important;
|
2022-10-17 20:13:02 +00:00
|
|
|
margin-left: var(--space-smaller) !important;
|
2022-02-15 18:06:29 +00:00
|
|
|
display: inline-block;
|
2022-03-01 08:44:23 +00:00
|
|
|
font-size: var(--font-size-micro);
|
2022-02-15 18:06:29 +00:00
|
|
|
font-weight: var(--font-weight-medium);
|
|
|
|
line-height: 18px;
|
|
|
|
border: 1px solid transparent;
|
|
|
|
border-radius: 2em;
|
|
|
|
color: var(--g-800);
|
|
|
|
border-color: var(--g-700);
|
|
|
|
}
|
2022-07-18 05:46:36 +00:00
|
|
|
|
|
|
|
.count-view {
|
|
|
|
background: var(--s-50);
|
|
|
|
border-radius: var(--border-radius-normal);
|
|
|
|
color: var(--s-600);
|
|
|
|
font-size: var(--font-size-micro);
|
|
|
|
font-weight: var(--font-weight-bold);
|
|
|
|
margin-left: var(--space-smaller);
|
|
|
|
padding: var(--space-zero) var(--space-smaller);
|
|
|
|
|
|
|
|
&.is-active {
|
|
|
|
background: var(--w-50);
|
|
|
|
color: var(--w-500);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.submenu-icons {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
.submenu-icon {
|
2022-09-02 12:37:17 +00:00
|
|
|
padding: 0;
|
2022-07-18 05:46:36 +00:00
|
|
|
margin-left: var(--space-small);
|
|
|
|
}
|
|
|
|
}
|
2022-08-10 05:18:41 +00:00
|
|
|
|
|
|
|
.empty-text {
|
2022-09-02 12:37:17 +00:00
|
|
|
color: var(--s-500);
|
2022-08-10 05:18:41 +00:00
|
|
|
font-size: var(--font-size-small);
|
2022-09-02 12:37:17 +00:00
|
|
|
margin: var(--space-smaller);
|
2022-08-10 05:18:41 +00:00
|
|
|
}
|
2020-03-22 06:14:40 +00:00
|
|
|
</style>
|