Browse Source

mobile optimisations - work on merging right and left sidebar (WIP)

pull/4898/head
Daniel Spaude 2 years ago
parent
commit
a8489c3edd
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 2
      packages/nc-gui/components/smartsheet/sidebar/RenameableMenuItem.vue
  2. 11
      packages/nc-gui/components/smartsheet/sidebar/mobile.vue
  3. 4
      packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue

2
packages/nc-gui/components/smartsheet/sidebar/RenameableMenuItem.vue

@ -33,7 +33,7 @@ const { $e } = useNuxtApp()
const { isUIAllowed } = useUIPermission() const { isUIAllowed } = useUIPermission()
const isLocked = inject(IsLockedInj) const isLocked = inject(IsLockedInj, ref(false))
/** Is editing the view name enabled */ /** Is editing the view name enabled */
let isEditing = $ref<boolean>(false) let isEditing = $ref<boolean>(false)

11
packages/nc-gui/components/smartsheet/sidebar/mobile.vue

@ -58,11 +58,19 @@ const { $e } = useNuxtApp()
watch( watch(
[views, () => route.params.viewTitle], [views, () => route.params.viewTitle],
([nextViews, viewTitle]) => { ([nextViews, viewTitle]) => {
// debugger
// alert('mobile watcher')
const lastOpenedViewId = activeTab.value?.id && lastOpenedViewMap.value[activeTab.value?.id] const lastOpenedViewId = activeTab.value?.id && lastOpenedViewMap.value[activeTab.value?.id]
console.log('lastOpenedViewId', lastOpenedViewId)
const lastOpenedView = nextViews.find((v) => v.id === lastOpenedViewId) const lastOpenedView = nextViews.find((v) => v.id === lastOpenedViewId)
console.log('lastOpenedView', lastOpenedView)
// debugger
console.log('viewTitle', viewTitle)
if (viewTitle) { if (viewTitle) {
let view = nextViews.find((v) => v.title === viewTitle) let view = nextViews.find((v) => v.title === viewTitle)
console.log('view', view)
if (view) { if (view) {
activeView.value = view activeView.value = view
setLastOpenedViewId(activeView.value?.id) setLastOpenedViewId(activeView.value?.id)
@ -77,7 +85,8 @@ watch(
}) })
} }
} }
} else if (lastOpenedView) { }
else if (lastOpenedView) {
/** if active view is not found, set it to last opened view */ /** if active view is not found, set it to last opened view */
router.replace({ router.replace({
params: { params: {

4
packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue

@ -29,7 +29,7 @@ function onEdit(targetKey: number, action: 'add' | 'remove' | string) {
if (action === 'remove') closeTab(targetKey) if (action === 'remove') closeTab(targetKey)
} }
const hideSidebarOnClickOrTouchIfMobileMode = (event: Event) => { const hideSidebarOnClickOrTouchIfMobileMode = () => {
if (isMobileMode.value && isOpen.value) { if (isMobileMode.value && isOpen.value) {
toggle(false) toggle(false)
} }
@ -58,7 +58,7 @@ onMounted(() => {
/> />
</div> </div>
<a-tabs v-if="!isMobileMode" v-model:activeKey="activeTabIndex" class="nc-root-tabs" type="editable-card" @edit="onEdit"> <a-tabs v-model:activeKey="activeTabIndex" class="nc-root-tabs" type="editable-card" @edit="onEdit">
<a-tab-pane v-for="(tab, i) of tabs" :key="i"> <a-tab-pane v-for="(tab, i) of tabs" :key="i">
<template #tab> <template #tab>
<div class="flex items-center gap-2" data-testid="nc-tab-title"> <div class="flex items-center gap-2" data-testid="nc-tab-title">

Loading…
Cancel
Save