From 5edf0f2bbe3abbb87b7c6f6e219c30c412bc3ffc Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Mon, 14 Mar 2022 18:14:16 +0530 Subject: [PATCH] fix: Fix modal responsiveness (#4149) --- .../dashboard/components/layout/Sidebar.vue | 47 ++------------- .../dashboard/routes/dashboard/Dashboard.vue | 60 ++++++++++++++++++- 2 files changed, 63 insertions(+), 44 deletions(-) diff --git a/app/javascript/dashboard/components/layout/Sidebar.vue b/app/javascript/dashboard/components/layout/Sidebar.vue index ee64f4949..cdd338710 100644 --- a/app/javascript/dashboard/components/layout/Sidebar.vue +++ b/app/javascript/dashboard/components/layout/Sidebar.vue @@ -19,23 +19,6 @@ :current-role="currentRole" @add-label="showAddLabelPopup" /> - - - - - - @@ -46,12 +29,8 @@ import adminMixin from '../../mixins/isAdmin'; 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 './sidebarComponents/Primary'; import SecondarySidebar from './sidebarComponents/Secondary'; -import WootKeyShortcutModal from 'components/widgets/modal/WootKeyShortcutModal'; import { hasPressedAltAndCKey, hasPressedAltAndRKey, @@ -65,21 +44,13 @@ import router from '../../routes'; export default { components: { - AccountSelector, - AddAccountModal, - AddLabelModal, PrimarySidebar, SecondarySidebar, - WootKeyShortcutModal, }, mixins: [adminMixin, alertMixin, eventListenerMixins], data() { return { showOptionsMenu: false, - showAccountModal: false, - showCreateAccountModal: false, - showAddLabelModal: false, - showShortcutModal: false, }; }, @@ -162,10 +133,10 @@ export default { } }, toggleKeyShortcutModal() { - this.showShortcutModal = true; + this.$emit('open-key-shortcut-modal'); }, closeKeyShortcutModal() { - this.showShortcutModal = false; + this.$emit('close-key-shortcut-modal'); }, handleKeyEvents(e) { if (hasPressedCommandAndForwardSlash(e)) { @@ -200,20 +171,10 @@ export default { window.$chatwoot.toggle(); }, toggleAccountModal() { - this.showAccountModal = !this.showAccountModal; - }, - openCreateAccountModal() { - this.showAccountModal = false; - this.showCreateAccountModal = true; - }, - closeCreateAccountModal() { - this.showCreateAccountModal = false; + this.$emit('toggle-account-modal'); }, showAddLabelPopup() { - this.showAddLabelModal = true; - }, - hideAddLabelPopup() { - this.showAddLabelModal = false; + this.$emit('show-add-label-popup'); }, }, }; diff --git a/app/javascript/dashboard/routes/dashboard/Dashboard.vue b/app/javascript/dashboard/routes/dashboard/Dashboard.vue index 670c93d5d..11903c9ed 100644 --- a/app/javascript/dashboard/routes/dashboard/Dashboard.vue +++ b/app/javascript/dashboard/routes/dashboard/Dashboard.vue @@ -1,9 +1,33 @@ @@ -12,16 +36,28 @@ import Sidebar from '../../components/layout/Sidebar'; import CommandBar from './commands/commandbar.vue'; import { BUS_EVENTS } from 'shared/constants/busEvents'; +import WootKeyShortcutModal from 'dashboard/components/widgets/modal/WootKeyShortcutModal'; +import AddAccountModal from 'dashboard/components/layout/sidebarComponents/AddAccountModal'; +import AccountSelector from 'dashboard/components/layout/sidebarComponents/AccountSelector'; +import AddLabelModal from 'dashboard/routes/dashboard/settings/labels/AddLabel.vue'; export default { components: { Sidebar, CommandBar, + WootKeyShortcutModal, + AddAccountModal, + AccountSelector, + AddLabelModal, }, data() { return { isSidebarOpen: false, isOnDesktop: true, + showAccountModal: false, + showCreateAccountModal: false, + showAddLabelModal: false, + showShortcutModal: false, }; }, computed: { @@ -68,6 +104,28 @@ export default { toggleSidebar() { this.isSidebarOpen = !this.isSidebarOpen; }, + openCreateAccountModal() { + this.showAccountModal = false; + this.showCreateAccountModal = true; + }, + closeCreateAccountModal() { + this.showCreateAccountModal = false; + }, + toggleAccountModal() { + this.showAccountModal = !this.showAccountModal; + }, + toggleKeyShortcutModal() { + this.showShortcutModal = true; + }, + closeKeyShortcutModal() { + this.showShortcutModal = false; + }, + showAddLabelPopup() { + this.showAddLabelModal = true; + }, + hideAddLabelPopup() { + this.showAddLabelModal = false; + }, }, };