From 79f2ad8e2dcb47323d56e32145fb4b71befbe197 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Thu, 9 Jan 2025 11:24:11 +0300 Subject: [PATCH] Fixed navigators and aSide behavior when the document size is small. (#7613) Signed-off-by: Alexander Platov --- packages/theme/styles/_colors.scss | 2 + packages/theme/styles/common.scss | 46 ++-- .../ui/src/components/PanelInstance.svelte | 6 +- packages/ui/src/components/Scroller.svelte | 1 - .../ui/src/components/internal/Root.svelte | 32 +-- packages/ui/src/resize.ts | 2 +- .../src/components/chat/Chat.svelte | 4 +- .../src/components/Schedule.svelte | 7 +- .../src/components/sidebar/Sidebar.svelte | 23 +- .../src/components/inbox/Inbox.svelte | 4 +- .../src/components/PlanView.svelte | 1 + .../src/components/ToDosNavigator.svelte | 16 +- .../src/components/team/Team.svelte | 1 - .../src/components/team/TeamNavigator.svelte | 15 +- .../src/components/ComponentNavigator.svelte | 14 +- .../src/components/Workbench.svelte | 231 +++++++++--------- .../src/components/sidebar/Sidebar.svelte | 36 +-- .../components/sidebar/SidebarExpanded.svelte | 21 +- .../sidebar/widgets/WidgetsBar.svelte | 4 +- 19 files changed, 210 insertions(+), 256 deletions(-) diff --git a/packages/theme/styles/_colors.scss b/packages/theme/styles/_colors.scss index 5003092d101..bd095464bd3 100644 --- a/packages/theme/styles/_colors.scss +++ b/packages/theme/styles/_colors.scss @@ -137,6 +137,7 @@ --theme-navpanel-border: rgba(255, 255, 255, .1); --theme-navpanel-icons-color: #7F7F7F; --theme-navpanel-icons-divider: rgba(255, 255, 255, .11); + --theme-navpanel-shadow-mobile: drop-shadow(0 0 3px rgba(0, 0, 0, .5)); --theme-comp-header-color: #1F1F2C; --theme-divider-color: rgba(255, 255, 255, .06); --theme-bg-divider-color: #282834; @@ -395,6 +396,7 @@ --theme-navpanel-border: rgba(0, 0, 0, .06); --theme-navpanel-icons-color: #7F7F7F; --theme-navpanel-icons-divider: rgba(0, 0, 0, .1); + --theme-navpanel-shadow-mobile: drop-shadow(0 0 2px rgba(0, 0, 0, .2)); --theme-comp-header-color: #FBFBFC; --theme-divider-color: rgba(0, 0, 0, .06); --theme-bg-divider-color: #E3E3E5; diff --git a/packages/theme/styles/common.scss b/packages/theme/styles/common.scss index edaa02262a2..25fb7f5606f 100644 --- a/packages/theme/styles/common.scss +++ b/packages/theme/styles/common.scss @@ -141,14 +141,11 @@ } .antiPanel-navigator { position: relative; + min-width: 12.5rem; + max-width: 22.5rem; + width: 17.5rem; &:not(.second) { background-color: var(--theme-navpanel-color); } - &:not(.right) { - min-width: 12.5rem; - max-width: 22.5rem; - width: 17.5rem; - } - &.right { border-radius: var(--medium-BorderRadius); } &.second.float { background-color: var(--theme-navpanel-color); filter: drop-shadow(2px 0 5px rgba(0, 0, 0, .2)); @@ -174,40 +171,41 @@ &.fly:not(.second) { position: fixed; + top: calc(var(--status-bar-height) + 1px); + height: calc(100% - var(--status-bar-height) - 2px); background-color: var(--theme-navpanel-color); z-index: 450; - - &:not(.right) { - top: calc(var(--status-bar-height) + 1px); - height: calc(100% - var(--status-bar-height) - 2px); - filter: drop-shadow(2px 0 5px rgba(0, 0, 0, .2)); + filter: drop-shadow(2px 0 5px rgba(0, 0, 0, .2)); - &.portrait { left: 0; } - &.landscape { left: var(--app-panel-width); } - } - &.right { - top: var(--status-bar-height); - right: 0; - height: calc(100% - var(--status-bar-height)); - background-color: var(--theme-statusbar-color); - filter: drop-shadow(-2px 0 5px rgba(0, 0, 0, .2)); - } + &.portrait { left: 0; } + &.landscape { left: var(--app-panel-width); } } } @media (max-width: 480px) { .mobile-theme { .mobile-wrapper, - .antiPanel-navigator:not(.right) { + .antiPanel-navigator { overflow: hidden; border: 1px solid var(--theme-divider-color); border-radius: var(--medium-BorderRadius); } - .antiPanel-navigator:not(.right) { + .antiPanel-navigator { top: var(--status-bar-height); - height: calc(100% - var(--status-bar-height)); + height: calc(100% - var(--status-bar-height) - var(--app-panel-width)); .antiSeparator { display: none; } + &.fly { + width: calc(100% - 3.5rem) !important; + filter: var(--theme-navpanel-shadow-mobile); + } + &.second.float.fly { + height: calc(100% - var(--status-bar-height) - var(--app-panel-width) - 3.5rem); + } + &.fly:not(.second) { + top: var(--status-bar-height); + height: calc(100% - var(--status-bar-height) - var(--app-panel-width)); + } } } } diff --git a/packages/ui/src/components/PanelInstance.svelte b/packages/ui/src/components/PanelInstance.svelte index 1c71305e4f2..329e01ea0c5 100644 --- a/packages/ui/src/components/PanelInstance.svelte +++ b/packages/ui/src/components/PanelInstance.svelte @@ -93,9 +93,9 @@ top: 'var(--status-bar-height)', bottom: '4.25rem', left: '0', - right: '0', - width: '100%', - height: 'calc(100dvh - var(--status-bar-height) - 4.25rem)', + right: '3.5rem', + width: '', + height: 'calc(100dvh - var(--status-bar-height) - var(--app-panel-width))', maxWidth: '100%', maxHeight: '100%', minWidth: '0' diff --git a/packages/ui/src/components/Scroller.svelte b/packages/ui/src/components/Scroller.svelte index 571d452def5..e8b03b2506d 100644 --- a/packages/ui/src/components/Scroller.svelte +++ b/packages/ui/src/components/Scroller.svelte @@ -921,7 +921,6 @@ border-radius: 0.125rem; box-shadow: 0 0 1px 1px var(--theme-overlay-color); opacity: 0; - z-index: 1; cursor: pointer; &.hovered { diff --git a/packages/ui/src/components/internal/Root.svelte b/packages/ui/src/components/internal/Root.svelte index b5c7c9f6ca7..c27aaf5647b 100644 --- a/packages/ui/src/components/internal/Root.svelte +++ b/packages/ui/src/components/internal/Root.svelte @@ -10,10 +10,7 @@ IconArrowRight, checkMobile, deviceOptionsStore as deviceInfo, - checkAdaptiveMatching, - ButtonIcon, - IconDetailsFilled, - IconDetails + checkAdaptiveMatching } from '../../' import { desktopPlatform, getCurrentLocation, location, locationStorageKeyId, navigate } from '../../location' import uiPlugin from '../../plugin' @@ -140,8 +137,6 @@ updateDeviceSize() $: secondRow = checkAdaptiveMatching($deviceInfo.size, 'xs') - $: asideFloat = checkAdaptiveMatching($deviceInfo.size, 'sm') - $: asideOpen = $deviceInfo.aside.visible $: appsMini = $deviceInfo.isMobile && (($deviceInfo.isPortrait && $deviceInfo.docWidth <= 480) || @@ -200,20 +195,6 @@ {/if}
- {#if asideFloat && !secondRow} -
- { - $deviceInfo.aside.visible = !$deviceInfo.aside.visible - }} - /> - {/if}
@@ -234,17 +215,6 @@
- { - $deviceInfo.aside.visible = !$deviceInfo.aside.visible - }} - />
{/if} diff --git a/packages/ui/src/resize.ts b/packages/ui/src/resize.ts index 9bb04e3d757..7eb09bb1cb8 100644 --- a/packages/ui/src/resize.ts +++ b/packages/ui/src/resize.ts @@ -170,7 +170,7 @@ export const twoPanelsSeparators: DefSeparators = [ ] export const mainSeparators: DefSeparators = [ - { minSize: 30, size: 'auto', maxSize: 'auto' }, + { minSize: 20, size: 'auto', maxSize: 'auto' }, { minSize: 25, size: 30, maxSize: 80, float: 'sidebar' } ] diff --git a/plugins/chunter-resources/src/components/chat/Chat.svelte b/plugins/chunter-resources/src/components/chat/Chat.svelte index 7e203db2492..428702d2ff3 100644 --- a/plugins/chunter-resources/src/components/chat/Chat.svelte +++ b/plugins/chunter-resources/src/components/chat/Chat.svelte @@ -175,7 +175,9 @@
- + {#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)} + + {/if} ($deviceInfo.replacedPanel = undefined)) - defineSeparators('workbench', workbenchSeparators) + defineSeparators('schedule', twoPanelsSeparators)
@@ -194,9 +194,8 @@ }} /> import { Ref } from '@hcengineering/core' import { Department } from '@hcengineering/hr' - import { Scroller, Separator } from '@hcengineering/ui' + import { Scroller, Separator, deviceOptionsStore as deviceInfo } from '@hcengineering/ui' import { TreeNode } from '@hcengineering/view-resources' import { NavFooter, NavHeader } from '@hcengineering/workbench-resources' @@ -26,13 +26,14 @@ export let department: Ref export let descendants: Map, Department[]> export let departmentById: Map, Department> - export let navFloat: boolean = false - export let appsDirection: 'horizontal' | 'vertical' = 'horizontal' const departments = [hr.ids.Head] -
+
@@ -50,10 +51,12 @@
- + {#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)} + + {/if}
diff --git a/plugins/notification-resources/src/components/inbox/Inbox.svelte b/plugins/notification-resources/src/components/inbox/Inbox.svelte index c2bc98cd256..369da922d51 100644 --- a/plugins/notification-resources/src/components/inbox/Inbox.svelte +++ b/plugins/notification-resources/src/components/inbox/Inbox.svelte @@ -429,7 +429,9 @@ />
- + {#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)} + + {/if}
diff --git a/plugins/time-resources/src/components/ToDosNavigator.svelte b/plugins/time-resources/src/components/ToDosNavigator.svelte index ed0d4e38eca..e4f0b1ec329 100644 --- a/plugins/time-resources/src/components/ToDosNavigator.svelte +++ b/plugins/time-resources/src/components/ToDosNavigator.svelte @@ -205,13 +205,15 @@ - + {#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)} + + {/if} diff --git a/plugins/workbench-resources/src/components/sidebar/SidebarExpanded.svelte b/plugins/workbench-resources/src/components/sidebar/SidebarExpanded.svelte index a549505441d..2b393de8c97 100644 --- a/plugins/workbench-resources/src/components/sidebar/SidebarExpanded.svelte +++ b/plugins/workbench-resources/src/components/sidebar/SidebarExpanded.svelte @@ -23,7 +23,8 @@ Header, Breadcrumbs, getCurrentLocation, - Separator + Separator, + deviceOptionsStore as deviceInfo } from '@hcengineering/ui' import { onDestroy, onMount } from 'svelte' @@ -33,7 +34,6 @@ export let widgets: Widget[] = [] export let preferences: WidgetPreference[] = [] - export let float: boolean = false let widgetId: Ref | undefined = undefined let widget: Widget | undefined = undefined @@ -54,6 +54,7 @@ $: if ($sidebarStore.widget === undefined) { sidebarStore.update((s) => ({ ...s, variant: SidebarVariant.MINI })) } + $: float = $deviceInfo.aside.float function closeWrongTabs (loc: Location): void { if (widget === undefined) return @@ -99,7 +100,7 @@