From 686116c8241ec6392fc8ba6ffb5defbf96961c0f Mon Sep 17 00:00:00 2001 From: Daniel Spaude Date: Sun, 1 Jan 2023 19:56:41 +0100 Subject: [PATCH] WIP --- .../pages/[projectType]/[projectId]/index.vue | 309 +----------------- 1 file changed, 13 insertions(+), 296 deletions(-) diff --git a/packages/nc-gui/pages/[projectType]/[projectId]/index.vue b/packages/nc-gui/pages/[projectType]/[projectId]/index.vue index b0297b8cd6..3ea437d489 100644 --- a/packages/nc-gui/pages/[projectType]/[projectId]/index.vue +++ b/packages/nc-gui/pages/[projectType]/[projectId]/index.vue @@ -196,7 +196,7 @@ const hideSidebarOnClickOrTouchIfMobileMode = (event: MouseEvent | TouchEvent) = // event.stopPropagation() // event.preventDefault() - if (!isMobileMode.value) { + if (!isMobileMode.value || !isOpen.value) { return } @@ -222,11 +222,12 @@ const hideSidebarOnClickOrTouchIfMobileMode = (event: MouseEvent | TouchEvent) = // console.log(sidebar.value?.contains(event.target as Node)) // debugger - if (event.target !== toggleSideBarButton.value && !toggleSideBarButton.value?.contains(event.target as Node)) { - // alert('now') - toggle(false) - } + // if (event.target !== toggleSideBarButton.value && !toggleSideBarButton.value?.contains(event.target as Node)) { + // alert('now') + // toggle(false) + // } + toggle(!isOpen.value) // debugger // if (isMobileMode.value && isOpen.value && !event.target?.matchesSelector('.show-sidebar-button')) { // if (isMobileMode.value && isOpen.value && event.target !== toggleSideBarButton.value) { @@ -238,12 +239,12 @@ onMounted(() => { toggle(false) toggleHasSidebar(true) // TODO: use useEventListener instead of onMounted and onBeforeUnmount - // document.addEventListener('click', hideSidebarOnClickOrTouchIfMobileMode) - // document.addEventListener('touchstart', hideSidebarOnClickOrTouchIfMobileMode) + document.addEventListener('click', hideSidebarOnClickOrTouchIfMobileMode) + document.addEventListener('touchstart', hideSidebarOnClickOrTouchIfMobileMode) }) onBeforeUnmount(() => { - // document.removeEventListener('click', hideSidebarOnClickOrTouchIfMobileMode) - // document.removeEventListener('touchstart', hideSidebarOnClickOrTouchIfMobileMode) + document.removeEventListener('click', hideSidebarOnClickOrTouchIfMobileMode) + document.removeEventListener('touchstart', hideSidebarOnClickOrTouchIfMobileMode) }) onBeforeUnmount(reset) @@ -292,14 +293,16 @@ useEventListener(document, 'keydown', async (e: KeyboardEvent) => { }) const FOO_ON_OPEN_CLICK = () => { + alert('FOO_ON_OPEN_CLICK') console.log('inside of FOO_ON_OPEN_CLICK') - // toggle(!isOpen) + toggle(!isOpen) }