aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/UIStore.ts
diff options
context:
space:
mode:
authorLibravatar niu tech <jerzyglowacki@gmail.com>2021-09-15 10:39:27 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-15 10:39:27 +0200
commite2f440ff2dd5179e2d9bc8dea119fc4fe7c562a1 (patch)
tree2f8a1e012c4c13b2c3e7eb243277bef951b67378 /src/stores/UIStore.ts
parentdocs: fix link in bug_report template [skip ci] (diff)
downloadferdium-app-e2f440ff2dd5179e2d9bc8dea119fc4fe7c562a1.tar.gz
ferdium-app-e2f440ff2dd5179e2d9bc8dea119fc4fe7c562a1.tar.zst
ferdium-app-e2f440ff2dd5179e2d9bc8dea119fc4fe7c562a1.zip
Enable Split View Mode (#1926)
Diffstat (limited to 'src/stores/UIStore.ts')
-rw-r--r--src/stores/UIStore.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/stores/UIStore.ts b/src/stores/UIStore.ts
index ec48eeb40..6ab63c2ee 100644
--- a/src/stores/UIStore.ts
+++ b/src/stores/UIStore.ts
@@ -51,6 +51,13 @@ export default class UIStore extends Store {
51 }, 51 },
52 { fireImmediately: true }, 52 { fireImmediately: true },
53 ); 53 );
54 reaction(
55 () => this.isSplitModeActive,
56 () => {
57 this._setupModeInDOM();
58 },
59 { fireImmediately: true },
60 );
54 } 61 }
55 62
56 @computed get showMessageBadgesEvenWhenMuted() { 63 @computed get showMessageBadgesEvenWhenMuted() {
@@ -77,6 +84,10 @@ export default class UIStore extends Store {
77 ); 84 );
78 } 85 }
79 86
87 @computed get isSplitModeActive() {
88 return this.stores.settings.app.splitMode;
89 }
90
80 @computed get theme() { 91 @computed get theme() {
81 const themeId = 92 const themeId =
82 this.isDarkThemeActive || this.stores.settings.app.darkMode 93 this.isDarkThemeActive || this.stores.settings.app.darkMode
@@ -114,4 +125,14 @@ export default class UIStore extends Store {
114 body?.classList.add('theme__dark'); 125 body?.classList.add('theme__dark');
115 } 126 }
116 } 127 }
128
129 _setupModeInDOM() {
130 const body = document.querySelector('body');
131
132 if (!this.isSplitModeActive) {
133 body?.classList.remove('mode__split');
134 } else {
135 body?.classList.add('mode__split');
136 }
137 }
117} 138}