diff options
author | niu tech <jerzyglowacki@gmail.com> | 2021-11-12 23:52:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-13 04:22:58 +0530 |
commit | ad17ec5ccad3ceffd383f228d4529438b5a3b9a6 (patch) | |
tree | f8cb939e8a1ae8d24126d37dfcd7e4b00c85eba0 /src/stores | |
parent | New Crowdin updates (#2219) (diff) | |
download | ferdium-app-ad17ec5ccad3ceffd383f228d4529438b5a3b9a6.tar.gz ferdium-app-ad17ec5ccad3ceffd383f228d4529438b5a3b9a6.tar.zst ferdium-app-ad17ec5ccad3ceffd383f228d4529438b5a3b9a6.zip |
Adjust number of columns for Split Mode (#2208)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/ServicesStore.js | 7 | ||||
-rw-r--r-- | src/stores/UIStore.js | 28 |
2 files changed, 27 insertions, 8 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 926ee36f0..a34390d88 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -171,6 +171,13 @@ export default class ServicesStore extends Store { | |||
171 | ); | 171 | ); |
172 | 172 | ||
173 | reaction( | 173 | reaction( |
174 | () => this.stores.settings.app.splitColumns, | ||
175 | () => { | ||
176 | this._shareSettingsWithServiceProcess(); | ||
177 | }, | ||
178 | ); | ||
179 | |||
180 | reaction( | ||
174 | () => this.stores.settings.app.searchEngine, | 181 | () => this.stores.settings.app.searchEngine, |
175 | () => { | 182 | () => { |
176 | this._shareSettingsWithServiceProcess(); | 183 | this._shareSettingsWithServiceProcess(); |
diff --git a/src/stores/UIStore.js b/src/stores/UIStore.js index 779f89b9f..9c194aa91 100644 --- a/src/stores/UIStore.js +++ b/src/stores/UIStore.js | |||
@@ -54,6 +54,13 @@ export default class UIStore extends Store { | |||
54 | }, | 54 | }, |
55 | { fireImmediately: true }, | 55 | { fireImmediately: true }, |
56 | ); | 56 | ); |
57 | reaction( | ||
58 | () => this.splitColumnsNo, | ||
59 | () => { | ||
60 | this._setupColumnsInDOM(); | ||
61 | }, | ||
62 | { fireImmediately: true }, | ||
63 | ); | ||
57 | } | 64 | } |
58 | 65 | ||
59 | @computed get showMessageBadgesEvenWhenMuted() { | 66 | @computed get showMessageBadgesEvenWhenMuted() { |
@@ -84,6 +91,10 @@ export default class UIStore extends Store { | |||
84 | return this.stores.settings.app.splitMode; | 91 | return this.stores.settings.app.splitMode; |
85 | } | 92 | } |
86 | 93 | ||
94 | @computed get splitColumnsNo() { | ||
95 | return this.stores.settings.app.splitColumns; | ||
96 | } | ||
97 | |||
87 | @computed get theme() { | 98 | @computed get theme() { |
88 | const themeId = | 99 | const themeId = |
89 | this.isDarkThemeActive || this.stores.settings.app.darkMode | 100 | this.isDarkThemeActive || this.stores.settings.app.darkMode |
@@ -113,22 +124,23 @@ export default class UIStore extends Store { | |||
113 | 124 | ||
114 | // Reactions | 125 | // Reactions |
115 | _setupThemeInDOM() { | 126 | _setupThemeInDOM() { |
116 | const body = document.querySelector('body'); | ||
117 | |||
118 | if (!this.isDarkThemeActive) { | 127 | if (!this.isDarkThemeActive) { |
119 | body?.classList.remove('theme__dark'); | 128 | document.body.classList.remove('theme__dark'); |
120 | } else { | 129 | } else { |
121 | body?.classList.add('theme__dark'); | 130 | document.body.classList.add('theme__dark'); |
122 | } | 131 | } |
123 | } | 132 | } |
124 | 133 | ||
125 | _setupModeInDOM() { | 134 | _setupModeInDOM() { |
126 | const body = document.querySelector('body'); | ||
127 | |||
128 | if (!this.isSplitModeActive) { | 135 | if (!this.isSplitModeActive) { |
129 | body?.classList.remove('mode__split'); | 136 | document.body.classList.remove('mode__split'); |
130 | } else { | 137 | } else { |
131 | body?.classList.add('mode__split'); | 138 | document.body.classList.add('mode__split'); |
139 | document.body.dataset.columns = this.splitColumnsNo; | ||
132 | } | 140 | } |
133 | } | 141 | } |
142 | |||
143 | _setupColumnsInDOM() { | ||
144 | document.body.dataset.columns = this.splitColumnsNo; | ||
145 | } | ||
134 | } | 146 | } |