fix: Update route permissions in the new primary menu (#3499)

* fix: Display rolewise primary sidebar

* Fix issues with roles

* Fix active style

* Fix accessible menu

* Fix key missing

* Changes menu icon size

Co-authored-by: Nithin David <1277421+nithindavid@users.noreply.github.com>
This commit is contained in:
Pranav Raj S
2021-12-01 21:32:43 -08:00
committed by GitHub
parent b826319776
commit 8b4134c790
23 changed files with 282 additions and 349 deletions

View File

@@ -1,41 +1,37 @@
<template>
<aside class="woot-sidebar" :class="{ 'only-primary': !showSecondaryMenu }">
<aside class="woot-sidebar">
<primary-sidebar
:logo-source="globalConfig.logo"
:installation-name="globalConfig.installationName"
:account-id="accountId"
:menu-items="primaryMenuItems"
:active-menu-item="activePrimaryMenu.key"
@toggle-accounts="toggleAccountModal"
@key-shortcut-modal="toggleKeyShortcutModal"
/>
<secondary-sidebar
v-if="showSecondaryMenu"
:account-id="accountId"
:inboxes="inboxes"
:account-labels="accountLabels"
:labels="labels"
:teams="teams"
:menu-items="primaryMenuItems"
:menu-config="activeSecondaryMenu"
:current-role="currentRole"
@add-label="showAddLabelPopup"
/>
<woot-key-shortcut-modal
v-if="showShortcutModal"
@close="closeKeyShortcutModal"
@clickaway="closeKeyShortcutModal"
/>
<account-selector
:show-account-modal="showAccountModal"
@close-account-modal="toggleAccountModal"
@show-create-account-modal="openCreateAccountModal"
/>
<add-account-modal
:show="showCreateAccountModal"
@close-account-create-modal="closeCreateAccountModal"
/>
<woot-modal :show.sync="showAddLabelModal" :on-close="hideAddLabelPopup">
<add-label-modal @close="hideAddLabelPopup" />
</woot-modal>
@@ -46,14 +42,14 @@
import { mapGetters } from 'vuex';
import adminMixin from '../../mixins/isAdmin';
import { getSidebarItems } from '../../i18n/default-sidebar';
import { getSidebarItems } from './config/default-sidebar';
import alertMixin from 'shared/mixins/alertMixin';
import AccountSelector from './sidebarComponents/AccountSelector.vue';
import AddAccountModal from './sidebarComponents/AddAccountModal.vue';
import AddLabelModal from '../../routes/dashboard/settings/labels/AddLabel';
import PrimarySidebar from 'dashboard/modules/sidebar/components/Primary';
import SecondarySidebar from 'dashboard/modules/sidebar/components/Secondary';
import PrimarySidebar from './sidebarComponents/Primary';
import SecondarySidebar from './sidebarComponents/Secondary';
import WootKeyShortcutModal from 'components/widgets/modal/WootKeyShortcutModal';
import {
hasPressedAltAndCKey,
@@ -93,38 +89,34 @@ export default {
inboxes: 'inboxes/getInboxes',
accountId: 'getCurrentAccountId',
currentRole: 'getCurrentRole',
accountLabels: 'labels/getLabelsOnSidebar',
labels: 'labels/getLabelsOnSidebar',
teams: 'teams/getMyTeams',
}),
sideMenuItems() {
sideMenuConfig() {
return getSidebarItems(this.accountId);
},
primaryMenuItems() {
const menuItems = Object.values(
getSidebarItems(this.accountId).common.menuItems
const menuItems = this.sideMenuConfig.primaryMenu;
return menuItems.filter(menuItem =>
menuItem.roles.includes(this.currentRole)
);
},
activeSecondaryMenu() {
const { secondaryMenu } = this.sideMenuConfig;
const { name: currentRoute } = this.$route;
return menuItems;
const activeSecondaryMenu =
secondaryMenu.find(menuItem =>
menuItem.routes.includes(currentRoute)
) || {};
return activeSecondaryMenu;
},
currentRoute() {
return this.$store.state.route.name;
},
shouldShowNotificationsSideMenu() {
return this.sideMenuItems.notifications.routes.includes(
this.currentRoute
);
},
shouldShowProfileSideMenu() {
return (
this.currentRoute === 'profile_settings_index' ||
this.currentRoute === 'profile_settings'
);
},
showSecondaryMenu() {
if (this.shouldShowNotificationsSideMenu) return false;
if (this.shouldShowProfileSideMenu) return false;
return true;
activePrimaryMenu() {
const activePrimaryMenu =
this.primaryMenuItems.find(
menuItem => menuItem.key === this.activeSecondaryMenu.parentNav
) || {};
return activePrimaryMenu;
},
},
mounted() {
@@ -169,23 +161,11 @@ export default {
}
},
isCurrentRouteSameAsNavigation(routeName) {
return router.currentRoute && router.currentRoute.name === routeName;
return this.$route.name === routeName;
},
toggleSupportChatWindow() {
window.$chatwoot.toggle();
},
filterMenuItemsByRole(menuItems) {
if (!this.currentRole) {
return [];
}
return menuItems.filter(
menuItem =>
window.roleWiseRoutes[this.currentRole].indexOf(
menuItem.toStateName
) > -1
);
},
toggleAccountModal() {
this.showAccountModal = !this.showAccountModal;
},
@@ -208,12 +188,8 @@ export default {
<style lang="scss" scoped>
.woot-sidebar {
background: white;
background: var(--white);
display: flex;
&.only-primary {
width: auto;
}
}
.secondary-menu {

View File

@@ -0,0 +1,19 @@
import conversations from './sidebarItems/conversations';
import contacts from './sidebarItems/contacts';
import reports from './sidebarItems/reports';
import campaigns from './sidebarItems/campaigns';
import settings from './sidebarItems/settings';
import notifications from './sidebarItems/notifications';
import primaryMenu from './sidebarItems/primaryMenu';
export const getSidebarItems = accountId => ({
primaryMenu: primaryMenu(accountId),
secondaryMenu: [
conversations(accountId),
contacts(accountId),
reports(accountId),
campaigns(accountId),
settings(accountId),
notifications(accountId),
],
});

View File

@@ -1,6 +1,7 @@
import { frontendURL } from '../../helper/URLHelper';
import { frontendURL } from '../../../../helper/URLHelper';
const campaigns = accountId => ({
parentNav: 'campaigns',
routes: ['settings_account_campaigns', 'one_off'],
menuItems: [
{

View File

@@ -1,27 +1,21 @@
import { frontendURL } from '../../helper/URLHelper';
import { frontendURL } from '../../../../helper/URLHelper';
const contacts = accountId => ({
parentNav: 'contacts',
routes: [
'contacts_dashboard',
'contact_profile_dashboard',
'contacts_labels_dashboard',
],
menuItems: {
back: {
icon: 'chevron-left',
label: 'HOME',
hasSubMenu: false,
toStateName: 'home',
toState: frontendURL(`accounts/${accountId}/dashboard`),
},
contacts: {
menuItems: [
{
icon: 'contact-card-group',
label: 'ALL_CONTACTS',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/contacts`),
toStateName: 'contacts_dashboard',
},
},
],
});
export default contacts;

View File

@@ -0,0 +1,28 @@
import { frontendURL } from '../../../../helper/URLHelper';
const conversations = accountId => ({
parentNav: 'conversations',
routes: [
'home',
'inbox_dashboard',
'inbox_conversation',
'conversation_through_inbox',
'notifications_dashboard',
'label_conversations',
'conversations_through_label',
'team_conversations',
'conversations_through_team',
],
menuItems: [
{
icon: 'chat',
label: 'ALL_CONVERSATIONS',
key: 'conversations',
toState: frontendURL(`accounts/${accountId}/dashboard`),
toolTip: 'Conversation from all subscribed inboxes',
toStateName: 'home',
},
],
});
export default conversations;

View File

@@ -1,6 +1,7 @@
const notifications = () => ({
parentNav: 'notifications',
routes: ['notifications_index'],
menuItems: {},
menuItems: [],
});
export default notifications;

View File

@@ -0,0 +1,46 @@
import { frontendURL } from '../../../../helper/URLHelper';
const primaryMenuItems = accountId => [
{
icon: 'chat',
key: 'conversations',
label: 'CONVERSATIONS',
toState: frontendURL(`accounts/${accountId}/dashboard`),
toStateName: 'home',
roles: ['administrator', 'agent'],
},
{
icon: 'book-contacts',
key: 'contacts',
label: 'CONTACTS',
toState: frontendURL(`accounts/${accountId}/contacts`),
toStateName: 'contacts_dashboard',
roles: ['administrator', 'agent'],
},
{
icon: 'arrow-trending-lines',
key: 'reports',
label: 'REPORTS',
toState: frontendURL(`accounts/${accountId}/reports`),
toStateName: 'settings_account_reports',
roles: ['administrator'],
},
{
icon: 'megaphone',
key: 'campaigns',
label: 'CAMPAIGNS',
toState: frontendURL(`accounts/${accountId}/campaigns`),
toStateName: 'settings_account_campaigns',
roles: ['administrator'],
},
{
icon: 'settings',
key: 'settings',
label: 'SETTINGS',
toState: frontendURL(`accounts/${accountId}/settings`),
toStateName: 'settings_home',
roles: ['administrator', 'agent'],
},
];
export default primaryMenuItems;

View File

@@ -0,0 +1,7 @@
const profileSettings = () => ({
parentNav: 'profileSettings',
routes: ['profile_settings_index'],
menuItems: [],
});
export default profileSettings;

View File

@@ -1,6 +1,7 @@
import { frontendURL } from '../../helper/URLHelper';
import { frontendURL } from '../../../../helper/URLHelper';
const reports = accountId => ({
parentNav: 'reports',
routes: [
'settings_account_reports',
'csat_reports',

View File

@@ -1,6 +1,7 @@
import { frontendURL } from '../../helper/URLHelper';
import { frontendURL } from '../../../../helper/URLHelper';
const settings = accountId => ({
parentNav: 'settings',
routes: [
'agent_list',
'canned_list',
@@ -30,43 +31,36 @@ const settings = accountId => ({
'settings_teams_edit_finish',
'automation_list',
],
menuItems: {
back: {
icon: 'chevron-left',
label: 'HOME',
hasSubMenu: false,
toStateName: 'home',
toState: frontendURL(`accounts/${accountId}/dashboard`),
},
agents: {
menuItems: [
{
icon: 'people',
label: 'AGENTS',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/agents/list`),
toStateName: 'agent_list',
},
teams: {
{
icon: 'people-team',
label: 'TEAMS',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/teams/list`),
toStateName: 'settings_teams_list',
},
inboxes: {
{
icon: 'mail-inbox-all',
label: 'INBOXES',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/inboxes/list`),
toStateName: 'settings_inbox_list',
},
labels: {
{
icon: 'tag',
label: 'LABELS',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/labels/list`),
toStateName: 'labels_list',
},
attributes: {
{
icon: 'code',
label: 'CUSTOM_ATTRIBUTES',
hasSubMenu: false,
@@ -75,14 +69,14 @@ const settings = accountId => ({
),
toStateName: 'attributes_list',
},
automation: {
{
icon: 'autocorrect',
label: 'AUTOMATION',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/automation/list`),
toStateName: 'automation_list',
},
cannedResponses: {
{
icon: 'chat-multiple',
label: 'CANNED_RESPONSES',
hasSubMenu: false,
@@ -91,28 +85,28 @@ const settings = accountId => ({
),
toStateName: 'canned_list',
},
settings_integrations: {
{
icon: 'flash-on',
label: 'INTEGRATIONS',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/integrations`),
toStateName: 'settings_integrations',
},
settings_applications: {
{
icon: 'star-emphasis',
label: 'APPLICATIONS',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/applications`),
toStateName: 'settings_applications',
},
general_settings_index: {
{
icon: 'settings',
label: 'ACCOUNT_SETTINGS',
hasSubMenu: false,
toState: frontendURL(`accounts/${accountId}/settings/general`),
toStateName: 'general_settings_index',
},
},
],
});
export default settings;

View File

@@ -10,7 +10,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import PrimaryNavItem from 'dashboard/modules/sidebar/components/PrimaryNavItem';
import PrimaryNavItem from './PrimaryNavItem';
export default {
components: { PrimaryNavItem },
@@ -21,7 +21,7 @@ export default {
}),
unreadCount() {
if (!this.notificationMetadata.unreadCount) {
return '0';
return '';
}
return this.notificationMetadata.unreadCount < 100

View File

@@ -25,7 +25,7 @@
variant="clear"
color-scheme="secondary"
size="small"
icon="ion-help-buoy"
icon="chat-help"
@click="$emit('show-support-chat-window')"
>
{{ $t('SIDEBAR_ITEMS.CONTACT_SUPPORT') }}

View File

@@ -12,7 +12,7 @@
:icon="menuItem.icon"
:name="menuItem.label"
:to="menuItem.toState"
:is-child-menu-active="isMenuActive(menuItem, $route.name)"
:is-child-menu-active="menuItem.key === activeMenuItem"
/>
</nav>
<div class="menu vertical user-menu">
@@ -31,9 +31,9 @@
<script>
import Logo from './Logo';
import PrimaryNavItem from './PrimaryNavItem';
import OptionsMenu from 'dashboard/components/layout/sidebarComponents/OptionsMenu';
import AgentDetails from 'dashboard/components/layout/sidebarComponents/AgentDetails';
import NotificationBell from 'dashboard/components/layout/sidebarComponents/NotificationBell';
import OptionsMenu from './OptionsMenu';
import AgentDetails from './AgentDetails';
import NotificationBell from './NotificationBell';
import { frontendURL } from 'dashboard/helper/URLHelper';
@@ -62,6 +62,10 @@ export default {
type: Array,
default: () => [],
},
activeMenuItem: {
type: String,
default: '',
},
},
data() {
return {
@@ -79,18 +83,6 @@ export default {
toggleSupportChatWindow() {
window.$chatwoot.toggle();
},
isMenuActive(menuItem, currentRouteName) {
const { key = '' } = menuItem;
if (currentRouteName === key) return true;
// Conversations route is defaulted as home
// TODO: Needs to ewfactor old statenames to follow a structure while key naming.
if (currentRouteName.includes('inbox') && key === 'conversations')
return true;
if (currentRouteName.includes('conversations') && key === 'conversations')
return true;
return false;
},
},
};
</script>

View File

@@ -1,67 +1,34 @@
<template>
<div class="main-nav secondary-menu">
<div v-if="menuConfig.menuItems.length" class="main-nav secondary-menu">
<transition-group name="menu-list" tag="ul" class="menu vertical">
<sidebar-item
v-if="shouldShowConversationsSideMenu"
:key="inboxSection.toState"
:menu-item="inboxSection"
<secondary-nav-item
v-for="menuItem in accessibleMenuItems"
:key="menuItem.toState"
:menu-item="menuItem"
/>
<sidebar-item
v-if="shouldShowTeamsSideMenu"
:key="teamSection.toState"
:menu-item="teamSection"
/>
<sidebar-item
v-if="shouldShowConversationsSideMenu"
:key="labelSection.toState"
:menu-item="labelSection"
<secondary-nav-item
v-for="menuItem in additionalSecondaryMenuItems[menuConfig.parentNav]"
:key="menuItem.key"
:menu-item="menuItem"
@add-label="showAddLabelPopup"
/>
<sidebar-item
v-if="shouldShowContactSideMenu"
:key="contactLabelSection.key"
:menu-item="contactLabelSection"
@add-label="showAddLabelPopup"
/>
<sidebar-item
v-if="shouldShowCampaignSideMenu"
:key="campaignSubSection.key"
:menu-item="campaignSubSection"
/>
<sidebar-item
v-if="shouldShowReportsSideMenu"
:key="reportsSubSection.key"
:menu-item="reportsSubSection"
/>
<sidebar-item
v-if="shouldShowSettingsSideMenu"
:key="settingsSubMenu.key"
:menu-item="settingsSubMenu"
/>
<sidebar-item
v-if="shouldShowNotificationsSideMenu"
:key="notificationsSubMenu.key"
:menu-item="notificationsSubMenu"
/>
</transition-group>
</div>
</template>
<script>
import { frontendURL } from '../../../helper/URLHelper';
import SidebarItem from 'dashboard/components/layout/SidebarItem';
import routesMixin from 'dashboard/modules/sidebar/mixins/routes.mixin';
import SecondaryNavItem from './SecondaryNavItem.vue';
export default {
components: {
SidebarItem,
SecondaryNavItem,
},
mixins: [routesMixin],
props: {
accountId: {
type: Number,
default: 0,
},
accountLabels: {
labels: {
type: Array,
default: () => [],
},
@@ -73,12 +40,27 @@ export default {
type: Array,
default: () => [],
},
menuItems: {
type: Array,
default: () => [],
menuConfig: {
type: Object,
default: () => {},
},
currentRole: {
type: String,
default: '',
},
},
computed: {
accessibleMenuItems() {
if (!this.currentRole) {
return [];
}
return this.menuConfig.menuItems.filter(
menuItem =>
window.roleWiseRoutes[this.currentRole].indexOf(
menuItem.toStateName
) > -1
);
},
inboxSection() {
return {
icon: 'folder',
@@ -87,7 +69,6 @@ export default {
newLink: true,
newLinkTag: 'NEW_INBOX',
key: 'inbox',
cssClass: 'menu-title align-justify',
toState: frontendURL(`accounts/${this.accountId}/settings/inboxes/new`),
toStateName: 'settings_inbox_new',
newLinkRouteName: 'settings_inbox_new',
@@ -109,12 +90,11 @@ export default {
newLink: true,
newLinkTag: 'NEW_LABEL',
key: 'label',
cssClass: 'menu-title align-justify',
toState: frontendURL(`accounts/${this.accountId}/settings/labels`),
toStateName: 'labels_list',
showModalForNewItem: true,
modalName: 'AddLabel',
children: this.accountLabels.map(label => ({
children: this.labels.map(label => ({
id: label.id,
label: label.title,
color: label.color,
@@ -133,12 +113,11 @@ export default {
key: 'label',
newLink: true,
newLinkTag: 'NEW_LABEL',
cssClass: 'menu-title align-justify',
toState: frontendURL(`accounts/${this.accountId}/settings/labels`),
toStateName: 'labels_list',
showModalForNewItem: true,
modalName: 'AddLabel',
children: this.accountLabels.map(label => ({
children: this.labels.map(label => ({
id: label.id,
label: label.title,
color: label.color,
@@ -149,9 +128,6 @@ export default {
})),
};
},
campaignSubSection() {
return this.getSubSectionByKey('campaigns');
},
teamSection() {
return {
icon: 'people-team',
@@ -160,7 +136,6 @@ export default {
newLink: true,
newLinkTag: 'NEW_TEAM',
key: 'team',
cssClass: 'menu-title align-justify teams-sidebar-menu',
toState: frontendURL(`accounts/${this.accountId}/settings/teams/new`),
toStateName: 'settings_teams_new',
newLinkRouteName: 'settings_teams_new',
@@ -172,41 +147,18 @@ export default {
})),
};
},
notificationsSubMenu() {
additionalSecondaryMenuItems() {
let conversationMenuItems = [this.inboxSection, this.labelSection];
if (this.teams.length) {
conversationMenuItems = [this.teamSection, ...conversationMenuItems];
}
return {
icon: 'alert',
label: 'NOTIFICATIONS',
hasSubMenu: false,
cssClass: 'menu-title align-justify',
key: 'notifications',
children: [],
conversations: conversationMenuItems,
contacts: [this.contactLabelSection],
};
},
settingsSubMenu() {
return this.getSubSectionByKey('settings');
},
reportsSubSection() {
return this.getSubSectionByKey('reports');
},
},
methods: {
getSubSectionByKey(subSectionKey) {
const menuItems = Object.values(
this.sideMenuItems[subSectionKey].menuItems
);
const campaignItem = this.menuItems.find(
({ key }) => key === subSectionKey
);
return {
...campaignItem,
children: menuItems.map(item => ({
...item,
label: this.$t(`SIDEBAR.${item.label}`),
})),
};
},
showAddLabelPopup() {
this.$emit('add-label');
},

View File

@@ -13,7 +13,7 @@
@click="navigate"
>
<span v-if="icon" class="badge--icon">
<fluent-icon class="inbox-icon" :icon="icon" size="10" />
<fluent-icon class="inbox-icon" :icon="icon" size="12" />
</span>
<span
v-if="labelColor"
@@ -73,7 +73,8 @@ export default {
};
</script>
<style lang="scss" scoped>
$badge-size: var(--space-slab);
$badge-size: var(--space-normal);
$label-badge-size: var(--space-slab);
.button {
margin: var(--space-small) 0;
@@ -117,8 +118,6 @@ $badge-size: var(--space-slab);
.badge--label,
.badge--icon {
display: inline-flex;
min-width: $badge-size;
height: $badge-size;
border-radius: var(--border-radius-small);
margin-right: var(--space-smaller);
background: var(--s-100);
@@ -126,7 +125,15 @@ $badge-size: var(--space-slab);
.badge--icon {
align-items: center;
height: $badge-size;
justify-content: center;
min-width: $badge-size;
}
.badge--label {
height: $label-badge-size;
min-width: $label-badge-size;
margin-left: var(--space-smaller);
}
.badge.secondary {

View File

@@ -1,16 +1,24 @@
<template>
<li :class="computedClass" class="sidebar-item">
<a
class="sub-menu-title"
:class="getMenuItemClass"
data-tooltip
aria-haspopup="true"
:title="menuItem.toolTip"
>
<li class="sidebar-item">
<span v-if="hasSubMenu" class="secondary-menu--title fs-small">
{{ $t(`SIDEBAR.${menuItem.label}`) }}
</a>
<ul v-if="menuItem.hasSubMenu" class="nested vertical menu">
<secondary-nav-item
</span>
<router-link
v-else
class="secondary-menu--title secondary-menu--link fs-small"
:class="computedClass"
:to="menuItem.toState"
>
<fluent-icon
:icon="menuItem.icon"
class="secondary-menu--icon"
size="14"
/>
{{ $t(`SIDEBAR.${menuItem.label}`) }}
</router-link>
<ul v-if="hasSubMenu" class="nested vertical menu">
<secondary-child-nav-item
v-for="child in menuItem.children"
:key="child.id"
:to="child.toState"
@@ -20,7 +28,7 @@
:icon="computedInboxClass(child)"
/>
<router-link
v-if="menuItem.newLink"
v-if="showItem(menuItem)"
v-slot="{ href, isActive, navigate }"
:to="menuItem.toState"
custom
@@ -46,13 +54,13 @@
<script>
import { mapGetters } from 'vuex';
import adminMixin from '../../mixins/isAdmin';
import adminMixin from '../../../mixins/isAdmin';
import { getInboxClassByType } from 'dashboard/helper/inbox';
import SecondaryNavItem from 'dashboard/modules/sidebar/components/SecondaryNavItem';
import SecondaryChildNavItem from './SecondaryChildNavItem';
export default {
components: { SecondaryNavItem },
components: { SecondaryChildNavItem },
mixins: [adminMixin],
props: {
menuItem: {
@@ -62,10 +70,8 @@ export default {
},
computed: {
...mapGetters({ activeInbox: 'getSelectedInbox' }),
getMenuItemClass() {
return this.menuItem.cssClass
? `side-menu ${this.menuItem.cssClass}`
: 'side-menu';
hasSubMenu() {
return !!this.menuItem.children;
},
computedClass() {
// If active Inbox is present
@@ -76,7 +82,7 @@ export default {
this.$store.state.route.name === 'inbox_conversation' &&
this.menuItem.toStateName === 'home'
) {
return 'active';
return 'is-active';
}
return ' ';
},
@@ -88,14 +94,6 @@ export default {
const classByType = getInboxClassByType(type, phoneNumber);
return classByType;
},
computedChildClass(child) {
if (!child.truncateLabel) return '';
return 'text-truncate';
},
computedChildTitle(child) {
if (!child.truncateLabel) return false;
return child.label;
},
newLinkClick(e, navigate) {
if (this.menuItem.newLinkRouteName) {
navigate(e);
@@ -114,17 +112,46 @@ export default {
</script>
<style lang="scss" scoped>
.sidebar-item {
margin: var(--space-small) 0;
margin: var(--space-smaller) 0 0;
}
.sub-menu-title {
display: flex;
justify-content: space-between;
padding: 0 var(--space-small);
margin-bottom: var(--space-smaller);
.secondary-menu--title {
color: var(--s-600);
display: flex;
font-weight: var(--font-weight-bold);
line-height: var(--space-two);
text-transform: uppercase;
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);
&: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);
}
.sub-menu-link {

View File

@@ -1,17 +0,0 @@
import common from './sidebarItems/common';
import contacts from './sidebarItems/contacts';
import reports from './sidebarItems/reports';
import campaigns from './sidebarItems/campaigns';
import settings from './sidebarItems/settings';
import notifications from './sidebarItems/notifications';
// TODO - find hasSubMenu usage - July/2021
export const getSidebarItems = accountId => ({
common: common(accountId),
contacts: contacts(accountId),
reports: reports(accountId),
campaigns: campaigns(accountId),
settings: settings(accountId),
notifications: notifications(accountId),
});

View File

@@ -135,6 +135,7 @@
},
"SIDEBAR": {
"CONVERSATIONS": "Conversations",
"ALL_CONVERSATIONS": "All Conversations",
"REPORTS": "Reports",
"SETTINGS": "Settings",
"CONTACTS": "Contacts",
@@ -209,4 +210,4 @@
"FORWARD_SLASH_KEY": "/"
}
}
}
}

View File

@@ -1,63 +0,0 @@
import { frontendURL } from '../../helper/URLHelper';
const common = accountId => ({
routes: [
'home',
'inbox_dashboard',
'inbox_conversation',
'conversation_through_inbox',
'notifications_dashboard',
'profile_settings',
'profile_settings_index',
'label_conversations',
'conversations_through_label',
'team_conversations',
'conversations_through_team',
'notifications_index',
],
menuItems: {
assignedToMe: {
icon: 'chat',
label: 'CONVERSATIONS',
hasSubMenu: true,
key: 'conversations',
toState: frontendURL(`accounts/${accountId}/dashboard`),
toolTip: 'Conversation from all subscribed inboxes',
toStateName: 'home',
},
contacts: {
key: 'contacts',
icon: 'book-contacts',
label: 'CONTACTS',
hasSubMenu: true,
toState: frontendURL(`accounts/${accountId}/contacts`),
toStateName: 'contacts_dashboard',
},
reports: {
key: 'reports',
icon: 'arrow-trending-lines',
label: 'REPORTS',
hasSubMenu: true,
toState: frontendURL(`accounts/${accountId}/reports`),
toStateName: 'settings_account_reports',
},
campaigns: {
key: 'campaigns',
icon: 'megaphone',
label: 'CAMPAIGNS',
hasSubMenu: true,
toState: frontendURL(`accounts/${accountId}/campaigns`),
toStateName: 'settings_account_campaigns',
},
settings: {
key: 'settings',
icon: 'settings',
label: 'SETTINGS',
hasSubMenu: true,
toState: frontendURL(`accounts/${accountId}/settings`),
toStateName: 'settings_home',
},
},
});
export default common;

View File

@@ -1,35 +0,0 @@
import { getSidebarItems } from 'dashboard/i18n/default-sidebar';
export default {
computed: {
currentRoute() {
return this.$store.state.route.name;
},
sideMenuItems() {
return getSidebarItems(this.accountId);
},
shouldShowConversationsSideMenu() {
return this.sideMenuItems.common.routes.includes(this.currentRoute);
},
shouldShowContactSideMenu() {
return this.sideMenuItems.contacts.routes.includes(this.currentRoute);
},
shouldShowCampaignSideMenu() {
return this.sideMenuItems.campaigns.routes.includes(this.currentRoute);
},
shouldShowSettingsSideMenu() {
return this.sideMenuItems.settings.routes.includes(this.currentRoute);
},
shouldShowReportsSideMenu() {
return this.sideMenuItems.reports.routes.includes(this.currentRoute);
},
shouldShowNotificationsSideMenu() {
return this.sideMenuItems.notifications.routes.includes(
this.currentRoute
);
},
shouldShowTeamsSideMenu() {
return this.shouldShowConversationsSideMenu && this.teams.length;
},
},
};