Skip to content

Commit

Permalink
Fixed navigators and aSide behavior when the document size is small. (#…
Browse files Browse the repository at this point in the history
…7613)

Signed-off-by: Alexander Platov <[email protected]>
  • Loading branch information
SasLord authored Jan 9, 2025
1 parent c9f5f46 commit 79f2ad8
Show file tree
Hide file tree
Showing 19 changed files with 210 additions and 256 deletions.
2 changes: 2 additions & 0 deletions packages/theme/styles/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
46 changes: 22 additions & 24 deletions packages/theme/styles/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/components/PanelInstance.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/components/Scroller.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
32 changes: 1 addition & 31 deletions packages/ui/src/components/internal/Root.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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) ||
Expand Down Expand Up @@ -200,20 +195,6 @@
{/if}
</div>
<div class="flex-row-reverse" style:-webkit-app-region={'no-drag'}>
{#if asideFloat && !secondRow}
<div class="antiHSpacer x2" />
<ButtonIcon
icon={asideOpen ? IconDetailsFilled : IconDetails}
iconProps={{ fill: 'var(--theme-dark-color)' }}
kind={'tertiary'}
size={'extra-small'}
hasMenu
pressed={$deviceInfo.aside.visible}
on:click={() => {
$deviceInfo.aside.visible = !$deviceInfo.aside.visible
}}
/>
{/if}
<div class="clock">
<Clock />
</div>
Expand All @@ -234,17 +215,6 @@
</div>
<div class="flex-row-center flex-gap-0-5">
<RootBarExtension position="right" />
<ButtonIcon
icon={asideOpen ? IconDetailsFilled : IconDetails}
iconProps={{ fill: 'var(--theme-dark-color)' }}
kind={'tertiary'}
size={'extra-small'}
hasMenu
pressed={$deviceInfo.aside.visible}
on:click={() => {
$deviceInfo.aside.visible = !$deviceInfo.aside.visible
}}
/>
</div>
</div>
{/if}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
]

Expand Down
4 changes: 3 additions & 1 deletion plugins/chunter-resources/src/components/chat/Chat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@
<div class="antiPanel-wrap__content hulyNavPanel-container">
<ChatNavigator {object} {currentSpecial} on:select={handleChannelSelected} />
</div>
<Separator name="chat" float={$deviceInfo.navigator.float ? 'navigator' : true} index={0} />
{#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)}
<Separator name="chat" float={$deviceInfo.navigator.float ? 'navigator' : true} index={0} />
{/if}
</div>
<Separator
name="chat"
Expand Down
7 changes: 3 additions & 4 deletions plugins/hr-resources/src/components/Schedule.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
Breadcrumb,
Switcher,
defineSeparators,
workbenchSeparators,
twoPanelsSeparators,
deviceOptionsStore as deviceInfo,
tableToCSV,
showPopup
Expand Down Expand Up @@ -180,7 +180,7 @@
$: $deviceInfo.replacedPanel = replacedPanel
onDestroy(() => ($deviceInfo.replacedPanel = undefined))
defineSeparators('workbench', workbenchSeparators)
defineSeparators('schedule', twoPanelsSeparators)
</script>

<div class="hulyPanels-container">
Expand All @@ -194,9 +194,8 @@
}}
/>
<Separator
name={'workbench'}
name={'schedule'}
float={$deviceInfo.navigator.float}
disabledWhen={['panel-aside']}
index={0}
color={'transparent'}
separatorSize={0}
Expand Down
23 changes: 13 additions & 10 deletions plugins/hr-resources/src/components/sidebar/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script lang="ts">
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'
Expand All @@ -26,13 +26,14 @@
export let department: Ref<Department>
export let descendants: Map<Ref<Department>, Department[]>
export let departmentById: Map<Ref<Department>, Department>
export let navFloat: boolean = false
export let appsDirection: 'horizontal' | 'vertical' = 'horizontal'
const departments = [hr.ids.Head]
</script>

<div class="antiPanel-navigator {appsDirection === 'horizontal' ? 'portrait' : 'landscape'} border-left">
<div
class="antiPanel-navigator {$deviceInfo.navigator.direction === 'horizontal' ? 'portrait' : 'landscape'} border-left"
class:fly={$deviceInfo.navigator.float}
>
<div class="antiPanel-wrap__content hulyNavPanel-container">
<NavHeader label={hr.string.HRApplication} />

Expand All @@ -50,10 +51,12 @@

<NavFooter />
</div>
<Separator
name={'workbench'}
float={navFloat ? 'navigator' : true}
index={0}
color={'var(--theme-navpanel-border)'}
/>
{#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)}
<Separator
name={'schedule'}
float={$deviceInfo.navigator.float ? 'navigator' : true}
index={0}
color={'var(--theme-navpanel-border)'}
/>
{/if}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,9 @@
/>
</Scroller>
</div>
<Separator name="inbox" float={$deviceInfo.navigator.float ? 'navigator' : true} index={0} />
{#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)}
<Separator name="inbox" float={$deviceInfo.navigator.float ? 'navigator' : true} index={0} />
{/if}
</div>
<Separator
name="inbox"
Expand Down
1 change: 1 addition & 0 deletions plugins/time-resources/src/components/PlanView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<div
class="flex-col w-full clear-mins mobile-wrapper"
class:left-divider={!$deviceInfo.navigator.visible}
class:right-divider={!visibleCalendar}
bind:this={mainPanel}
>
<ToDos {mode} {tag} bind:currentDate />
Expand Down
16 changes: 9 additions & 7 deletions plugins/time-resources/src/components/ToDosNavigator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,15 @@
</Scroller>
<NavFooter />
</div>
<Separator
name={'time'}
float={$deviceInfo.navigator.float ? 'navigator' : true}
index={0}
disabledWhen={['panel-aside']}
color={'var(--theme-divider-color)'}
/>
{#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)}
<Separator
name={'time'}
float={$deviceInfo.navigator.float ? 'navigator' : true}
index={0}
disabledWhen={['panel-aside']}
color={'var(--theme-divider-color)'}
/>
{/if}
</div>

<style lang="scss">
Expand Down
1 change: 0 additions & 1 deletion plugins/time-resources/src/components/team/Team.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
name={'team'}
float={$deviceInfo.navigator.float}
index={0}
disabledWhen={['panel-aside']}
color={'transparent'}
separatorSize={0}
short
Expand Down
15 changes: 8 additions & 7 deletions plugins/time-resources/src/components/team/TeamNavigator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@
</Scroller>
<NavFooter />
</div>
<Separator
name={'time'}
float={$deviceInfo.navigator.float ? 'navigator' : true}
index={1}
disabledWhen={['panel-aside']}
color={'var(--theme-divider-color)'}
/>
{#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)}
<Separator
name={'time'}
float={$deviceInfo.navigator.float ? 'navigator' : true}
index={0}
color={'var(--theme-divider-color)'}
/>
{/if}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@
on:select={onSelected}
/>
</div>
<Separator
name={'parentsNavigator'}
float={floatNavigator ? 'navigator' : true}
index={0}
color={'var(--theme-divider-color)'}
/>
{#if !($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.minWidth)}
<Separator
name={'parentsNavigator'}
float={floatNavigator ? 'navigator' : true}
index={0}
color={'var(--theme-divider-color)'}
/>
{/if}
</div>
<Separator name={'parentsNavigator'} float={floatNavigator} index={0} color={'var(--theme-divider-color)'} />
{/if}
Expand Down
Loading

0 comments on commit 79f2ad8

Please sign in to comment.