From 088c37fa203b672ab625d522873b1237a06d2ec9 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Fri, 13 Dec 2024 07:15:32 +0300 Subject: [PATCH] Preventing the opening of an empty floating aside (#7447) Signed-off-by: Alexander Platov --- .../workbench-resources/src/components/Workbench.svelte | 9 +++++++++ plugins/workbench-resources/src/sidebar.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 62e0dcb8ef..c2499d17c6 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -664,6 +664,15 @@ oldNavVisible = $deviceInfo.navigator.visible oldASideVisible = $deviceInfo.aside.visible } + $: if ( + $deviceInfo.aside.float && + $deviceInfo.aside.visible && + $sidebarStore.variant === SidebarVariant.MINI && + $sidebarStore.widgetsState.size > 0 + ) { + $sidebarStore.variant = SidebarVariant.EXPANDED + $sidebarStore.widget = Array.from($sidebarStore.widgetsState.keys())[0] + } $: $deviceInfo.navigator.direction = $deviceInfo.isMobile && $deviceInfo.isPortrait ? 'horizontal' : 'vertical' let appsMini: boolean $: appsMini = diff --git a/plugins/workbench-resources/src/sidebar.ts b/plugins/workbench-resources/src/sidebar.ts index b916b132c9..bfd3ba49b6 100644 --- a/plugins/workbench-resources/src/sidebar.ts +++ b/plugins/workbench-resources/src/sidebar.ts @@ -339,7 +339,7 @@ export function minimizeSidebar (closedByUser = false): void { sidebarStore.set({ ...state, ...widgetsState, widget: undefined, variant: SidebarVariant.MINI }) const devInfo = get(deviceInfo) - if (devInfo.navigator.float && devInfo.aside.visible) { + if (devInfo.aside.float && devInfo.aside.visible) { deviceInfo.set({ ...devInfo, aside: { visible: false, float: true } }) } }