Cleanup some enums to consts

This commit is contained in:
the-djmaze 2023-04-03 10:29:26 +02:00
parent 91e60c1007
commit da2ab68fcc
13 changed files with 103 additions and 126 deletions

View file

@ -1,4 +1,4 @@
import { Scope } from 'Common/Enums';
import { ScopeMessageList, ScopeMessageView } from 'Common/Enums';
import { elementById } from 'Common/Globals';
import { exitFullscreen } from 'Common/Fullscreen';
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
@ -25,9 +25,9 @@ export const MessageUserStore = new class {
clearTimeout(this.MessageSeenTimer);
elementById('rl-right').classList.toggle('message-selected', !!message);
if (message) {
SettingsUserStore.usePreviewPane() || AppUserStore.focusedState(Scope.MessageView);
SettingsUserStore.usePreviewPane() || AppUserStore.focusedState(ScopeMessageView);
} else {
AppUserStore.focusedState(Scope.MessageList);
AppUserStore.focusedState(ScopeMessageList);
exitFullscreen();
}
[...(this.bodiesDom()?.children || [])].forEach(el => el.hidden = true);

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { koComputable, addObservablesTo } from 'External/ko';
import { Layout } from 'Common/EnumsUser';
import { LayoutSideView, LayoutBottomView } from 'Common/EnumsUser';
import { pInt } from 'Common/Utils';
import { $htmlCL, SettingsGet, fireEvent } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
@ -54,8 +54,8 @@ export const SettingsUserStore = new class {
const toggleLayout = () => {
const value = self.usePreviewPane();
$htmlCL.toggle('sm-msgView-side', Layout.SidePreview === value);
$htmlCL.toggle('sm-msgView-bottom', Layout.BottomPreview === value);
$htmlCL.toggle('sm-msgView-side', LayoutSideView === value);
$htmlCL.toggle('sm-msgView-bottom', LayoutBottomView === value);
fireEvent('rl-layout', value);
};
self.layout.subscribe(toggleLayout);