Skip to content

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

fix(nc-gui): use touch event to close expanded form drawer in mobile mode

Ramesh Mane583901781f28
diff --git a/packages/nc-gui/assets/style.scss b/packages/nc-gui/assets/style.scss
index db12500e1f..936da6a207 100644
--- a/packages/nc-gui/assets/style.scss
+++ b/packages/nc-gui/assets/style.scss
@@ -39,6 +39,10 @@ body {
@supports (min-height: 100dvh) {
min-height: 100dvh !important;
}
+
+ @supports (min-height: 100svh) {
+ min-height: 100svh !important;
+ }
}
}
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue
index aac84c25ef..4a1854d1a3 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue
@@ -673,6 +673,29 @@ const stopLoading = () => {
})
}
+const startY = ref(0)
+const translateY = ref(0)
+
+function onTouchStart(e: TouchEvent) {
+ startY.value = e.touches[0].clientY
+ translateY.value = 0
+}
+
+function onTouchMove(e: TouchEvent) {
+ const delta = e.touches[0].clientY - startY.value
+
+ // only drag downward
+ translateY.value = Math.max(0, delta)
+}
+
+function onTouchEnd() {
+ if (translateY.value > 50) {
+ // dragged down enough -> close
+ onClose()
+ }
+ translateY.value = 0
+}
+
defineExpose({
stopLoading,
})
@@ -700,7 +723,13 @@ export default {
>
<div class="h-[85vh] xs:(max-h-full h-full) max-h-215 flex flex-col">
<div v-if="isMobileMode" class="flex-none h-4 flex items-center justify-center">
- <div class="flex-none h-full flex items-center justify-center cursor-pointer" @click="onClose()">
+ <div
+ class="flex-none h-full flex items-center justify-center cursor-pointer"
+ @touchstart="onTouchStart"
+ @touchmove="onTouchMove"
+ @touchend="onTouchEnd"
+ @click="onClose()"
+ >
<div class="w-[72px] h-[2px] rounded-full bg-nc-bg-gray-dark"></div>
</div>
</div>
@@ -997,6 +1026,10 @@ export default {
@apply !h-[90dvh];
}
+ @supports (height: 90svh) {
+ @apply !h-[90svh];
+ }
+
.ant-drawer-content {
@apply rounded-t-2xl;
}