Changes for idea in #1150 (isSmall not active yet)

This commit is contained in:
the-djmaze 2023-08-28 10:11:34 +02:00
parent 53f8abc311
commit eb566ca9db
12 changed files with 35 additions and 21 deletions

View file

@ -1,7 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { addObservablesTo, addComputablesTo, addSubscribablesTo } from 'External/ko'; import { addObservablesTo, addComputablesTo, addSubscribablesTo } from 'External/ko';
import { keyScope, addShortcut, SettingsGet, leftPanelDisabled, toggleLeftPanel, elementById } from 'Common/Globals'; import { keyScope, addShortcut, SettingsGet, toggleLeftPanel, elementById } from 'Common/Globals';
import { ViewTypePopup, showScreenPopup } from 'Knoin/Knoin'; import { ViewTypePopup, showScreenPopup } from 'Knoin/Knoin';
import { SaveSettingStatus } from 'Common/Enums'; import { SaveSettingStatus } from 'Common/Enums';
@ -95,7 +95,6 @@ export class AbstractViewLeft extends AbstractView
constructor(templateID) constructor(templateID)
{ {
super(templateID, 'left'); super(templateID, 'left');
this.leftPanelDisabled = leftPanelDisabled;
this.toggleLeftPanel = toggleLeftPanel; this.toggleLeftPanel = toggleLeftPanel;
} }
} }

View file

