initial Appearance Tab implementation, added text size/UI scale option
This commit is contained in:
parent
fd1011f622
commit
e4a819a0e2
16 changed files with 236 additions and 26 deletions
|
|
@ -115,7 +115,8 @@ export const defaultState = {
|
|||
sidebarColumnWidth: '25rem',
|
||||
contentColumnWidth: '45rem',
|
||||
notifsColumnWidth: '25rem',
|
||||
emojiReactionsScale: 1.0,
|
||||
emojiReactionsScale: undefined,
|
||||
textSize: undefined, // instance default
|
||||
navbarColumnStretch: false,
|
||||
greentext: undefined, // instance default
|
||||
useAtIcon: undefined, // instance default
|
||||
|
|
@ -173,6 +174,10 @@ const config = {
|
|||
}
|
||||
},
|
||||
mutations: {
|
||||
setOptionTemporarily (state, { name, value }) {
|
||||
set(state, name, value)
|
||||
applyConfig(state)
|
||||
},
|
||||
setOption (state, { name, value }) {
|
||||
set(state, name, value)
|
||||
},
|
||||
|
|
@ -203,6 +208,31 @@ const config = {
|
|||
setHighlight ({ commit, dispatch }, { user, color, type }) {
|
||||
commit('setHighlight', { user, color, type })
|
||||
},
|
||||
setOptionTemporarily ({ commit, dispatch, state, rootState }, { name, value }) {
|
||||
if (rootState.interface.temporaryChangesTimeoutId !== null) {
|
||||
console.warn('Can\'t track more than one temporary change')
|
||||
return
|
||||
}
|
||||
const oldValue = state[name]
|
||||
|
||||
commit('setOptionTemporarily', { name, value })
|
||||
|
||||
const confirm = () => {
|
||||
dispatch('setOption', { name, value })
|
||||
commit('clearTemporaryChanges')
|
||||
}
|
||||
|
||||
const revert = () => {
|
||||
commit('setOptionTemporarily', { name, value: oldValue })
|
||||
commit('clearTemporaryChanges')
|
||||
}
|
||||
|
||||
commit('setTemporaryChanges', {
|
||||
timeoutId: setTimeout(revert, 10000),
|
||||
confirm,
|
||||
revert
|
||||
})
|
||||
},
|
||||
setOption ({ commit, dispatch, state }, { name, value }) {
|
||||
const exceptions = new Set([
|
||||
'useStreamingApi'
|
||||
|
|
@ -231,6 +261,7 @@ const config = {
|
|||
case 'sidebarColumnWidth':
|
||||
case 'contentColumnWidth':
|
||||
case 'notifsColumnWidth':
|
||||
case 'textSize':
|
||||
case 'emojiReactionsScale':
|
||||
applyConfig(state)
|
||||
break
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ const defaultState = {
|
|||
sidebarRight: false,
|
||||
subjectLineBehavior: 'email',
|
||||
theme: 'pleroma-dark',
|
||||
emojiReactionsScale: 1.0,
|
||||
textSize: '14px',
|
||||
virtualScrolling: true,
|
||||
sensitiveByDefault: false,
|
||||
conversationDisplay: 'linear',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
const defaultState = {
|
||||
themeApplied: false,
|
||||
temporaryChangesTimeoutId: null, // used for temporary options that revert after a timeout
|
||||
temporaryChangesConfirm: () => {}, // used for applying temporary options
|
||||
temporaryChangesRevert: () => {}, // used for reverting temporary options
|
||||
settingsModalState: 'hidden',
|
||||
settingsModalLoadedUser: false,
|
||||
settingsModalLoadedAdmin: false,
|
||||
|
|
@ -36,6 +39,17 @@ const interfaceMod = {
|
|||
state.settings.currentSaveStateNotice = { error: true, errorData: error }
|
||||
}
|
||||
},
|
||||
setTemporaryChanges (state, { timeoutId, confirm, revert }) {
|
||||
state.temporaryChangesTimeoutId = timeoutId
|
||||
state.temporaryChangesConfirm = confirm
|
||||
state.temporaryChangesRevert = revert
|
||||
},
|
||||
clearTemporaryChanges (state) {
|
||||
clearTimeout(state.temporaryChangesTimeoutId)
|
||||
state.temporaryChangesTimeoutId = null
|
||||
state.temporaryChangesConfirm = () => {}
|
||||
state.temporaryChangesRevert = () => {}
|
||||
},
|
||||
setThemeApplied (state) {
|
||||
state.themeApplied = true
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue