Skip to content

Modern Docker Management, Designed for Everyone

refactor: replace custom sheet with drawer component (#726)

Kyle Mendell718417fda84b
diff --git a/backend/internal/dto/settings_dto.go b/backend/internal/dto/settings_dto.go
index 0abf67e75..512ac3a34 100644
--- a/backend/internal/dto/settings_dto.go
+++ b/backend/internal/dto/settings_dto.go
@@ -41,5 +41,5 @@ type UpdateSettingsDto struct {
MobileNavigationMode *string `json:"mobileNavigationMode,omitempty"`
MobileNavigationShowLabels *string `json:"mobileNavigationShowLabels,omitempty"`
MobileNavigationScrollToHide *string `json:"mobileNavigationScrollToHide,omitempty"`
- MobileNavigationTapToHide *string `json:"mobileNavigationTapToHide,omitempty"`
+ SidebarHoverExpansion *string `json:"sidebarHoverExpansion,omitempty"`
}
diff --git a/backend/internal/models/settings.go b/backend/internal/models/settings.go
index 9add983be..d89f7cfe4 100644
--- a/backend/internal/models/settings.go
+++ b/backend/internal/models/settings.go
@@ -72,7 +72,7 @@ type Settings struct {
MobileNavigationMode SettingVariable `key:"mobileNavigationMode,public"`
MobileNavigationShowLabels SettingVariable `key:"mobileNavigationShowLabels,public"`
MobileNavigationScrollToHide SettingVariable `key:"mobileNavigationScrollToHide,public"`
- MobileNavigationTapToHide SettingVariable `key:"mobileNavigationTapToHide,public"`
+ SidebarHoverExpansion SettingVariable `key:"sidebarHoverExpansion,public"`
InstanceID SettingVariable `key:"instanceId,internal"`
}
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index 9cb614303..7b32ee020 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -97,7 +97,7 @@ func (s *SettingsService) getDefaultSettings() *models.Settings {
MobileNavigationMode: models.SettingVariable{Value: "floating"},
MobileNavigationShowLabels: models.SettingVariable{Value: "true"},
MobileNavigationScrollToHide: models.SettingVariable{Value: "true"},
- MobileNavigationTapToHide: models.SettingVariable{Value: "false"},
+ SidebarHoverExpansion: models.SettingVariable{Value: "true"},
AccentColor: models.SettingVariable{Value: "oklch(0.606 0.25 292.717)"},
InstanceID: models.SettingVariable{Value: ""},
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 9e0a01bec..a015607c1 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -907,8 +907,6 @@
"navigation_show_labels_description": "Display text labels below navigation icons for better clarity and accessibility",
"navigation_scroll_to_hide_label": "Scroll to Hide",
"navigation_scroll_to_hide_description": "Automatically hide the navigation bar when scrolling down for a cleaner viewing experience",
- "navigation_tap_to_hide_label": "Tap to Hide",
- "navigation_tap_to_hide_description": "Allow users to tap outside the navigation area to quickly show or hide the navigation bar",
"navigation_settings_saved": "Navigation settings saved successfully",
"navigation_desktop_sidebar_title": "Desktop Sidebar",
"navigation_desktop_sidebar_description": "Configure desktop sidebar behavior and appearance",
diff --git a/frontend/package.json b/frontend/package.json
index 6c8df630f..535195c01 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -73,6 +73,7 @@
"tw-animate-css": "^1.4.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.1",
+ "vaul-svelte": "1.0.0-next.7",
"vite": "^7.1.10",
"zod": "^4.1.12"
}
diff --git a/frontend/src/lib/components/mobile-nav/gestures.svelte.ts b/frontend/src/lib/components/mobile-nav/gestures.svelte.ts
new file mode 100644
index 000000000..646109f42
--- /dev/null
+++ b/frontend/src/lib/components/mobile-nav/gestures.svelte.ts
@@ -0,0 +1,203 @@
+import { SwipeGestureDetector, type SwipeDirection } from '$lib/hooks/use-swipe-gesture.svelte';
+
+export interface GestureHandlers {
+ onMenuOpen: () => void;
+ onVisibilityChange: (visible: boolean) => void;
+}
+
+export interface GestureOptions {
+ scrollToHideEnabled: boolean;
+ menuOpen: boolean;
+}
+
+export class MobileNavGestures {
+ private swipeDetector: SwipeGestureDetector;
+ private lastScrollY = $state(0);
+ private lastWheelTime = $state(0);
+ private scrollTimeout: ReturnType<typeof setTimeout> | null = null;
+ private flickDetectTimeout: ReturnType<typeof setTimeout> | null = null;
+ private touchStartY: number | null = null;
+ private isInteractiveTouch = false;
+ private readonly touchMoveThreshold = 6;
+ private readonly scrollThreshold = 10;
+ private readonly minScrollDistance = 80;
+ private readonly flickVelocityThreshold = 3;
+
+ private navElement: HTMLElement | null = null;
+ private handlers: GestureHandlers;
+ private options: GestureOptions;
+
+ constructor(handlers: GestureHandlers, options: GestureOptions) {
+ this.handlers = handlers;
+ this.options = options;
+
+ this.swipeDetector = new SwipeGestureDetector(
+ (direction: SwipeDirection) => {
+ if (direction === 'up') {
+ this.handlers.onMenuOpen();
+ }
+ },
+ {
+ threshold: 20,
+ velocity: 0.1,
+ timeLimit: 1000
+ }
+ );
+ }
+
+ setElement(element: HTMLElement | null) {
+ this.navElement = element;
+ this.swipeDetector.setElement(element);
+ }
+
+ private handleTouchStart = (e: TouchEvent) => {
+ if (this.options.menuOpen) return;
+ const t = e.touches?.[0];
+ if (!t) return;
+ const target = e.target as HTMLElement | null;
+
+ if (target && target.closest && target.closest('button, a, input, select, textarea, [role="button"], [contenteditable]')) {
+ this.isInteractiveTouch = true;
+ this.touchStartY = null;
+ return;
+ }
+ this.isInteractiveTouch = false;
+ this.touchStartY = t.clientY;
+ };
+
+ private handleTouchMove = (e: TouchEvent) => {
+ if (this.options.menuOpen || this.isInteractiveTouch || this.touchStartY === null) return;
+ const t = e.touches?.[0];
+ if (!t) return;
+ const deltaY = t.clientY - this.touchStartY;
+ if (Math.abs(deltaY) < this.touchMoveThreshold) return;
+
+ if (deltaY < 0) {
+ this.handlers.onVisibilityChange(false);
+ } else {
+ this.handlers.onVisibilityChange(true);
+ }
+
+ this.touchStartY = t.clientY;
+ };
+
+ private handleTouchEnd = () => {
+ this.touchStartY = null;
+ this.isInteractiveTouch = false;
+ };
+
+ private handleScroll = () => {
+ const currentScrollY = window.scrollY;
+ const prevScrollY = this.lastScrollY;
+ const scrollDiff = currentScrollY - prevScrollY;
+
+ if (this.scrollTimeout) {
+ clearTimeout(this.scrollTimeout);
+ this.scrollTimeout = null;
+ }
+
+ const scrollHeight = document.documentElement.scrollHeight;
+ const clientHeight = document.documentElement.clientHeight;
+ const atBottom = currentScrollY + clientHeight >= scrollHeight - 5;
+
+ if (scrollDiff < 0 && !atBottom) {
+ this.handlers.onVisibilityChange(true);
+ this.lastScrollY = currentScrollY;
+ } else if (scrollDiff > this.scrollThreshold && currentScrollY > this.minScrollDistance && !atBottom) {
+ this.handlers.onVisibilityChange(false);
+ this.lastScrollY = currentScrollY;
+ } else if (Math.abs(scrollDiff) > this.scrollThreshold) {
+ this.lastScrollY = currentScrollY;
+ }
+
+ if (!atBottom) {
+ this.scrollTimeout = setTimeout(() => {
+ if (window.scrollY < this.minScrollDistance) {
+ this.handlers.onVisibilityChange(true);
+ }
+ }, 150);
+ }
+ };
+
+ private handleWheel = (e: WheelEvent) => {
+ e.preventDefault();
+ if (this.options.menuOpen || !this.options.scrollToHideEnabled || e.deltaY <= 0) return;
+
+ const now = Date.now();
+ const velocity = e.deltaY / Math.max(1, now - this.lastWheelTime);
+
+ if (velocity > this.flickVelocityThreshold) {
+ this.handlers.onMenuOpen();
+ return;
+ }
+
+ this.lastWheelTime = now;
+
+ if (this.flickDetectTimeout) clearTimeout(this.flickDetectTimeout);
+ this.flickDetectTimeout = setTimeout(() => {
+ this.lastWheelTime = 0;
+ }, 200);
+ };
+
+ enableTouchGestures() {
+ if (typeof window === 'undefined') return () => {};
+ if (!this.options.scrollToHideEnabled) return () => {};
+
+ const options = { passive: true, capture: true };
+ window.addEventListener('touchstart', this.handleTouchStart, options);
+ window.addEventListener('touchmove', this.handleTouchMove, options);
+ window.addEventListener('touchend', this.handleTouchEnd, options);
+
+ return () => {
+ window.removeEventListener('touchstart', this.handleTouchStart, options);
+ window.removeEventListener('touchmove', this.handleTouchMove, options);
+ window.removeEventListener('touchend', this.handleTouchEnd, options);
+ };
+ }
+
+ enableScrollGestures() {
+ if (typeof window === 'undefined') return () => {};
+ if (!this.options.scrollToHideEnabled || this.options.menuOpen) {
+ this.handlers.onVisibilityChange(true);
+ return () => {};
+ }
+
+ window.addEventListener('scroll', this.handleScroll, { passive: true });
+
+ return () => {
+ window.removeEventListener('scroll', this.handleScroll);
+ if (this.scrollTimeout) {
+ clearTimeout(this.scrollTimeout);
+ }
+ };
+ }
+
+ enableWheelGestures() {
+ if (!this.navElement || typeof window === 'undefined') return () => {};
+
+ this.navElement.addEventListener('wheel', this.handleWheel, { passive: false });
+
+ return () => {
+ if (this.navElement) {
+ this.navElement.removeEventListener('wheel', this.handleWheel);
+ }
+ if (this.flickDetectTimeout) {
+ clearTimeout(this.flickDetectTimeout);
+ }
+ };
+ }
+
+ updateOptions(options: GestureOptions) {
+ this.options = options;
+ }
+
+ destroy() {
+ this.swipeDetector.setElement(null);
+ if (this.scrollTimeout) {
+ clearTimeout(this.scrollTimeout);
+ }
+ if (this.flickDetectTimeout) {
+ clearTimeout(this.flickDetectTimeout);
+ }
+ }
+}
diff --git a/frontend/src/lib/components/mobile-nav/mobile-nav-menu-button.svelte b/frontend/src/lib/components/mobile-nav/mobile-nav-menu-button.svelte
new file mode 100644
index 000000000..818de791b
--- /dev/null
+++ b/frontend/src/lib/components/mobile-nav/mobile-nav-menu-button.svelte
@@ -0,0 +1,29 @@
+<script lang="ts">
+ import { cn } from '$lib/utils';
+ import { m } from '$lib/paraglide/messages';
+ import Grid3x3Icon from '@lucide/svelte/icons/grid-3x3';
+
+ let {
+ showLabels = true,
+ onclick
+ }: {
+ showLabels?: boolean;
+ onclick: () => void;
+ } = $props();
+</script>
+
+<button
+ type="button"
+ class={cn(
+ 'bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:ring-ring/50 shadow-md',
+ 'flex-shrink-0 rounded-full transition-all duration-200 ease-out active:scale-95',
+ 'flex items-center justify-center',
+ showLabels ? 'size-14' : 'size-14'
+ )}
+ aria-label={m.mobile_navigation()}
+ {onclick}
+ data-testid="mobile-nav-open"
+>
+ <Grid3x3Icon size={28} aria-hidden="true" />
+ <span class="sr-only">{m.mobile_navigation()}</span>
+</button>
diff --git a/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte b/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
index 0f1ca44ee..aaeb4164b 100644
--- a/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
+++ b/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
@@ -2,14 +2,11 @@
import { navigationItems } from '$lib/config/navigation-config';
import type { NavigationItem } from '$lib/config/navigation-config';
import { cn } from '$lib/utils';
- import { SwipeGestureDetector, type SwipeDirection } from '$lib/hooks/use-swipe-gesture.svelte';
import { page } from '$app/state';
import userStore from '$lib/stores/user-store';
import { m } from '$lib/paraglide/messages';
- import { onMount, tick } from 'svelte';
import MobileUserCard from './mobile-user-card.svelte';
- import { fly } from 'svelte/transition';
- import { cubicOut } from 'svelte/easing';
+ import * as Drawer from '$lib/components/ui/drawer/index.js';
let {
open = $bindable(false),
@@ -23,435 +20,19 @@
navigationMode?: 'floating' | 'docked';
} = $props();
- let menuElement = $state<HTMLElement | undefined>(undefined);
let storeUser: any = $state(null);
- // Interaction state
- interface InteractionState {
- isDragging: boolean;
- dragDistance: number;
- startY: number;
- startX: number;
- currentY: number;
- inputType: 'touch' | 'wheel' | 'none';
- isAtScrollTop: boolean;
- isAtScrollBottom: boolean;
- canDragToClose: boolean;
- dragStartedFromHandle: boolean;
- }
-
- let interaction = $state<InteractionState>({
- isDragging: false,
- dragDistance: 0,
- startY: 0,
- startX: 0,
- currentY: 0,
- inputType: 'none',
- isAtScrollTop: true,
- isAtScrollBottom: false,
- canDragToClose: false,
- dragStartedFromHandle: false
- });
-
- let maxSheetHeight = $state(0);
- let resetTimeout: ReturnType<typeof setTimeout> | null = null;
- let isClosing = $state(false);
-
- // Physics configuration
- const PHYSICS = {
- closeThreshold: 0.3, // 30% of sheet height
- resistanceFactor: 0.8, // Resistance when dragging
- velocityThreshold: 0.5, // Minimum velocity for quick close
- snapAnimationDuration: 200, // ms
- wheelSensitivity: 2.0, // Wheel scroll sensitivity (higher for trackpads)
- resetDelay: 150 // ms before resetting wheel state
- } as const;
-
$effect(() => {
const unsub = userStore.subscribe((u) => (storeUser = u));
return unsub;
});
- // Use memoized values defined later for better performance
const currentPath = $derived(page.url.pathname);
-
- // Physics functions
- function updateScrollPosition() {
- if (!menuElement) return;
-
- const scrollTop = menuElement.scrollTop;
- const scrollHeight = menuElement.scrollHeight;
- const clientHeight = menuElement.clientHeight;
-
- interaction.isAtScrollTop = scrollTop === 0;
- interaction.isAtScrollBottom = Math.abs(scrollHeight - clientHeight - scrollTop) <= 2;
-
- // Calculate max sheet height (85vh as per CSS)
- maxSheetHeight = Math.min(window.innerHeight * 0.85, clientHeight);
- }
-
- function calculateDragDistance(currentY: number): number {
- const deltaY = currentY - interaction.startY;
- if (deltaY <= 0) return 0;
-
- // Apply consistent resistance curve for all input types
- const rawDistance = deltaY * PHYSICS.resistanceFactor;
- return Math.min(rawDistance, maxSheetHeight * 0.8);
- }
-
- function shouldCloseSheet(distance: number, velocity: number = 0): boolean {
- const thresholdDistance = maxSheetHeight * PHYSICS.closeThreshold;
- return distance > thresholdDistance || velocity > PHYSICS.velocityThreshold;
- }
-
- function resetInteractionState() {
- interaction.isDragging = false;
- interaction.dragDistance = 0;
- interaction.startY = 0;
- interaction.startX = 0;
- interaction.currentY = 0;
- interaction.inputType = 'none';
- interaction.canDragToClose = false;
- interaction.dragStartedFromHandle = false;
-
- if (resetTimeout) {
- clearTimeout(resetTimeout);
- resetTimeout = null;
- }
- }
-
- function provideFeedback(type: 'grab' | 'close' | 'reset' | 'tap' = 'tap') {
- if (!('vibrate' in navigator)) return;
-
- const patterns = {
- grab: 5,
- close: 20,
- reset: 10,
- tap: 10
- };
-
- navigator.vibrate(patterns[type]);
- }
-
- // Touch handling
- function handleTouchStart(e: TouchEvent) {
- if (!open || !menuElement || isClosing) return;
-
- const touch = e.touches[0];
- const target = e.target as HTMLElement;
-
- // Don't interfere with interactive elements
- if (target.closest('button, a, input, select, textarea, [role="button"]')) {
- return;
- }
-
- const isOnHandle = target.closest('[data-drag-handle]');
-
- // Check current scroll position in real-time
- const currentScrollTop = menuElement.scrollTop;
- const isAtScrollTop = currentScrollTop === 0;
-
- // Initialize interaction state but don't start dragging yet
- interaction.startY = touch.clientY;
- interaction.startX = touch.clientX;
- interaction.currentY = touch.clientY;
- interaction.inputType = 'touch';
- interaction.dragStartedFromHandle = !!isOnHandle;
-
- // Determine if we can drag to close (handle always qualifies, otherwise needs to be at top)
- interaction.canDragToClose = !!isOnHandle || isAtScrollTop;
-
- // Don't set isDragging yet - wait for touchmove to determine intent
- interaction.isDragging = false;
- interaction.dragDistance = 0;
- }
-
- function handleTouchMove(e: TouchEvent) {
- if (!open || interaction.inputType !== 'touch') return;
-
- const touch = e.touches[0];
- interaction.currentY = touch.clientY;
- const deltaY = interaction.currentY - interaction.startY;
- const deltaX = touch.clientX - interaction.startX;
-
- // Check if this is a horizontal swipe - if so, don't interfere
- if (Math.abs(deltaX) > Math.abs(deltaY) && !interaction.isDragging) {
- return;
- }
-
- // For handle-based drags, always allow
- // For content-based drags, ensure we're still at scroll top AND moving down
- let canContinueDrag = interaction.dragStartedFromHandle;
-
- if (!interaction.dragStartedFromHandle) {
- const currentScrollTop = menuElement?.scrollTop ?? 0;
- const isAtScrollTop = currentScrollTop === 0;
- // Only allow content drag if at top AND pulling down (not scrolling up)
- canContinueDrag = isAtScrollTop && interaction.canDragToClose && deltaY > 0;
- }
-
- // Only start dragging if moving downward past threshold and conditions allow
- // Use larger threshold for content (15px) vs handle (5px)
- const threshold = interaction.dragStartedFromHandle ? 5 : 15;
-
- if (deltaY > threshold && canContinueDrag && !interaction.isDragging) {
- // Now we can start dragging
- interaction.isDragging = true;
- provideFeedback('grab');
- // Prevent default to stop background scroll
- e.preventDefault();
- }
-
- if (interaction.isDragging) {
- // Prevent scrolling background when dragging
- e.preventDefault();
-
- // Apply resistance
- const rawDistance = Math.max(0, deltaY);
- interaction.dragDistance = rawDistance * PHYSICS.resistanceFactor;
- } else if (deltaY < 0 && menuElement) {
- // Scrolling up - allow native scroll but prevent background interaction
- // This ensures smooth scrolling within the sheet
- const currentScrollTop = menuElement.scrollTop;
- if (currentScrollTop === 0 && deltaY < 0) {
- // At top and trying to scroll up more - prevent overscroll
- e.preventDefault();
- }
- } else if (deltaY > threshold && !canContinueDrag) {
- // Lost the conditions for dragging (e.g., scrolled down)
- resetInteractionState();
- }
- // If not dragging, let the native scroll work (don't preventDefault)
- }
-
- function handleTouchEnd(e: TouchEvent) {
- if (!interaction.isDragging || interaction.inputType !== 'touch') return;
-
- const deltaY = interaction.currentY - interaction.startY;
- const dragVelocity = Math.abs(deltaY) / (performance.now() - (e.timeStamp || Date.now()));
-
- // Use unified physics to determine if sheet should close
- if (shouldCloseSheet(interaction.dragDistance, dragVelocity)) {
- closeSheet();
- } else {
- // Provide reset feedback if significant drag occurred
- if (interaction.dragDistance > 30) {
- provideFeedback('reset');
- }
- resetInteractionState();
- }
- }
-
- // Unified wheel handling
- function handleWheel(e: WheelEvent) {
- if (!open || !menuElement || isClosing) return;
-
- // Check current scroll position in real-time
- const currentScrollTop = menuElement.scrollTop;
- const isAtScrollTop = currentScrollTop === 0;
- const isScrollingUp = e.deltaY < 0;
-
- // Only handle wheel drag when exactly at scroll top AND scrolling up
- if (isAtScrollTop && isScrollingUp) {
- // Initialize wheel interaction if not already active
- if (interaction.inputType === 'none') {
- interaction.inputType = 'wheel';
- interaction.startY = 0; // Virtual start position for wheel
- interaction.canDragToClose = true;
- interaction.isDragging = true;
- interaction.dragDistance = 0; // Reset accumulated distance
- }
-
- // Only accumulate if we're still at the top and in wheel mode
- if (interaction.inputType === 'wheel' && isAtScrollTop) {
- const wheelDistance = Math.abs(e.deltaY) * PHYSICS.wheelSensitivity;
-
- // For wheel events, we accumulate raw distance and apply resistance directly
- const rawDistance = interaction.dragDistance + wheelDistance;
- const resistedDistance = rawDistance * PHYSICS.resistanceFactor;
- interaction.dragDistance = Math.min(resistedDistance, maxSheetHeight * 0.8);
-
- e.preventDefault();
-
- // Check if should close using unified physics
- if (shouldCloseSheet(interaction.dragDistance)) {
- closeSheet();
- return;
- }
-
- // Schedule reset after wheel stops
- scheduleReset();
- }
- } else {
- // Reset when conditions change (not at top or not scrolling up)
- if (interaction.inputType === 'wheel') {
- resetInteractionState();
- }
- }
- }
-
- function scheduleReset() {
- if (resetTimeout) {
- clearTimeout(resetTimeout);
- }
- resetTimeout = setTimeout(() => {
- if (interaction.inputType === 'wheel') {
- resetInteractionState();
- }
- }, PHYSICS.resetDelay);
- }
-
- function closeSheet() {
- isClosing = true;
- provideFeedback('close');
-
- // Reset all interaction states immediately
- resetInteractionState();
-
- // Close immediately - let CSS transitions handle the smooth animation
- open = false;
- isClosing = false;
- }
-
- // Swipe gesture to close menu (keep existing horizontal swipes)
- const swipeDetector = new SwipeGestureDetector(
- (direction: SwipeDirection) => {
- if ((direction === 'left' || direction === 'right') && open) {
- open = false;
- }
- },
- { threshold: 60, velocity: 0.4 }
- );
-
- $effect(() => {
- if (menuElement) {
- swipeDetector.setElement(menuElement);
-
- // Add scroll listener
- menuElement.addEventListener('scroll', updateScrollPosition, { passive: true });
-
- // Add touch listeners for drag-to-close with optimized passive settings
- menuElement.addEventListener('touchstart', handleTouchStart, { passive: true });
- menuElement.addEventListener('touchmove', handleTouchMove, { passive: false }); // Needs to prevent default
- menuElement.addEventListener('touchend', handleTouchEnd, { passive: true });
-
- // Add wheel listener for trackpad/mouse wheel support
- menuElement.addEventListener('wheel', handleWheel, { passive: false });
-
- // Initial scroll position check
- updateScrollPosition();
-
- return () => {
- if (menuElement) {
- menuElement.removeEventListener('scroll', updateScrollPosition);
- menuElement.removeEventListener('touchstart', handleTouchStart);
- menuElement.removeEventListener('touchmove', handleTouchMove);
- menuElement.removeEventListener('touchend', handleTouchEnd);
- menuElement.removeEventListener('wheel', handleWheel);
- }
- };
- }
- });
-
- // Handle keyboard navigation
- onMount(() => {
- const handleKeyDown = (e: KeyboardEvent) => {
- if (!open) return;
-
- if (e.key === 'Escape') {
- e.preventDefault();
- provideFeedback('close');
- open = false;
- }
- };
-
- window.addEventListener('keydown', handleKeyDown);
-
- return () => {
- window.removeEventListener('keydown', handleKeyDown);
- };
- });
-
- // Proper body scroll locking that prevents background scroll but allows sheet scroll
- $effect(() => {
- if (open && menuElement) {
- // Store original styles
- const scrollY = window.scrollY;
- const bodyStyle = document.body.style;
- const htmlStyle = document.documentElement.style;
-
- const originalBodyOverflow = bodyStyle.overflow;
- const originalBodyPosition = bodyStyle.position;
- const originalBodyTop = bodyStyle.top;
- const originalBodyWidth = bodyStyle.width;
- const originalHtmlOverflow = htmlStyle.overflow;
-
- // Lock background scroll - iOS and desktop compatible
- bodyStyle.overflow = 'hidden';
- bodyStyle.position = 'fixed';
- bodyStyle.top = `-${scrollY}px`;
- bodyStyle.width = '100%';
- bodyStyle.left = '0';
- bodyStyle.right = '0';
- htmlStyle.overflow = 'hidden';
-
- // Wait for layout then setup sheet scrolling
- tick().then(() => {
- if (!menuElement || !open) return;
-
- // Ensure the menu element can scroll independently
- menuElement.style.overflowY = 'auto';
- menuElement.style.touchAction = 'pan-y';
- (menuElement.style as any).webkitOverflowScrolling = 'touch';
-
- // Multiple layout recalculations to ensure content renders
- // First recalculation
- void menuElement.offsetHeight;
-
- // Second recalculation after a frame
- requestAnimationFrame(() => {
- if (menuElement && open) {
- // Force reflow to ensure proper rendering
- void menuElement.offsetHeight;
- // Reset scroll to top to ensure all content is visible
- menuElement.scrollTop = 0;
- // Focus for accessibility
- menuElement.focus();
- }
- });
- });
-
- return () => {
- // Clean up menu styles immediately
- if (menuElement) {
- menuElement.style.overflowY = '';
- menuElement.style.touchAction = '';
- (menuElement.style as any).webkitOverflowScrolling = '';
- }
-
- // Restore immediately, not deferred
- bodyStyle.overflow = originalBodyOverflow;
- bodyStyle.position = originalBodyPosition;
- bodyStyle.top = originalBodyTop;
- bodyStyle.width = originalBodyWidth;
- bodyStyle.left = '';
- bodyStyle.right = '';
- htmlStyle.overflow = originalHtmlOverflow;
-
- // Restore scroll position after a single frame
- requestAnimationFrame(() => {
- window.scrollTo(0, scrollY);
- });
- };
- }
- });
-
- // Memoize the effective user computation
const memoizedUser = $derived.by(() => user ?? storeUser);
const memoizedIsAdmin = $derived.by(() => !!memoizedUser?.roles?.includes('admin'));
- function handleItemClick(item: NavigationItem) {
- provideFeedback('tap');
+ function handleItemClick(item: NavigationItem, event?: MouseEvent) {
+ // Don't prevent default - let the navigation happen
open = false;
}
@@ -460,85 +41,25 @@
}
</script>
-{#if open}
- <div
- class={cn(
- 'bg-background/20 fixed inset-0 z-40 backdrop-blur-md',
- interaction.isDragging && !isClosing ? 'transition-none' : 'transition-opacity duration-200'
- )}
- style={`
- opacity: ${interaction.isDragging && !isClosing ? Math.max(0.1, 1 - interaction.dragDistance / 400) : '1'};
- touch-action: none;
- -webkit-user-select: none;
- user-select: none;
- `}
- onclick={() => {
- provideFeedback('close');
- open = false;
- }}
- onkeydown={(e) => {
- if (e.key === 'Escape') {
- provideFeedback('close');
- open = false;
- }
- }}
- aria-hidden="true"
- role="presentation"
- ></div>
-{/if}
-
-<!-- Menu Content -->
-{#if open}
- <div
- bind:this={menuElement}
- transition:fly={{ y: 500, duration: 300, easing: cubicOut }}
+<Drawer.Root bind:open shouldScaleBackground direction="bottom" modal={true}>
+ <Drawer.Overlay class="fixed inset-0 z-40 bg-black/40 backdrop-blur-sm" />
+ <Drawer.Content
+ data-testid="mobile-nav-sheet"
class={cn(
- 'bg-background/60 border-border/30 fixed inset-x-0 bottom-0 z-50 rounded-t-3xl border-t shadow-sm backdrop-blur-xl',
- 'max-h-[85vh] overflow-y-auto',
- interaction.isDragging && !isClosing ? 'transition-none' : 'transition-transform duration-200 ease-out'
+ 'bg-background/60 border-border/30 rounded-t-3xl border-t shadow-sm backdrop-blur-xl',
+ 'z-50 flex max-h-[85vh] flex-col'
)}
- style={`
- touch-action: pan-y;
- -webkit-overflow-scrolling: touch;
- overscroll-behavior: contain;
- scroll-behavior: smooth;
- transform-origin: bottom center;
- ${
- interaction.isDragging && !isClosing
- ? `transform: translateY(${interaction.dragDistance}px); opacity: ${Math.max(0.3, 1 - interaction.dragDistance / 300)};`
- : 'transform: translateY(0); opacity: 1;'
- }
- `}
- data-testid="mobile-nav-sheet"
- role="dialog"
- aria-modal="true"
- aria-label="Main navigation sheet"
- tabindex={0}
>
- <!-- Handle indicator -->
- <div class="flex justify-center pb-3 pt-4" data-drag-handle>
- <div
- class={cn(
- 'h-1.5 w-10 rounded-full transition-all duration-150',
- interaction.isDragging && !isClosing ? 'bg-muted-foreground/50 h-2 w-12' : 'bg-muted-foreground/20',
- 'hover:bg-muted-foreground/30 active:bg-muted-foreground/50'
- )}
- style={`transform: ${interaction.isDragging && !isClosing ? 'scale(1.15)' : 'scale(1)'};
- transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1), background-color 150ms ease;`}
- ></div>
- </div>
-
- <div class="px-6 pb-4">
- <!-- User Profile Section -->
+ <div class="px-6 pt-4">
{#if memoizedUser}
<MobileUserCard user={memoizedUser} class="mb-6" />
{/if}
+ </div>
- <!-- Navigation Sections -->
+ <div class="scrollbar-hide flex-1 overflow-y-auto px-6">
<div class="space-y-8">
- <!-- Management -->
<section>
- <h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-bold uppercase tracking-widest">
+ <h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-bold tracking-widest uppercase">
{m.sidebar_management()}
</h4>
<div class="space-y-2">
@@ -563,15 +84,13 @@
</div>
</section>
- <!-- Customization -->
<section>
- <h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-bold uppercase tracking-widest">
+ <h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-bold tracking-widest uppercase">
{m.sidebar_customization()}
</h4>
<div class="space-y-2">
{#each navigationItems.customizationItems as item}
{#if item.items}
- <!-- Customization with subitems -->
{@const IconComponent = item.icon}
<div class="space-y-2">
<a
@@ -587,7 +106,6 @@
<IconComponent size={20} />
<span>{item.title}</span>
</a>
- <!-- Sub-items -->
<div class="ml-6 space-y-1">
{#each item.items as subItem}
{@const SubIconComponent = subItem.icon}
@@ -631,12 +149,10 @@
</div>
</section>
- <!-- Admin Sections -->
{#if memoizedIsAdmin}
- <!-- Environments -->
{#if navigationItems.environmentItems}
<section>
- <h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-bold uppercase tracking-widest">
+ <h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-bold tracking-widest uppercase">
{m.sidebar_environments()}
</h4>
<div class="space-y-2">
@@ -660,16 +176,14 @@
</section>
{/if}
- <!-- Administration -->
{#if navigationItems.settingsItems}
<section>
- <h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-bold uppercase tracking-widest">
+ <h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-bold tracking-widest uppercase">
{m.sidebar_administration()}
</h4>
<div class="space-y-2">
{#each navigationItems.settingsItems as item}
{#if item.items}
- <!-- Settings with subitems -->
{@const IconComponent = item.icon}
<div class="space-y-2">
<a
@@ -685,7 +199,6 @@
<IconComponent size={20} />
<span>{item.title}</span>
</a>
- <!-- Sub-items -->
<div class="ml-6 space-y-1">
{#each item.items as subItem}
{@const SubIconComponent = subItem.icon}
@@ -729,54 +242,28 @@
{/if}
{/if}
</div>
+ </div>
- <!-- Version Information -->
+ <div class="border-border/30 border-t px-6 pt-4 pb-4">
{#if versionInformation}
- <div class={cn('border-border/30 mt-6 border-t pt-4', navigationMode === 'docked' ? 'pb-24' : 'pb-6')}>
- <div class="text-muted-foreground/60 text-center text-xs">
- <p class="font-medium">Arcane v{versionInformation.currentVersion}</p>
- {#if versionInformation.updateAvailable}
- <p class="text-primary/80 mt-1 font-medium">Update available</p>
- {/if}
- </div>
+ <div class="text-muted-foreground/60 text-center text-xs">
+ <p class="font-medium">Arcane v{versionInformation.currentVersion}</p>
+ {#if versionInformation.updateAvailable}
+ <p class="text-primary/80 mt-1 font-medium">Update available</p>
+ {/if}
</div>
- {:else}
- <!-- Add padding even if no version info to prevent content hiding behind nav -->
- <div class="pb-20"></div>
{/if}
</div>
- </div>
-{/if}
+ </Drawer.Content>
+</Drawer.Root>
<style>
- /* Ensure smooth scrolling and prevent overscroll issues */
- div[data-testid='mobile-nav-sheet'] {
- overscroll-behavior: contain;
- /* Prevent white background showing through */
- background-clip: padding-box;
- /* Ensure smooth momentum scrolling on iOS */
- -webkit-overflow-scrolling: touch;
- /* Force GPU acceleration */
- transform: translateZ(0);
- will-change: transform, opacity;
- /* Ensure proper stacking context for content */
- position: fixed;
- /* Ensure the container doesn't collapse */
- display: flex;
- flex-direction: column;
- /* Fix potential layout issues when scrolled far down page */
- pointer-events: auto;
- contain: layout;
- }
-
- /* Remove focus outline from dialog container since it's focused for accessibility */
- div[data-testid='mobile-nav-sheet']:focus {
- outline: none;
+ :global(.scrollbar-hide) {
+ -ms-overflow-style: none; /* IE and Edge */
+ scrollbar-width: none; /* Firefox */
}
- /* Ensure content scrolls properly inside the container */
- div[data-testid='mobile-nav-sheet'] > * {
- /* Ensure child elements don't cause layout issues */
- min-height: 0;
+ :global(.scrollbar-hide::-webkit-scrollbar) {
+ display: none; /* Chrome, Safari and Opera */
}
</style>
diff --git a/frontend/src/lib/components/mobile-nav/mobile-nav.svelte b/frontend/src/lib/components/mobile-nav/mobile-nav.svelte
index 65801ab85..3702cd968 100644
--- a/frontend/src/lib/components/mobile-nav/mobile-nav.svelte
+++ b/frontend/src/lib/components/mobile-nav/mobile-nav.svelte
@@ -1,13 +1,13 @@
<script lang="ts">
import { page } from '$app/state';
- import { untrack } from 'svelte';
- import type { NavigationItem, MobileNavigationSettings } from '$lib/config/navigation-config';
+ import type { MobileNavigationSettings } from '$lib/config/navigation-config';
import { getAvailableMobileNavItems } from '$lib/config/navigation-config';
import MobileNavItem from './mobile-nav-item.svelte';
+ import MobileNavMenuButton from './mobile-nav-menu-button.svelte';
import { cn } from '$lib/utils';
- import { SwipeGestureDetector, type SwipeDirection } from '$lib/hooks/use-swipe-gesture.svelte';
import MobileNavSheet from './mobile-nav-sheet.svelte';
import { m } from '$lib/paraglide/messages';
+ import { MobileNavGestures } from './gestures.svelte';
import './styles.css';
let {
@@ -23,6 +23,7 @@
} = $props();
const pinnedItems = $derived.by(() => {
+ if (!navigationSettings?.pinnedItems) return [];
const availableItems = getAvailableMobileNavItems();
return navigationSettings.pinnedItems
.map((url) => availableItems.find((item) => item.url === url))
@@ -30,213 +31,58 @@
});
const currentPath = $derived(page.url.pathname);
- const showLabels = $derived(navigationSettings.showLabels);
- const scrollToHideEnabled = $derived(navigationSettings.scrollToHide);
- const mode = $derived(navigationSettings.mode);
+ const showLabels = $derived(navigationSettings?.showLabels ?? true);
+ const scrollToHideEnabled = $derived(navigationSettings?.scrollToHide ?? true);
+ const mode = $derived(navigationSettings?.mode ?? 'floating');
+
+ const leftItems = $derived(pinnedItems.slice(0, Math.floor(pinnedItems.length / 2)));
+ const rightItems = $derived(pinnedItems.slice(Math.floor(pinnedItems.length / 2)));
let visible = $state(true);
let menuOpen = $state(false);
- let lastScrollY = $state(0);
let navElement: HTMLElement;
- let scrollTimeout: ReturnType<typeof setTimeout> | null = null;
-
- // Touch gesture detection variables
- let touchStartY: number | null = null;
- let isInteractiveTouch = false;
- const touchMoveThreshold = 6;
-
- // Touch-based detection for immediate hide/show
- $effect(() => {
- if (typeof window === 'undefined') return;
- if (!scrollToHideEnabled) return;
-
- const handleTouchStart = (e: TouchEvent) => {
- if (menuOpen) return;
- const t = e.touches?.[0];
- if (!t) return;
- const target = e.target as HTMLElement | null;
-
- if (target && target.closest && target.closest('button, a, input, select, textarea, [role="button"], [contenteditable]')) {
- isInteractiveTouch = true;
- touchStartY = null;
- return;
- }
- isInteractiveTouch = false;
- touchStartY = t.clientY;
- };
-
- const handleTouchMove = (e: TouchEvent) => {
- if (menuOpen || isInteractiveTouch || touchStartY === null) return;
- const t = e.touches?.[0];
- if (!t) return;
- const deltaY = t.clientY - touchStartY;
- if (Math.abs(deltaY) < touchMoveThreshold) return;
- if (deltaY < 0) {
- visible = false;
- } else {
- visible = true;
- }
-
- touchStartY = t.clientY;
- };
-
- const handleTouchEnd = () => {
- touchStartY = null;
- isInteractiveTouch = false;
- };
-
- const options = { passive: true, capture: true };
- window.addEventListener('touchstart', handleTouchStart, options);
- window.addEventListener('touchmove', handleTouchMove, options);
- window.addEventListener('touchend', handleTouchEnd, options);
-
- return () => {
- window.removeEventListener('touchstart', handleTouchStart, options);
- window.removeEventListener('touchmove', handleTouchMove, options);
- window.removeEventListener('touchend', handleTouchEnd, options);
- };
- });
-
- // Swipe gesture detector for opening menu (touch devices swipe UP on nav bar)
- const swipeDetector = new SwipeGestureDetector(
- (direction: SwipeDirection) => {
- if (direction === 'up') {
- menuOpen = true;
- }
+ const gestures = new MobileNavGestures(
+ {
+ onMenuOpen: () => (menuOpen = true),
+ onVisibilityChange: (isVisible) => (visible = isVisible)
},
{
- threshold: 20,
- velocity: 0.1,
- timeLimit: 1000
+ scrollToHideEnabled: false,
+ menuOpen: false
}
);
- // Trackpad flick detection - ONLY super fast velocity flicks trigger the menu
- let lastWheelTime = $state(0);
- let lastWheelDelta = $state(0);
- let flickDetectTimeout: ReturnType<typeof setTimeout> | null = null;
- let wheelVelocityHistory: number[] = $state([]);
-
- // Improved scroll-to-hide using native scroll events with passive listeners
+ // Update gesture options when reactive values change
$effect(() => {
- if (typeof window === 'undefined') return;
- if (!scrollToHideEnabled || menuOpen) {
- visible = true;
- return;
- }
-
- const scrollThreshold = 10;
- const minScrollDistance = 80;
-
- const handleScroll = () => {
- const currentScrollY = window.scrollY;
- const prevScrollY = lastScrollY;
- const scrollDiff = currentScrollY - prevScrollY;
-
- if (scrollTimeout) {
- clearTimeout(scrollTimeout);
- scrollTimeout = null;
- }
-
- const scrollHeight = document.documentElement.scrollHeight;
- const clientHeight = document.documentElement.clientHeight;
- const atBottom = currentScrollY + clientHeight >= scrollHeight - 5;
-
- if (scrollDiff < 0 && !atBottom) {
- visible = true;
- lastScrollY = currentScrollY;
- } else if (scrollDiff > scrollThreshold && currentScrollY > minScrollDistance && !atBottom) {
- visible = false;
- lastScrollY = currentScrollY;
- } else if (Math.abs(scrollDiff) > scrollThreshold) {
- lastScrollY = currentScrollY;
- }
-
- if (!atBottom) {
- scrollTimeout = setTimeout(() => {
- if (window.scrollY < minScrollDistance) {
- visible = true;
- }
- }, 150);
- }
- };
-
- // Wheel handler for detecting ONLY super fast trackpad flicks
- const handleWheel = (e: WheelEvent) => {
- if (menuOpen || !scrollToHideEnabled) return;
-
- // Only respond to downward scrolls (positive deltaY)
- if (e.deltaY <= 0) return;
-
- const now = Date.now();
- const timeSinceLastWheel = now - lastWheelTime;
-
- // Calculate velocity: deltaY per millisecond
- const velocity = e.deltaY / Math.max(1, timeSinceLastWheel);
-
- // Only trigger on EXTREME velocity (> 5 pixels per ms = very fast flick)
- // Normal scrolling is typically 0.1-0.5 px/ms
- // Fast flicks are 2+ px/ms
- // Super fast flicks are 5+ px/ms
- const isSuperFastFlick = velocity > 5;
-
- if (isSuperFastFlick) {
- menuOpen = true;
- wheelVelocityHistory = [];
-
- if (flickDetectTimeout) {
- clearTimeout(flickDetectTimeout);
- }
- }
-
- // Update tracking for next event
- lastWheelTime = now;
- lastWheelDelta = e.deltaY;
- wheelVelocityHistory.push(velocity);
- wheelVelocityHistory = wheelVelocityHistory.slice(-3); // Keep last 3 velocities
-
- // Reset after 200ms of inactivity
- if (flickDetectTimeout) {
- clearTimeout(flickDetectTimeout);
- }
- flickDetectTimeout = setTimeout(() => {
- lastWheelTime = 0;
- lastWheelDelta = 0;
- wheelVelocityHistory = [];
- }, 200);
- };
-
- window.addEventListener('scroll', handleScroll, { passive: true });
- window.addEventListener('wheel', handleWheel, { passive: true });
+ gestures.updateOptions({
+ scrollToHideEnabled,
+ menuOpen
+ });
+ });
- return () => {
- window.removeEventListener('scroll', handleScroll);
- window.removeEventListener('wheel', handleWheel);
- if (scrollTimeout) {
- clearTimeout(scrollTimeout);
- }
- if (flickDetectTimeout) {
- clearTimeout(flickDetectTimeout);
- }
- };
+ // Enable touch gestures
+ $effect(() => {
+ return gestures.enableTouchGestures();
});
- // Show nav when menu closes
+ // Enable scroll gestures
$effect(() => {
- if (!menuOpen) {
- visible = true;
- }
+ return gestures.enableScrollGestures();
});
- // Setup swipe gesture detection on nav element
+ // Enable wheel gestures on nav element
$effect(() => {
if (navElement) {
- swipeDetector.setElement(navElement);
+ gestures.setElement(navElement);
+ return gestures.enableWheelGestures();
+ }
+ });
- return () => {
- swipeDetector.setElement(null);
- };
+ // Show nav when menu closes
+ $effect(() => {
+ if (!menuOpen) {
+ visible = true;
}
});
@@ -294,7 +140,7 @@
'flex items-center',
mode === 'floating'
? cn('rounded-3xl border', showLabels ? 'gap-2 px-3 py-2' : 'gap-3 px-4 py-2.5')
- : cn('border-t border-border/50 justify-around', showLabels ? 'px-3 py-2' : 'px-3 py-2.5'),
+ : cn('border-t border-border/50 justify-around', showLabels ? 'px-4 pt-2 pb-4' : 'px-4 pt-2.5 pb-4'),
visible
? mode === 'floating'
? 'translate-y-0 scale-100 opacity-100'
@@ -311,9 +157,21 @@
</script>
<nav bind:this={navElement} class={navClasses} data-testid={testId} aria-label={ariaLabel}>
- {#each pinnedItems as item (item.url)}
+ <!-- Left side items -->
+ {#each leftItems as item (item.url)}
+ <MobileNavItem {item} {showLabels} active={currentPath === item.url || currentPath.startsWith(item.url + '/')} />
+ {/each}
+
+ <!-- Center action button -->
+ <MobileNavMenuButton {showLabels} onclick={() => (menuOpen = true)} />
+
+ {#each rightItems as item (item.url)}
<MobileNavItem {item} {showLabels} active={currentPath === item.url || currentPath.startsWith(item.url + '/')} />
{/each}
+
+ {#if pinnedItems.length === 0}
+ <MobileNavMenuButton {showLabels} onclick={() => (menuOpen = true)} />
+ {/if}
</nav>
<MobileNavSheet bind:open={menuOpen} {user} {versionInformation} navigationMode={mode} />
diff --git a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
index 44996b326..9131c5631 100644
--- a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
@@ -65,6 +65,7 @@
<Sidebar.MenuButton
{...childProps}
size="lg"
+ tooltipContent={environmentStore.selected ? getEnvLabel(environmentStore.selected) : m.sidebar_no_environment()}
class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
>
{#if environmentStore.selected}
diff --git a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
index 7bb173d1b..028d887dc 100644
--- a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
@@ -56,54 +56,99 @@
<Sidebar.Menu>
{#each enhancedItems as item (item.title)}
{#if (item.items?.length ?? 0) > 0}
- <Collapsible.Root open={item.isActive || (sidebar.state === 'collapsed' && sidebar.isHovered)} class="group/collapsible">
- {#snippet child({ props })}
- <Sidebar.MenuItem {...props}>
- <Collapsible.Trigger>
+ {#if sidebar.state === 'collapsed' && !sidebar.hoverExpansionEnabled}
+ <!-- In collapsed mode without hover expansion, show parent and children as separate icon buttons -->
+ <Sidebar.MenuItem>
+ <Sidebar.MenuButton isActive={item.isActive} tooltipContent={sidebar.hoverExpansionEnabled ? undefined : item.title}>
+ {#snippet child({ props })}
+ {@const Icon = item.icon}
+ <a href={item.url} {...props}>
+ {#if item.icon}
+ <Icon />
+ {/if}
+ <span>{item.title}</span>
+ </a>
+ {/snippet}
+ </Sidebar.MenuButton>
+ </Sidebar.MenuItem>
+ <!-- Separator before sub-items -->
+ <div class="flex justify-center px-2 py-1">
+ <Sidebar.Separator class="my-0 w-6" />
+ </div>
+ {#each item.items ?? [] as subItem (subItem.title)}
+ <Sidebar.MenuItem>
+ <Sidebar.MenuButton
+ isActive={subItem.isActive}
+ tooltipContent={sidebar.hoverExpansionEnabled ? undefined : subItem.title}
+ >
{#snippet child({ props })}
- {@const Icon = item.icon}
- <Sidebar.MenuButton tooltipContent={item.title} isActive={item.isActive}>
- {#snippet child({ props })}
- <a href={item.url} {...props}>
- {#if item.icon}
- <Icon />
- {/if}
- <span>{item.title}</span>
- <ChevronRightIcon
- class="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
- />
- </a>
- {/snippet}
- </Sidebar.MenuButton>
+ {@const SubIcon = subItem.icon}
+ <a href={subItem.url} {...props}>
+ {#if subItem.icon}
+ <SubIcon />
+ {/if}
+ <span>{subItem.title}</span>
+ </a>
{/snippet}
- </Collapsible.Trigger>
- <Collapsible.Content>
- <Sidebar.MenuSub
- class={sidebar.state === 'collapsed' && !sidebar.isHovered ? 'hidden' : undefined}
- >
- {#each item.items ?? [] as subItem (subItem.title)}
- <Sidebar.MenuSubItem>
- <Sidebar.MenuSubButton isActive={subItem.isActive}>
- {#snippet child({ props })}
- {@const SubIcon = subItem.icon}
- <a href={subItem.url} {...props}>
- {#if subItem.icon}
- <SubIcon />
- {/if}
- <span>{subItem.title}</span>
- </a>
- {/snippet}
- </Sidebar.MenuSubButton>
- </Sidebar.MenuSubItem>
- {/each}
- </Sidebar.MenuSub>
- </Collapsible.Content>
+ </Sidebar.MenuButton>
</Sidebar.MenuItem>
- {/snippet}
- </Collapsible.Root>
+ {/each}
+ {:else}
+ <!-- Normal collapsible behavior when expanded or hover expansion is enabled -->
+ <Collapsible.Root open={item.isActive && sidebar.hoverExpansionEnabled} class="group/collapsible">
+ {#snippet child({ props })}
+ <Sidebar.MenuItem {...props}>
+ <Collapsible.Trigger>
+ {#snippet child({ props })}
+ {@const Icon = item.icon}
+ <Sidebar.MenuButton
+ tooltipContent={sidebar.hoverExpansionEnabled ? undefined : item.title}
+ isActive={item.isActive}
+ >
+ {#snippet child({ props })}
+ <a href={item.url} {...props}>
+ {#if item.icon}
+ <Icon />
+ {/if}
+ <span>{item.title}</span>
+ <ChevronRightIcon
+ class="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
+ />
+ </a>
+ {/snippet}
+ </Sidebar.MenuButton>
+ {/snippet}
+ </Collapsible.Trigger>
+ <Collapsible.Content>
+ <Sidebar.MenuSub
+ class={sidebar.state === 'collapsed' && (!sidebar.isHovered || !sidebar.hoverExpansionEnabled)
+ ? 'hidden'
+ : undefined}
+ >
+ {#each item.items ?? [] as subItem (subItem.title)}
+ <Sidebar.MenuSubItem>
+ <Sidebar.MenuSubButton isActive={subItem.isActive}>
+ {#snippet child({ props })}
+ {@const SubIcon = subItem.icon}
+ <a href={subItem.url} {...props}>
+ {#if subItem.icon}
+ <SubIcon />
+ {/if}
+ <span>{subItem.title}</span>
+ </a>
+ {/snippet}
+ </Sidebar.MenuSubButton>
+ </Sidebar.MenuSubItem>
+ {/each}
+ </Sidebar.MenuSub>
+ </Collapsible.Content>
+ </Sidebar.MenuItem>
+ {/snippet}
+ </Collapsible.Root>
+ {/if}
{:else}
<Sidebar.MenuItem>
- <Sidebar.MenuButton isActive={item.isActive} tooltipContent={item.title}>
+ <Sidebar.MenuButton isActive={item.isActive} tooltipContent={sidebar.hoverExpansionEnabled ? undefined : item.title}>
{#snippet child({ props })}
{@const Icon = item.icon}
<a href={item.url} {...props}>
diff --git a/frontend/src/lib/components/ui/drawer/drawer-close.svelte b/frontend/src/lib/components/ui/drawer/drawer-close.svelte
new file mode 100644
index 000000000..95c247963
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-close.svelte
@@ -0,0 +1,7 @@
+<script lang="ts">
+ import { Drawer as DrawerPrimitive } from "vaul-svelte";
+
+ let { ref = $bindable(null), ...restProps }: DrawerPrimitive.CloseProps = $props();
+</script>
+
+<DrawerPrimitive.Close bind:ref data-slot="drawer-close" {...restProps} />
diff --git a/frontend/src/lib/components/ui/drawer/drawer-content.svelte b/frontend/src/lib/components/ui/drawer/drawer-content.svelte
new file mode 100644
index 000000000..f20e9ff65
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-content.svelte
@@ -0,0 +1,37 @@
+<script lang="ts">
+ import { Drawer as DrawerPrimitive } from "vaul-svelte";
+ import DrawerOverlay from "./drawer-overlay.svelte";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ portalProps,
+ children,
+ ...restProps
+ }: DrawerPrimitive.ContentProps & {
+ portalProps?: DrawerPrimitive.PortalProps;
+ } = $props();
+</script>
+
+<DrawerPrimitive.Portal {...portalProps}>
+ <DrawerOverlay />
+ <DrawerPrimitive.Content
+ bind:ref
+ data-slot="drawer-content"
+ class={cn(
+ "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
+ className
+ )}
+ {...restProps}
+ >
+ <div
+ class="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"
+ ></div>
+ {@render children?.()}
+ </DrawerPrimitive.Content>
+</DrawerPrimitive.Portal>
diff --git a/frontend/src/lib/components/ui/drawer/drawer-description.svelte b/frontend/src/lib/components/ui/drawer/drawer-description.svelte
new file mode 100644
index 000000000..2763a1aa4
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-description.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { Drawer as DrawerPrimitive } from "vaul-svelte";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: DrawerPrimitive.DescriptionProps = $props();
+</script>
+
+<DrawerPrimitive.Description
+ bind:ref
+ data-slot="drawer-description"
+ class={cn("text-muted-foreground text-sm", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/drawer/drawer-footer.svelte b/frontend/src/lib/components/ui/drawer/drawer-footer.svelte
new file mode 100644
index 000000000..1691f582a
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-footer.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { cn, type WithElementRef } from "$lib/utils.js";
+ import type { HTMLAttributes } from "svelte/elements";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+</script>
+
+<div
+ bind:this={ref}
+ data-slot="drawer-footer"
+ class={cn("mt-auto flex flex-col gap-2 p-4", className)}
+ {...restProps}
+>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/drawer/drawer-header.svelte b/frontend/src/lib/components/ui/drawer/drawer-header.svelte
new file mode 100644
index 000000000..65d2de57d
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-header.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import type { HTMLAttributes } from "svelte/elements";
+ import { cn, type WithElementRef } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+</script>
+
+<div
+ bind:this={ref}
+ data-slot="drawer-header"
+ class={cn("flex flex-col gap-1.5 p-4", className)}
+ {...restProps}
+>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/drawer/drawer-nested.svelte b/frontend/src/lib/components/ui/drawer/drawer-nested.svelte
new file mode 100644
index 000000000..834af9461
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-nested.svelte
@@ -0,0 +1,12 @@
+<script lang="ts">
+ import { Drawer as DrawerPrimitive } from "vaul-svelte";
+
+ let {
+ shouldScaleBackground = true,
+ open = $bindable(false),
+ activeSnapPoint = $bindable(null),
+ ...restProps
+ }: DrawerPrimitive.RootProps = $props();
+</script>
+
+<DrawerPrimitive.NestedRoot {shouldScaleBackground} bind:open bind:activeSnapPoint {...restProps} />
diff --git a/frontend/src/lib/components/ui/drawer/drawer-overlay.svelte b/frontend/src/lib/components/ui/drawer/drawer-overlay.svelte
new file mode 100644
index 000000000..53f78a2ca
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-overlay.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { Drawer as DrawerPrimitive } from "vaul-svelte";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: DrawerPrimitive.OverlayProps = $props();
+</script>
+
+<DrawerPrimitive.Overlay
+ bind:ref
+ data-slot="drawer-overlay"
+ class={cn(
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
+ className
+ )}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/drawer/drawer-title.svelte b/frontend/src/lib/components/ui/drawer/drawer-title.svelte
new file mode 100644
index 000000000..a2e5761d5
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-title.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { Drawer as DrawerPrimitive } from "vaul-svelte";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: DrawerPrimitive.TitleProps = $props();
+</script>
+
+<DrawerPrimitive.Title
+ bind:ref
+ data-slot="drawer-title"
+ class={cn("text-foreground font-semibold", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/drawer/drawer-trigger.svelte b/frontend/src/lib/components/ui/drawer/drawer-trigger.svelte
new file mode 100644
index 000000000..f1877d8e2
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer-trigger.svelte
@@ -0,0 +1,7 @@
+<script lang="ts">
+ import { Drawer as DrawerPrimitive } from "vaul-svelte";
+
+ let { ref = $bindable(null), ...restProps }: DrawerPrimitive.TriggerProps = $props();
+</script>
+
+<DrawerPrimitive.Trigger bind:ref data-slot="drawer-trigger" {...restProps} />
diff --git a/frontend/src/lib/components/ui/drawer/drawer.svelte b/frontend/src/lib/components/ui/drawer/drawer.svelte
new file mode 100644
index 000000000..0cb57ff99
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/drawer.svelte
@@ -0,0 +1,12 @@
+<script lang="ts">
+ import { Drawer as DrawerPrimitive } from "vaul-svelte";
+
+ let {
+ shouldScaleBackground = true,
+ open = $bindable(false),
+ activeSnapPoint = $bindable(null),
+ ...restProps
+ }: DrawerPrimitive.RootProps = $props();
+</script>
+
+<DrawerPrimitive.Root {shouldScaleBackground} bind:open bind:activeSnapPoint {...restProps} />
diff --git a/frontend/src/lib/components/ui/drawer/index.ts b/frontend/src/lib/components/ui/drawer/index.ts
new file mode 100644
index 000000000..cfbdb8b2f
--- /dev/null
+++ b/frontend/src/lib/components/ui/drawer/index.ts
@@ -0,0 +1,41 @@
+import { Drawer as DrawerPrimitive } from "vaul-svelte";
+
+import Root from "./drawer.svelte";
+import Content from "./drawer-content.svelte";
+import Description from "./drawer-description.svelte";
+import Overlay from "./drawer-overlay.svelte";
+import Footer from "./drawer-footer.svelte";
+import Header from "./drawer-header.svelte";
+import Title from "./drawer-title.svelte";
+import NestedRoot from "./drawer-nested.svelte";
+import Close from "./drawer-close.svelte";
+import Trigger from "./drawer-trigger.svelte";
+
+const Portal: typeof DrawerPrimitive.Portal = DrawerPrimitive.Portal;
+
+export {
+ Root,
+ NestedRoot,
+ Content,
+ Description,
+ Overlay,
+ Footer,
+ Header,
+ Title,
+ Trigger,
+ Portal,
+ Close,
+
+ //
+ Root as Drawer,
+ NestedRoot as DrawerNestedRoot,
+ Content as DrawerContent,
+ Description as DrawerDescription,
+ Overlay as DrawerOverlay,
+ Footer as DrawerFooter,
+ Header as DrawerHeader,
+ Title as DrawerTitle,
+ Trigger as DrawerTrigger,
+ Portal as DrawerPortal,
+ Close as DrawerClose,
+};
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
index 4156961ec..ad4e25f45 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
@@ -2,7 +2,7 @@
import { tv, type VariantProps } from 'tailwind-variants';
export const sidebarMenuButtonVariants = tv({
- base: 'peer/menu-button outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground group-has-data-[sidebar=menu-action]/menu-item:pr-8 data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
+ base: 'peer/menu-button outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground group-has-data-[sidebar=menu-action]/menu-item:pr-8 data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-0 flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:flex-shrink-0 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>svg.ml-auto]:hidden group-data-[collapsible=icon]:[&>div.grid]:hidden [&>a]:flex [&>a]:w-full [&>a]:items-center [&>a]:gap-2 [&>button]:flex [&>button]:w-full [&>button]:items-center [&>button]:gap-2 group-data-[collapsible=icon]:[&>a]:w-auto group-data-[collapsible=icon]:[&>button]:w-auto',
variants: {
variant: {
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
@@ -58,10 +58,17 @@
const buttonProps = $derived({
class: cn(
sidebarMenuButtonVariants({ variant, size }),
+ // Always ensure icons are visible and centered in collapsed mode
+ 'group-data-[collapsible=icon]:!justify-center',
sidebar.hoverExpansionEnabled && [
- 'group-data-[collapsible=icon]:group-data-[hovered=true]:w-full!',
+ 'group-data-[collapsible=icon]:group-data-[hovered=true]:!w-full group-data-[collapsible=icon]:group-data-[hovered=true]:!justify-start',
+ 'group-data-[collapsible=icon]:group-data-[hovered=true]:[&>a]:!w-full group-data-[collapsible=icon]:group-data-[hovered=true]:[&>a]:!justify-start',
+ 'group-data-[collapsible=icon]:group-data-[hovered=true]:[&>button]:!w-full group-data-[collapsible=icon]:group-data-[hovered=true]:[&>button]:!justify-start',
+ 'group-data-[collapsible=icon]:group-data-[hovered=true]:[&>span]:!block',
+ 'group-data-[collapsible=icon]:group-data-[hovered=true]:[&>div.grid]:!grid',
+ 'group-data-[collapsible=icon]:group-data-[hovered=true]:[&>svg.ml-auto]:!block',
size === 'lg' &&
- 'group-data-[collapsible=icon]:group-data-[hovered=true]:h-12! group-data-[collapsible=icon]:group-data-[hovered=true]:p-2!'
+ 'group-data-[collapsible=icon]:group-data-[hovered=true]:!h-12 group-data-[collapsible=icon]:group-data-[hovered=true]:!p-2'
],
className
),
@@ -86,24 +93,23 @@
{#if !tooltipContent}
{@render Button({})}
-{:else}
+{:else if sidebar.state === 'collapsed'}
<Tooltip.Root>
<Tooltip.Trigger>
{#snippet child({ props })}
{@render Button({ props })}
{/snippet}
</Tooltip.Trigger>
- <Tooltip.Content
- side="right"
- align="center"
- hidden={sidebar.state !== 'collapsed' || (sidebar.hoverExpansionEnabled && sidebar.isHovered)}
- {...tooltipContentProps}
- >
- {#if typeof tooltipContent === 'string'}
- {tooltipContent}
- {:else if tooltipContent}
- {@render tooltipContent()}
+ <Tooltip.Content side="right" align="center" class="z-50" {...tooltipContentProps}>
+ {#if !(sidebar.hoverExpansionEnabled && sidebar.isHovered)}
+ {#if typeof tooltipContent === 'string'}
+ {tooltipContent}
+ {:else if tooltipContent}
+ {@render tooltipContent()}
+ {/if}
{/if}
</Tooltip.Content>
</Tooltip.Root>
+{:else}
+ {@render Button({})}
{/if}
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
index ef1b31931..676852e55 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
@@ -7,6 +7,7 @@
import { IsTablet } from '$lib/hooks/is-tablet.svelte.js';
import { IsMobile } from '$lib/hooks/is-mobile.svelte.js';
import { PersistedState } from 'runed';
+ import settingsStore from '$lib/stores/config-store';
const persistedPinned = new PersistedState('sidebar-pinned', true);
@@ -58,6 +59,14 @@
document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
}
});
+
+ // Sync sidebar hover expansion with backend settings
+ $effect(() => {
+ const settings = $settingsStore;
+ if (settings && settings.sidebarHoverExpansion !== undefined) {
+ sidebar.setHoverExpansion(settings.sidebarHoverExpansion);
+ }
+ });
</script>
<svelte:window onkeydown={sidebar.handleShortcutKeydown} />
diff --git a/frontend/src/lib/config/navigation-config.ts b/frontend/src/lib/config/navigation-config.ts
index 653c48d2a..3720bd559 100644
--- a/frontend/src/lib/config/navigation-config.ts
+++ b/frontend/src/lib/config/navigation-config.ts
@@ -86,7 +86,6 @@ export type MobileNavigationSettings = {
mode: 'floating' | 'docked';
showLabels: boolean;
scrollToHide: boolean;
- tapToHide: boolean;
};
export function getAvailableMobileNavItems(): NavigationItem[] {
@@ -117,6 +116,5 @@ export const defaultMobileNavigationSettings: MobileNavigationSettings = {
pinnedItems: defaultMobilePinnedItems.map((item) => item.url),
mode: 'floating',
showLabels: true,
- scrollToHide: true,
- tapToHide: false
+ scrollToHide: true
};
diff --git a/frontend/src/lib/hooks/use-mobile-nav-interactions.ts b/frontend/src/lib/hooks/use-mobile-nav-interactions.ts
index b9ee981f8..dde987acc 100644
--- a/frontend/src/lib/hooks/use-mobile-nav-interactions.ts
+++ b/frontend/src/lib/hooks/use-mobile-nav-interactions.ts
@@ -1,5 +1,4 @@
import { ScrollDirectionDetector } from './use-scroll-direction.svelte';
-import { TapOutsideDetector } from './use-tap-outside.svelte';
import { SwipeGestureDetector, type SwipeDirection } from './use-swipe-gesture.svelte';
export interface MobileNavInteractionOptions {
@@ -34,13 +33,11 @@ export interface MobileNavInteractionCallbacks {
export interface MobileNavInteractionState {
menuOpen: boolean;
scrollToHideEnabled: boolean;
- tapToHideEnabled: boolean;
visible: boolean;
}
export class MobileNavInteractionManager {
private readonly scrollDetector: ScrollDirectionDetector;
- private readonly tapDetector: TapOutsideDetector;
private readonly swipeDetector: SwipeGestureDetector;
private readonly options: Required<MobileNavInteractionOptions>;
@@ -48,7 +45,6 @@ export class MobileNavInteractionManager {
private state: MobileNavInteractionState;
private navElement: HTMLElement | null = null;
- private tapDebounceTimeoutId: ReturnType<typeof setTimeout> | null = null;
private lastGestureTime = 0;
private lastScrollDirection: string | null = null;
private lastScrollY = 0;
@@ -80,34 +76,12 @@ export class MobileNavInteractionManager {
this.state = {
menuOpen: false,
scrollToHideEnabled: false,
- tapToHideEnabled: false,
visible: true
};
// Initialize detectors directly in constructor
this.scrollDetector = new ScrollDirectionDetector(this.options.scrollThreshold);
- this.tapDetector = new TapOutsideDetector(() => {
- if (!this.state.tapToHideEnabled) return;
-
- // Debounce rapid taps to prevent bouncing animation
- if (this.tapDebounceTimeoutId) {
- clearTimeout(this.tapDebounceTimeoutId);
- this.tapDebounceTimeoutId = null;
- return;
- }
-
- // Toggle visibility - if visible, hide it; if hidden, show it
- const newVisibility = !this.state.visible;
- this.state.visible = newVisibility;
- this.callbacks.onVisibilityChange(newVisibility);
-
- // Set debounce timeout
- this.tapDebounceTimeoutId = setTimeout(() => {
- this.tapDebounceTimeoutId = null;
- }, this.options.tapDebounceTimeout);
- });
-
this.swipeDetector = new SwipeGestureDetector(
(direction: SwipeDirection) => {
if (direction === 'up') {
@@ -140,11 +114,6 @@ export class MobileNavInteractionManager {
if (!element) return;
- // Setup tap detection target
- if (this.state.tapToHideEnabled) {
- this.tapDetector.setTargetElement(element);
- }
-
// Setup swipe detection target
this.swipeDetector.setElement(element);
@@ -277,12 +246,6 @@ export class MobileNavInteractionManager {
// Cleanup scroll detector
this.scrollDetector.cleanup();
- // Clear tap debounce timeout
- if (this.tapDebounceTimeoutId) {
- clearTimeout(this.tapDebounceTimeoutId);
- this.tapDebounceTimeoutId = null;
- }
-
// Clean up any remaining styles
if (document.body) {
document.body.style.pointerEvents = '';
diff --git a/frontend/src/lib/hooks/use-tap-outside.svelte.ts b/frontend/src/lib/hooks/use-tap-outside.svelte.ts
deleted file mode 100644
index c3433fc42..000000000
--- a/frontend/src/lib/hooks/use-tap-outside.svelte.ts
+++ /dev/null
@@ -1,125 +0,0 @@
-import { onMount } from 'svelte';
-
-export class TapOutsideDetector {
- private callback: () => void;
- private targetElement = $state<HTMLElement | null>(null);
- private touchStartTime = 0;
- private touchStartPosition = { x: 0, y: 0 };
-
- constructor(callback: () => void) {
- this.callback = callback;
-
- onMount(() => {
- const handleInteraction = (event: MouseEvent | TouchEvent) => {
- // Only trigger on non-interactive elements
- const target = event.target as HTMLElement;
-
- // Check if the interaction is on an interactive element
- const isInteractive = this.isInteractiveElement(target);
-
- // If no target element has been set yet, don't treat interactions
- // as taps outside — short-circuit to avoid spurious closes.
- if (!this.targetElement) return;
-
- // Compute styles once for the target element and check visibility.
- const navStyle = window.getComputedStyle(this.targetElement);
- const isVisibleNavElement =
- this.targetElement.contains(target) &&
- navStyle.visibility !== 'hidden' &&
- navStyle.opacity !== '0' &&
- navStyle.display !== 'none' &&
- navStyle.pointerEvents !== 'none';
-
- // Interaction is outside only when the nav exists and the event target
- // is not within the visible nav element.
- const isOutsideNav = !isVisibleNavElement;
-
- // Only call the callback when the element exists, the interaction is
- // outside the visible nav, and the target is not an interactive element.
- if (!isInteractive && isOutsideNav && this.targetElement) {
- this.callback();
- }
- };
-
- const handleTouchStart = (event: TouchEvent) => {
- const touch = event.touches[0];
- this.touchStartTime = Date.now();
- this.touchStartPosition = { x: touch.clientX, y: touch.clientY };
- };
-
- const handleTouchEnd = (event: TouchEvent) => {
- const touch = event.changedTouches[0];
- const endTime = Date.now();
- const endPosition = { x: touch.clientX, y: touch.clientY };
-
- // Calculate distance moved and time elapsed
- const distance = Math.sqrt(
- Math.pow(endPosition.x - this.touchStartPosition.x, 2) + Math.pow(endPosition.y - this.touchStartPosition.y, 2)
- );
- const duration = endTime - this.touchStartTime;
-
- // Only trigger if it's a tap (short duration, minimal movement)
- // This prevents triggering on swipes, scrolls, or long presses
- if (duration < 300 && distance < 10) {
- const target = document.elementFromPoint(touch.clientX, touch.clientY) as HTMLElement;
-
- if (target) {
- // Create a synthetic event for consistency
- const syntheticEvent = { target } as unknown as TouchEvent;
- handleInteraction(syntheticEvent);
- }
- }
- };
-
- // Use capture phase to catch events before they reach other elements
- // But use bubble phase for touchend to avoid conflicts with navigation bar
- document.addEventListener('click', handleInteraction, true);
- document.addEventListener('touchstart', handleTouchStart, true);
- document.addEventListener('touchend', handleTouchEnd, false);
-
- return () => {
- document.removeEventListener('click', handleInteraction, true);
- document.removeEventListener('touchstart', handleTouchStart, true);
- document.removeEventListener('touchend', handleTouchEnd, false);
- };
- });
- }
-
- setTargetElement(element: HTMLElement | null) {
- this.targetElement = element;
- }
-
- private isInteractiveElement(element: HTMLElement): boolean {
- // Check if element or any parent is interactive
- let current: HTMLElement | null = element;
-
- while (current) {
- const tagName = current.tagName.toLowerCase();
- const role = current.getAttribute('role');
-
- // Interactive elements
- if (['a', 'button', 'input', 'select', 'textarea'].includes(tagName)) {
- return true;
- }
-
- // Elements with interactive roles
- if (role && ['button', 'link', 'menuitem', 'option', 'tab'].includes(role)) {
- return true;
- }
-
- // Elements with click handlers (heuristic)
- if (current.onclick || current.style.cursor === 'pointer') {
- return true;
- }
-
- // Elements with data attributes suggesting interactivity
- if (current.hasAttribute('data-testid') && current.getAttribute('data-testid')?.includes('button')) {
- return true;
- }
-
- current = current.parentElement;
- }
-
- return false;
- }
-}
diff --git a/frontend/src/lib/types/settings.type.ts b/frontend/src/lib/types/settings.type.ts
index 5688651e1..ff19c7f8b 100644
--- a/frontend/src/lib/types/settings.type.ts
+++ b/frontend/src/lib/types/settings.type.ts
@@ -40,7 +40,7 @@ export type Settings = {
mobileNavigationMode: 'floating' | 'docked';
mobileNavigationShowLabels: boolean;
mobileNavigationScrollToHide: boolean;
- mobileNavigationTapToHide: boolean;
+ sidebarHoverExpansion: boolean;
registryCredentials: RegistryCredential[];
templateRegistries: TemplateRegistryConfig[];
diff --git a/frontend/src/lib/utils/navigation.utils.ts b/frontend/src/lib/utils/navigation.utils.ts
index dc57dce70..4412e76a3 100644
--- a/frontend/src/lib/utils/navigation.utils.ts
+++ b/frontend/src/lib/utils/navigation.utils.ts
@@ -45,11 +45,6 @@ export function getEffectiveNavigationSettings(): MobileNavigationSettings {
serverSettings?.mobileNavigationScrollToHide,
overrides.scrollToHide,
defaultMobileNavigationSettings.scrollToHide
- ),
- tapToHide: getEffectiveValue(
- serverSettings?.mobileNavigationTapToHide,
- overrides.tapToHide,
- defaultMobileNavigationSettings.tapToHide
)
};
}
diff --git a/frontend/src/routes/environments/[id]/+page.svelte b/frontend/src/routes/environments/[id]/+page.svelte
index 21985fd13..8a047eca1 100644
--- a/frontend/src/routes/environments/[id]/+page.svelte
+++ b/frontend/src/routes/environments/[id]/+page.svelte
@@ -372,15 +372,6 @@
/>
</div>
</div>
- <div>
- <Label class="text-muted-foreground text-sm font-medium">{m.navigation_tap_to_hide_label()}</Label>
- <div class="mt-1">
- <StatusBadge
- text={settings.mobileNavigationTapToHide ? m.common_enabled() : m.common_disabled()}
- variant={settings.mobileNavigationTapToHide ? 'green' : 'gray'}
- />
- </div>
- </div>
</div>
</div>
{/if}
diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte
index 299afb693..ea3148c4e 100644
--- a/frontend/src/routes/settings/+page.svelte
+++ b/frontend/src/routes/settings/+page.svelte
@@ -176,6 +176,38 @@
'customize'
],
settings: [
+ {
+ key: 'sidebarHoverExpansion',
+ label: m.navigation_sidebar_hover_expansion_label(),
+ type: 'boolean',
+ description: m.navigation_sidebar_hover_expansion_description(),
+ keywords: [
+ 'sidebar',
+ 'hover',
+ 'expansion',
+ 'expand',
+ 'desktop',
+ 'mouse',
+ 'over',
+ 'collapsed',
+ 'collapsible',
+ 'icon',
+ 'labels',
+ 'text',
+ 'preview',
+ 'peek',
+ 'tooltip',
+ 'overlay',
+ 'temporary',
+ 'quick',
+ 'access',
+ 'navigation',
+ 'menu',
+ 'items',
+ 'submenu',
+ 'nested'
+ ]
+ },
{
key: 'mobileNavigationMode',
label: m.navigation_mode_label(),
@@ -208,13 +240,6 @@
'minimize',
'collapse'
]
- },
- {
- key: 'mobileNavigationTapToHide',
- label: m.navigation_tap_to_hide_label(),
- type: 'boolean',
- description: m.navigation_tap_to_hide_description(),
- keywords: ['tap', 'touch', 'hide', 'show', 'toggle', 'gesture', 'click', 'outside', 'dismiss', 'interact', 'control']
}
]
},
diff --git a/frontend/src/routes/settings/navigation/+page.svelte b/frontend/src/routes/settings/navigation/+page.svelte
index 2070cea1f..be771f925 100644
--- a/frontend/src/routes/settings/navigation/+page.svelte
+++ b/frontend/src/routes/settings/navigation/+page.svelte
@@ -31,23 +31,28 @@
mobileNavigationMode: z.enum(['floating', 'docked']),
mobileNavigationShowLabels: z.boolean(),
mobileNavigationScrollToHide: z.boolean(),
- mobileNavigationTapToHide: z.boolean()
+ sidebarHoverExpansion: z.boolean()
});
// Track local override state using the shared store
let persistedState = $state(navigationSettingsOverridesStore.current);
- const sidebar = useSidebar();
- let sidebarHoverExpansion = $state(sidebar.hoverExpansionEnabled);
+ // Sidebar context is only available in desktop view
+ let sidebar: ReturnType<typeof useSidebar> | null = null;
- let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
+ try {
+ sidebar = useSidebar();
+ } catch (e) {
+ // Sidebar context not available (mobile view)
+ }
+ let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
const formHasChanges = $derived.by(
() =>
$formInputs.mobileNavigationMode.value !== currentSettings.mobileNavigationMode ||
$formInputs.mobileNavigationShowLabels.value !== currentSettings.mobileNavigationShowLabels ||
$formInputs.mobileNavigationScrollToHide.value !== currentSettings.mobileNavigationScrollToHide ||
- $formInputs.mobileNavigationTapToHide.value !== currentSettings.mobileNavigationTapToHide
+ $formInputs.sidebarHoverExpansion.value !== currentSettings.sidebarHoverExpansion
);
$effect(() => {
@@ -58,7 +63,7 @@
}
});
- function setLocalOverride(key: 'mode' | 'showLabels' | 'scrollToHide' | 'tapToHide', value: any) {
+ function setLocalOverride(key: 'mode' | 'showLabels' | 'scrollToHide', value: any) {
const currentOverrides = navigationSettingsOverridesStore.current;
navigationSettingsOverridesStore.current = {
...currentOverrides,
@@ -67,12 +72,12 @@
persistedState = navigationSettingsOverridesStore.current;
// Reset navigation bar visibility when behavior settings change
- if (key === 'scrollToHide' || key === 'tapToHide') {
+ if (key === 'scrollToHide') {
resetNavigationVisibility();
}
}
- function clearLocalOverride(key: 'mode' | 'showLabels' | 'scrollToHide' | 'tapToHide') {
+ function clearLocalOverride(key: 'mode' | 'showLabels' | 'scrollToHide') {
const currentOverrides = navigationSettingsOverridesStore.current;
const newOverrides = { ...currentOverrides };
delete newOverrides[key];
@@ -80,7 +85,7 @@
persistedState = navigationSettingsOverridesStore.current;
// Reset navigation bar visibility when behavior settings change
- if (key === 'scrollToHide' || key === 'tapToHide') {
+ if (key === 'scrollToHide') {
resetNavigationVisibility();
}
@@ -109,8 +114,7 @@
// Check if behavior settings changed
const behaviorChanged =
- formData.mobileNavigationScrollToHide !== currentSettings.mobileNavigationScrollToHide ||
- formData.mobileNavigationTapToHide !== currentSettings.mobileNavigationTapToHide;
+ formData.mobileNavigationScrollToHide !== currentSettings.mobileNavigationScrollToHide;
await updateSettingsConfig(formData)
.then(() => {
@@ -132,7 +136,6 @@
$formInputs.mobileNavigationMode.value = currentSettings.mobileNavigationMode;
$formInputs.mobileNavigationShowLabels.value = currentSettings.mobileNavigationShowLabels;
$formInputs.mobileNavigationScrollToHide.value = currentSettings.mobileNavigationScrollToHide;
- $formInputs.mobileNavigationTapToHide.value = currentSettings.mobileNavigationTapToHide;
}
onMount(() => {
@@ -176,14 +179,18 @@
<div class="flex items-center gap-2">
<Switch
id="sidebarHoverExpansion"
- checked={sidebarHoverExpansion}
+ checked={$formInputs.sidebarHoverExpansion.value}
+ disabled={isReadOnly}
onCheckedChange={(checked) => {
- sidebarHoverExpansion = checked;
- sidebar.setHoverExpansion(checked);
+ $formInputs.sidebarHoverExpansion.value = checked;
+ // Update the sidebar immediately if context is available
+ if (sidebar) {
+ sidebar.setHoverExpansion(checked);
+ }
}}
/>
<label for="sidebarHoverExpansion" class="text-xs font-medium">
- {sidebarHoverExpansion
+ {$formInputs.sidebarHoverExpansion.value
? m.navigation_sidebar_hover_expansion_enabled()
: m.navigation_sidebar_hover_expansion_disabled()}
</label>
@@ -259,20 +266,6 @@
serverDisabled={isReadOnly}
/>
- <NavigationSettingControl
- id="mobileNavigationTapToHide"
- label={m.navigation_tap_to_hide_label()}
- description={m.navigation_tap_to_hide_description()}
- icon={MousePointerClickIcon}
- serverValue={$formInputs.mobileNavigationTapToHide.value}
- localOverride={persistedState.tapToHide}
- onServerChange={(value) => {
- $formInputs.mobileNavigationTapToHide.value = value;
- }}
- onLocalOverride={(value) => setLocalOverride('tapToHide', value)}
- onClearOverride={() => clearLocalOverride('tapToHide')}
- serverDisabled={isReadOnly}
- />
</div>
</Card.Content>
</Card.Root>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6c53bccc8..7598ee728 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -185,6 +185,9 @@ importers:
typescript-eslint:
specifier: ^8.46.1
+ vaul-svelte:
+ specifier: 1.0.0-next.7
+ version: 1.0.0-next.7([email protected])
vite:
specifier: ^7.1.10
@@ -2467,6 +2470,12 @@ packages:
resolution: {integrity: sha512-BgWVbCI72aIQy937xbawcs+hrVaN/CZ2UwutgaJ36hGqRrLNM+f5LUT/YPRbo8IV/ASeFzXszezV+y2+rq3l8A==}
engines: {node: '>= 0.10'}
+ resolution: {integrity: sha512-7zN7Bi3dFQixvvbUJY9uGDe7Ws/dGZeBQR2pXdXmzQiakjrxBvWo0QrmsX3HK+VH+SZOltz378cmgmCS9f9rSg==}
+ engines: {node: '>=18', pnpm: '>=8.7.0'}
+ peerDependencies:
+ svelte: ^5.0.0
+
resolution: {integrity: sha512-CmuvUBzVJ/e3HGxhg6cYk88NGgTnBoOo7ogtfJJ0fefUWAxN/WDSUa50o+oVBxuIhO8FoEZW0j2eW7sfjs5EtA==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -4758,6 +4767,12 @@ snapshots:
optional: true
+ dependencies:
+ runed: 0.23.4([email protected])
+ svelte: 5.40.2
+ svelte-toolbelt: 0.7.1([email protected])
+
dependencies:
esbuild: 0.25.11