@ -10,6 +10,8 @@ let __themeTimer = 0;
export const export const
// Also see Styles/_Values.less @maxMobileWidth // Also see Styles/_Values.less @maxMobileWidth
isMobile = matchMedia('(max-width: 799px)'), isMobile = matchMedia('(max-width: 799px)'),
// https://github.com/the-djmaze/snappymail/issues/1150
// isSmall = matchMedia('(max-width: 1400px)'),
ThemeStore = { ThemeStore = {
theme: ko.observable(''), theme: ko.observable(''),
@ -104,6 +106,9 @@ addSubscribablesTo(ThemeStore, {
isMobile.onchange = e => { isMobile.onchange = e => {
ThemeStore.isMobile(e.matches); ThemeStore.isMobile(e.matches);
$htmlCL.toggle('rl-mobile', e.matches); $htmlCL.toggle('rl-mobile', e.matches);
leftPanelDisabled(e.matches); /*$htmlCL.contains('sm-msgView-side') || */leftPanelDisabled(e.matches);
}; };
isMobile.onchange(isMobile); isMobile.onchange(isMobile);
//isSmall.onchange = e => $htmlCL.contains('sm-msgView-side') && leftPanelDisabled(e.matches);
//isSmall.onchange(isSmall);

View file

@ -4,6 +4,13 @@ html.list-loading body {
cursor: progress; cursor: progress;
} }
.toggleLeft::before {
content: '';
}
html.rl-left-panel-disabled .toggleLeft::before {
content: '';
}
@media screen and (min-width: @maxMobileWidth + 1px) { @media screen and (min-width: @maxMobileWidth + 1px) {
#rl-app { #rl-app {
background-image: var(--main-bg-image); background-image: var(--main-bg-image);

View file

@ -15,6 +15,7 @@
.b-toolbar { .b-toolbar {
padding: 10px 0 10px @rlLowMargin; padding: 10px 0 10px @rlLowMargin;
white-space: nowrap;
} }
} }
@ -189,7 +190,7 @@ html.rl-left-panel-disabled {
/* desktop */ /* desktop */
@media screen and (min-width: @maxMobileWidth + 1px) { @media screen and (min-width: @maxMobileWidth + 1px) {
.toggleLeft, #rl-right .toggleLeft,
#V-MailMessageList .buttonCompose { #V-MailMessageList .buttonCompose {
display: none !important; display: none !important;
} }

View file

@ -2,12 +2,11 @@ import Remote from 'Remote/Admin/Fetch';
import { AbstractViewRight } from 'Knoin/AbstractViews'; import { AbstractViewRight } from 'Knoin/AbstractViews';
import { leftPanelDisabled, toggleLeftPanel } from 'Common/Globals'; import { toggleLeftPanel } from 'Common/Globals';
export class PaneSettingsAdminView extends AbstractViewRight { export class PaneSettingsAdminView extends AbstractViewRight {
constructor() { constructor() {
super('AdminPane'); super('AdminPane');
this.leftPanelDisabled = leftPanelDisabled;
this.toggleLeftPanel = toggleLeftPanel; this.toggleLeftPanel = toggleLeftPanel;
} }

View file

@ -88,8 +88,6 @@ export class MailMessageList extends AbstractViewRight {
this.composeInEdit = ComposePopupView.inEdit; this.composeInEdit = ComposePopupView.inEdit;
this.isMobile = ThemeStore.isMobile; // Obsolete this.isMobile = ThemeStore.isMobile; // Obsolete
this.leftPanelDisabled = leftPanelDisabled;
this.toggleLeftPanel = toggleLeftPanel;
this.popupVisibility = arePopupsVisible; this.popupVisibility = arePopupsVisible;
@ -582,7 +580,11 @@ export class MailMessageList extends AbstractViewRight {
addEventsListeners(dom, { addEventsListeners(dom, {
click: event => { click: event => {
ThemeStore.isMobile() && !eqs(event, '.toggleLeft') && leftPanelDisabled(true); if (eqs(event, '.toggleLeft')) {
toggleLeftPanel();
} else {
ThemeStore.isMobile() && leftPanelDisabled(true);
}
if (eqs(event, '.messageList') && ScopeMessageView === AppUserStore.focusedState()) { if (eqs(event, '.messageList') && ScopeMessageView === AppUserStore.focusedState()) {
AppUserStore.focusedState(ScopeMessageList); AppUserStore.focusedState(ScopeMessageList);

View file

@ -8,9 +8,6 @@ import { AbstractViewRight } from 'Knoin/AbstractViews';
export class SettingsPaneUserView extends AbstractViewRight { export class SettingsPaneUserView extends AbstractViewRight {
constructor() { constructor() {
super(); super();
this.leftPanelDisabled = leftPanelDisabled;
this.toggleLeftPanel = toggleLeftPanel;
} }
onShow() { onShow() {
@ -18,8 +15,12 @@ export class SettingsPaneUserView extends AbstractViewRight {
} }
onBuild(dom) { onBuild(dom) {
dom.addEventListener('click', () => dom.addEventListener('click', () => {
ThemeStore.isMobile() && !event.target.closestWithin('.toggleLeft', dom) && leftPanelDisabled(true) if (event.target.closestWithin('.toggleLeft', dom)) {
); toggleLeftPanel();
} else {
ThemeStore.isMobile() && leftPanelDisabled(true);
}
});
} }
} }

View file

@ -1,5 +1,5 @@
<div class="b-toolbar g-ui-user-select-none"> <div class="b-toolbar g-ui-user-select-none">
<a class="btn btn-thin fontastic toggleLeft" data-bind="click: toggleLeftPanel, text: leftPanelDisabled() ? '' : ''"></a> <a class="btn btn-thin fontastic toggleLeft" data-bind="click: toggleLeftPanel"></a>
<h4>SnappyMail - <span data-i18n="TOP_PANEL/LABEL_ADMIN_PANEL"></span></h4> <h4>SnappyMail - <span data-i18n="TOP_PANEL/LABEL_ADMIN_PANEL"></span></h4>
<a class="btn btn-logout fontastic" data-bind="click: logoutClick"></a> <a class="btn btn-logout fontastic" data-bind="click: logoutClick"></a>
</div> </div>

View file

@ -29,7 +29,7 @@
</div> </div>
<div class="b-footer btn-toolbar"> <div class="b-footer btn-toolbar">
<div class="btn-group"> <div class="btn-group">
<a class="btn fontastic" data-bind="click: toggleLeftPanel, text: leftPanelDisabled() ? '' : ''"></a> <a class="btn fontastic toggleLeft" data-bind="click: toggleLeftPanel"></a>
</div> </div>
<div class="btn-group hide-on-panel-disabled"> <div class="btn-group hide-on-panel-disabled">
<a class="btn icon-folder-add" data-bind="click: createFolder" data-i18n="[title]POPUPS_CREATE_FOLDER/TITLE_CREATE_FOLDER"></a> <a class="btn icon-folder-add" data-bind="click: createFolder" data-i18n="[title]POPUPS_CREATE_FOLDER/TITLE_CREATE_FOLDER"></a>

View file

@ -1,5 +1,5 @@
<div class="btn-toolbar" data-bind="css: {'hasChecked':checkAll}"> <div class="btn-toolbar" data-bind="css: {'hasChecked':checkAll}">
<a class="btn btn-thin fontastic toggleLeft" data-bind="click: toggleLeftPanel, text: leftPanelDisabled() ? '' : ''"></a> <a class="btn btn-thin fontastic toggleLeft"></a>
<a class="btn buttonCompose onCheckedHide" data-bind="click: composeClick, css: {'btn-warning': composeInEdit, 'btn-success': !composeInEdit()}" data-i18n="[title]FOLDER_LIST/BUTTON_NEW_MESSAGE"> <a class="btn buttonCompose onCheckedHide" data-bind="click: composeClick, css: {'btn-warning': composeInEdit, 'btn-success': !composeInEdit()}" data-i18n="[title]FOLDER_LIST/BUTTON_NEW_MESSAGE">
<i class="icon-paper-plane"></i> <i class="icon-paper-plane"></i>
</a> </a>

View file

@ -1,5 +1,5 @@
<div class="b-toolbar btn-toolbar"> <div class="b-toolbar btn-toolbar">
<a class="btn btn-thin fontastic toggleLeft" data-bind="click: toggleLeftPanel, text: leftPanelDisabled() ? '' : ''"></a> <a class="btn btn-thin fontastic toggleLeft" data-bind="click: toggleLeftPanel"></a>
<a class="btn" data-bind="click: backToInbox" data-icon="⬅" data-i18n="GLOBAL/BACK"></a> <a class="btn" data-bind="click: backToInbox" data-icon="⬅" data-i18n="GLOBAL/BACK"></a>
</div> </div>
<nav data-bind="foreach: menu"> <nav data-bind="foreach: menu">

View file

@ -1,3 +1,3 @@
<div class="btn-toolbar" data-bind="visible: leftPanelDisabled"> <div class="btn-toolbar">
<a class="btn btn-thin fontastic toggleLeft" data-bind="click: toggleLeftPanel"></a> <a class="btn btn-thin fontastic toggleLeft"></a>
</div> </div>