aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2022-04-12 21:18:06 +0300
committerHenry Jameson <me@hjkos.com>2022-04-12 21:18:06 +0300
commit3d37b9d8e1cad78fb1f666b3cfb7f28b1fdc1c2d (patch)
tree97a924d0e4e274f89e1aa6060fd8e780b5db0886 /src/modules
parentb37932fdf434d23777eaa58fccbf7afb07a052ea (diff)
unified layout-setting code and made an option to control or disable
third column behavior
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/config.js4
-rw-r--r--src/modules/interface.js24
2 files changed, 25 insertions, 3 deletions
diff --git a/src/modules/config.js b/src/modules/config.js
index 6d2e6ce0..c0d5c3c2 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -46,6 +46,7 @@ export const defaultState = {
pauseOnUnfocused: true,
stopGifs: true,
replyVisibility: 'all',
+ thirdColumnMode: 'notifications',
notificationVisibility: {
follows: true,
mentions: true,
@@ -165,6 +166,9 @@ const config = {
case 'interfaceLanguage':
messages.setLanguage(this.getters.i18n, value)
break
+ case 'thirdColumnMode':
+ dispatch('setLayoutWidth', undefined)
+ break
}
}
}
diff --git a/src/modules/interface.js b/src/modules/interface.js
index 9df72b88..ed31b6ff 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -72,6 +72,9 @@ const interfaceMod = {
setLayoutHeight (state, value) {
state.layoutHeight = value
},
+ setLayoutWidth (state, value) {
+ state.layoutWidth = value
+ },
setLastTimeline (state, value) {
state.lastTimeline = value
}
@@ -86,9 +89,6 @@ const interfaceMod = {
setNotificationPermission ({ commit }, permission) {
commit('setNotificationPermission', permission)
},
- setLayoutType ({ commit }, value) {
- commit('setLayoutType', value)
- },
closeSettingsModal ({ commit }) {
commit('closeSettingsModal')
},
@@ -133,6 +133,24 @@ const interfaceMod = {
setLayoutHeight ({ commit }, value) {
commit('setLayoutHeight', value)
},
+ // value is optional, assuming it was cached prior
+ setLayoutWidth ({ commit, state, rootGetters }, value) {
+ let width = value
+ if (value !== undefined) {
+ commit('setLayoutWidth', value)
+ } else {
+ width = state.layoutWidth
+ }
+ const mobileLayout = width <= 800
+ const normalOrMobile = mobileLayout ? 'mobile' : 'normal'
+ const { thirdColumnMode } = rootGetters.mergedConfig
+ if (thirdColumnMode === 'none') {
+ commit('setLayoutType', normalOrMobile)
+ } else {
+ const wideLayout = width >= 1300
+ commit('setLayoutType', wideLayout ? 'wide' : normalOrMobile)
+ }
+ },
setLastTimeline ({ commit }, value) {
commit('setLastTimeline', value)
}