Revamp Mobile/Desktop switcher without completely reloading.

Remove switcher from login page, it became useless.
This commit is contained in:
djmaze 2021-02-16 20:12:23 +01:00
parent 292f3289ac
commit d7994ddab6
35 changed files with 159 additions and 202 deletions

View file

@ -1,8 +1,8 @@
import ko from 'ko';
import { KeyState } from 'Common/Enums';
import { Focused } from 'Common/EnumsUser';
import { keyScope, leftPanelDisabled, Settings, isMobile } from 'Common/Globals';
import { keyScope, leftPanelDisabled, Settings } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
class AppUserStore {
constructor() {
@ -26,15 +26,15 @@ class AppUserStore {
switch (value) {
case Focused.MessageList:
keyScope(KeyState.MessageList);
isMobile() && leftPanelDisabled(true);
ThemeStore.isMobile() && leftPanelDisabled(true);
break;
case Focused.MessageView:
keyScope(KeyState.MessageView);
isMobile() && leftPanelDisabled(true);
ThemeStore.isMobile() && leftPanelDisabled(true);
break;
case Focused.FolderList:
keyScope(KeyState.FolderList);
isMobile() && leftPanelDisabled(false);
ThemeStore.isMobile() && leftPanelDisabled(false);
break;
default:
break;

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { Focused, MessageSetAction } from 'Common/EnumsUser';
import { doc } from 'Common/Globals';
import { doc, elementById } from 'Common/Globals';
import { pInt, pString } from 'Common/Utils';
import { plainToHtml } from 'Common/UtilsUser';
@ -493,7 +493,7 @@ class MessageUserStore {
if (messagesDom) {
id = 'rl-mgs-' + message.hash.replace(/[^a-zA-Z0-9]/g, '');
const textBody = doc.getElementById(id);
const textBody = elementById(id);
if (textBody) {
message.body = textBody;
message.fetchDataFromDom();

View file

@ -3,7 +3,8 @@ import ko from 'ko';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { Layout, EditorDefaultType } from 'Common/EnumsUser';
import { pInt } from 'Common/Utils';
import { doc, isMobile } from 'Common/Globals';
import { $htmlCL } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
class SettingsUserStore {
constructor() {
@ -34,17 +35,16 @@ class SettingsUserStore {
autoLogout: 30
});
this.usePreviewPane = ko.computed(() => Layout.NoPreview !== this.layout() && !isMobile());
this.usePreviewPane = ko.computed(() => Layout.NoPreview !== this.layout() && !ThemeStore.isMobile());
this.subscribers();
}
subscribers() {
const htmlCL = doc.documentElement.classList;
this.layout.subscribe(value => {
htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
$htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
$htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
$htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
dispatchEvent(new CustomEvent('rl-layout', {detail:value}));
});
}
@ -58,7 +58,7 @@ class SettingsUserStore {
this.messagesPerPage(settingsGet('MPP'));
this.showImages(!!settingsGet('ShowImages'));
this.useCheckboxesInList(!!(isMobile() || settingsGet('UseCheckboxesInList')));
this.useCheckboxesInList(!!(ThemeStore.isMobile() || settingsGet('UseCheckboxesInList')));
this.allowDraftAutosave(!!settingsGet('AllowDraftAutosave'));
this.useThreads(!!settingsGet('UseThreads'));
this.replySameFolder(!!settingsGet('ReplySameFolder'));