Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): shared view fullscreen issue

Ramesh Mane53105bddee68
diff --git a/packages/nc-gui/components/nc/FullScreen/ToggleButton.vue b/packages/nc-gui/components/nc/FullScreen/ToggleButton.vue
new file mode 100644
index 0000000000..bba36b27e4
--- /dev/null
+++ b/packages/nc-gui/components/nc/FullScreen/ToggleButton.vue
@@ -0,0 +1,38 @@
+<script setup lang="ts">
+withDefaults(
+ defineProps<{
+ size?: 'small' | 'xs'
+ }>(),
+ {
+ size: 'xs',
+ },
+)
+
+const { isMobileMode } = useGlobal()
+
+const sidebarStore = useSidebarStore()
+
+const { isFullScreen } = storeToRefs(sidebarStore)
+
+const { toggleFullScreenState } = sidebarStore
+</script>
+
+<template>
+ <NcTooltip v-if="!isMobileMode" hide-on-click :title="$t('labels.enterFullscreen')" :disabled="isFullScreen" placement="left">
+ <NcButton
+ :type="isFullScreen ? 'primary' : 'secondary'"
+ :size="size"
+ :class="{
+ '!px-1': size === 'xs' && !isFullScreen,
+ }"
+ :icon-only="!isFullScreen"
+ @click="toggleFullScreenState"
+ >
+ <template #icon>
+ <GeneralIcon v-if="!isFullScreen" icon="ncMaximize2" />
+ <GeneralIcon v-else icon="ncMinimize2" />
+ </template>
+ <template v-if="isFullScreen">{{ $t('labels.exitFullscreen') }}</template>
+ </NcButton>
+ </NcTooltip>
+</template>
diff --git a/packages/nc-gui/components/nc/FullScreen/index.vue b/packages/nc-gui/components/nc/FullScreen/index.vue
index baf1bbd353..6c165208ca 100644
--- a/packages/nc-gui/components/nc/FullScreen/index.vue
+++ b/packages/nc-gui/components/nc/FullScreen/index.vue
@@ -49,11 +49,12 @@ const isPageOnly = computed(() => props.pageOnly || !sf.isEnabled)
const wrapperStyle = computed<CSSProperties | undefined>(() => {
return (isPageOnly.value || props.teleport) && isFullscreen.value
? {
- position: 'fixed',
- left: '0',
- top: '0',
- width: '100%',
- height: '100%',
+ 'position': 'fixed',
+ 'left': '0',
+ 'top': '0',
+ 'width': '100%',
+ 'height': '100%',
+ '--topbar-height': '0px', // We hide the topbar in fullscreen mode, so we need to set it to 0px
}
: undefined
})
diff --git a/packages/nc-gui/components/shared-view/Calendar.vue b/packages/nc-gui/components/shared-view/Calendar.vue
index 41a8243738..f27956b4da 100644
--- a/packages/nc-gui/components/shared-view/Calendar.vue
+++ b/packages/nc-gui/components/shared-view/Calendar.vue
@@ -31,7 +31,7 @@ useViewRowColorProvider({ shared: true })
<template>
<div class="nc-container h-full">
<div class="flex flex-col h-full flex-1 min-w-0">
- <LazySmartsheetToolbar />
+ <LazySmartsheetToolbar show-full-screen-toggle />
<div class="h-full flex-1 min-w-0 min-h-0">
<LazySmartsheetCalendar />
</div>
diff --git a/packages/nc-gui/components/shared-view/Gallery.vue b/packages/nc-gui/components/shared-view/Gallery.vue
index d293dee5fb..aba89ce940 100644
--- a/packages/nc-gui/components/shared-view/Gallery.vue
+++ b/packages/nc-gui/components/shared-view/Gallery.vue
@@ -28,7 +28,7 @@ useViewRowColorProvider({ shared: true })
<template>
<div class="nc-container h-full">
<div class="flex flex-col h-full flex-1 min-w-0">
- <LazySmartsheetToolbar />
+ <LazySmartsheetToolbar show-full-screen-toggle/>
<div class="h-full flex-1 min-w-0 min-h-0 bg-gray-50">
<LazySmartsheetGallery />
</div>
diff --git a/packages/nc-gui/components/shared-view/Grid.vue b/packages/nc-gui/components/shared-view/Grid.vue
index 7bfba440f8..a5685a7e5f 100644
--- a/packages/nc-gui/components/shared-view/Grid.vue
+++ b/packages/nc-gui/components/shared-view/Grid.vue
@@ -51,7 +51,7 @@ watch(
<template>
<div class="nc-container flex flex-col h-full">
- <LazySmartsheetToolbar />
+ <LazySmartsheetToolbar show-full-screen-toggle/>
<LazySmartsheetGrid />
</div>
</template>
diff --git a/packages/nc-gui/components/shared-view/Kanban.vue b/packages/nc-gui/components/shared-view/Kanban.vue
index 4d3c5ac1e3..3043a81344 100644
--- a/packages/nc-gui/components/shared-view/Kanban.vue
+++ b/packages/nc-gui/components/shared-view/Kanban.vue
@@ -29,7 +29,7 @@ useViewRowColorProvider({ shared: true })
<template>
<div class="nc-container h-full">
<div class="flex flex-col h-full flex-1 min-w-0">
- <LazySmartsheetToolbar />
+ <LazySmartsheetToolbar show-full-screen-toggle/>
<div class="h-full flex-1 min-w-0 min-h-0 bg-gray-50">
<LazySmartsheetKanban />
</div>
diff --git a/packages/nc-gui/components/shared-view/Map.vue b/packages/nc-gui/components/shared-view/Map.vue
index f0104d356c..46f9c9742c 100644
--- a/packages/nc-gui/components/shared-view/Map.vue
+++ b/packages/nc-gui/components/shared-view/Map.vue
@@ -27,7 +27,7 @@ useViewRowColorProvider({ shared: true })
<template>
<div class="nc-container h-full mt-1.5 px-12">
<div class="flex flex-col h-full flex-1 min-w-0">
- <LazySmartsheetToolbar />
+ <LazySmartsheetToolbar show-full-screen-toggle />
<div class="h-full flex-1 min-w-0 min-h-0 bg-gray-50">
<LazySmartsheetMap />
</div>
diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vue
index 0e05d1ddd4..4a94f0e431 100644
--- a/packages/nc-gui/components/smartsheet/Gallery.vue
+++ b/packages/nc-gui/components/smartsheet/Gallery.vue
@@ -380,7 +380,7 @@ const handleOpenNewRecordForm = () => {
<div
ref="scrollContainer"
data-testid="nc-gallery-wrapper"
- class="flex flex-col w-full nc-gallery select-none relative nc-scrollbar-md bg-nc-bg-gray-extralight h-[calc(100svh-93px)]"
+ class="flex flex-col w-full nc-gallery select-none relative nc-scrollbar-md bg-nc-bg-gray-extralight h-[calc(100svh-var(--toolbar-height)-var(--topbar-height))]"
>
<NcDropdown
v-model:visible="contextMenu"
diff --git a/packages/nc-gui/components/smartsheet/Toolbar.vue b/packages/nc-gui/components/smartsheet/Toolbar.vue
index ff9f985e9e..97d8472927 100644
--- a/packages/nc-gui/components/smartsheet/Toolbar.vue
+++ b/packages/nc-gui/components/smartsheet/Toolbar.vue
@@ -1,10 +1,8 @@
<script lang="ts" setup>
import { LazySmartsheetToolbarRowColorFilterDropdown } from '#components'
-// Todo: rameshmane7218 in shared view need to pass props
defineProps<{
- toggle: () => void
- isExpanded?: boolean
+ showFullScreenToggle?: boolean
}>()
const isPublic = inject(IsPublicInj, ref(false))
@@ -117,16 +115,6 @@ provide(IsToolbarIconMode, isToolbarIconMode)
}"
/>
- <NcTooltip hide-on-click title="Enter fullscreen" :disabled="isExpanded" placement="left">
- <NcButton type="secondary" size="xs" class="!px-1" @click="toggle">
- <div class="flex gap-2 items-center">
- <GeneralIcon v-if="!isExpanded" icon="ncMaximize2" />
- <GeneralIcon v-else icon="ncMinimize2" />
- <template v-if="isExpanded"> Exit fullscreen </template>
- </div>
- </NcButton>
- </NcTooltip>
-
<div v-if="isCalendar && isMobileMode" class="flex-1 pointer-events-none" />
<LazySmartsheetToolbarCalendarMode v-if="isCalendar && !isTab" :tab="isTab" />
@@ -139,6 +127,7 @@ provide(IsToolbarIconMode, isToolbarIconMode)
<LazySmartsheetToolbarColumnFilterMenu />
<LazySmartsheetToolbarCalendarToggleSideBar />
</template>
+ <LazyNcFullScreenToggleButton v-if="showFullScreenToggle" />
</template>
</div>
</template>
diff --git a/packages/nc-gui/components/smartsheet/toolbar/AddLookupsDropdown.vue b/packages/nc-gui/components/smartsheet/toolbar/AddLookupsDropdown.vue
index 445f3b3dbd..b60089b961 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/AddLookupsDropdown.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/AddLookupsDropdown.vue
@@ -173,7 +173,7 @@ watch(isOpened, async (val) => {
placement="right"
overlay-class-name="!min-w-[256px]"
:align="{
- offset: [8, 15],
+ offset: [9, 15],
}"
>
<slot :is-opened="isOpened" />
diff --git a/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
index 68548e907d..49451fc202 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
@@ -916,8 +916,11 @@ const onAddColumnDropdownVisibilityChange = () => {
v-if="isAddingColumnAllowed"
v-model:visible="addColumnDropdown"
:trigger="['click']"
- overlay-class-name="nc-dropdown-add-column !bg-transparent !border-none !shadow-none"
+ overlay-class-name="nc-dropdown-add-column !bg-transparent !border-none !shadow-none !rounded-2xl"
placement="right"
+ :align="{
+ offset: [9, -15],
+ }"
@visible-change="onAddColumnDropdownVisibilityChange"
>
<NcButton class="nc-fields-add-new-field !font-semibold !px-2" size="small" type="text">
diff --git a/packages/nc-gui/components/tabs/Smartsheet.vue b/packages/nc-gui/components/tabs/Smartsheet.vue
index d8cc99e755..37664a0db9 100644
--- a/packages/nc-gui/components/tabs/Smartsheet.vue
+++ b/packages/nc-gui/components/tabs/Smartsheet.vue
@@ -224,23 +224,6 @@ const onReady = () => {
}, 300)
}
}
-
-const toggleState = () => {
- if (isFullScreen.value) {
- isLeftSidebarOpen.value = true
- document.exitFullscreen()
- if (navigator.keyboard?.unlock) {
- navigator.keyboard.unlock()
- }
- } else {
- isLeftSidebarOpen.value = false
- document.documentElement.requestFullscreen()
- if (navigator.keyboard?.lock) {
- navigator.keyboard.lock(['Escape'])
- }
- }
- isFullScreen.value = !isFullScreen.value
-}
</script>
<template>
@@ -264,7 +247,7 @@ const toggleState = () => {
@resized="onResized"
>
<Pane class="flex flex-col h-full min-w-0" :max-size="contentMaxSize" :size="contentSize">
- <SmartsheetToolbar v-if="!isForm" :toggle="toggleState" :is-expanded="isFullScreen" />
+ <SmartsheetToolbar v-if="!isForm" show-full-screen-toggle />
<div
:style="{ height: isForm || isMobileMode ? '100%' : 'calc(100% - var(--toolbar-height))' }"
class="flex flex-row w-full"
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json
index 4eba5dcf24..faed65b331 100644
--- a/packages/nc-gui/lang/en.json
+++ b/packages/nc-gui/lang/en.json
@@ -1466,7 +1466,9 @@
"sharingRestricted": "Sharing restricted",
"importOptions": "Import Options",
"newScript": "New Script",
- "emptyScript": "Empty Script"
+ "emptyScript": "Empty Script",
+ "enterFullscreen": "Enter fullscreen",
+ "exitFullscreen": "Exit fullscreen"
},
"activity": {
"clickToResolve": "Click to resolve",
diff --git a/packages/nc-gui/layouts/shared-view.vue b/packages/nc-gui/layouts/shared-view.vue
index 47c2d2ab02..4681a599f6 100644
--- a/packages/nc-gui/layouts/shared-view.vue
+++ b/packages/nc-gui/layouts/shared-view.vue
@@ -5,11 +5,13 @@ const { isMobileMode } = storeToRefs(useConfigStore())
const { sharedView, allowCSVDownload } = useSharedView()
+const { isFullScreen } = storeToRefs(useSidebarStore())
+
const router = useRouter()
const route = router.currentRoute
-const disableTopbar = computed(() => route.value.query?.disableTopbar === 'true')
+const disableTopbar = computed(() => route.value.query?.disableTopbar === 'true' || isFullScreen.value)
const ncNotFound = computed(() => route.value.query?.ncNotFound === 'true')
@@ -106,15 +108,17 @@ export default {
</a>
</div>
</a-layout-header>
- <div
- class="nc-shared-view-container w-full overflow-hidden"
- :class="{
- 'nc-shared-mobile-view': isMobileMode,
- 'disable-topbar': disableTopbar,
- }"
- >
- <slot />
- </div>
+ <NcFullScreen v-model="isFullScreen" class="h-full" :page-only="true">
+ <div
+ class="nc-shared-view-container w-full overflow-hidden"
+ :class="{
+ 'nc-shared-mobile-view': isMobileMode,
+ 'disable-topbar': disableTopbar,
+ }"
+ >
+ <slot />
+ </div>
+ </NcFullScreen>
</template>
</a-layout>
</a-layout>
diff --git a/packages/nc-gui/store/sidebar.ts b/packages/nc-gui/store/sidebar.ts
index 85b2e8946b..49e2b7b0b7 100644
--- a/packages/nc-gui/store/sidebar.ts
+++ b/packages/nc-gui/store/sidebar.ts
@@ -84,6 +84,28 @@ export const useSidebarStore = defineStore('sidebarStore', () => {
const showTopbar = ref(false)
+const toggleFullScreenState = () => {
+ if (isFullScreen.value) {
+ isLeftSidebarOpen.value = true
+
+ document.exitFullscreen()
+
+ if (navigator.keyboard?.unlock) {
+ navigator.keyboard.unlock()
+ }
+ } else {
+ isLeftSidebarOpen.value = false
+
+ document.documentElement.requestFullscreen()
+
+ if (navigator.keyboard?.lock) {
+ navigator.keyboard.lock(['Escape'])
+ }
+ }
+
+ isFullScreen.value = !isFullScreen.value
+ }
+
onMounted(() => {
if (!isViewPortMobile() || tablesStore.activeTableId) return
@@ -108,6 +130,7 @@ export const useSidebarStore = defineStore('sidebarStore', () => {
showTopbar,
miniSidebarWidth,
isFullScreen,
+ toggleFullScreenState,
}
})