cleanup and fixes
This commit is contained in:
parent
c926ed7ac1
commit
7d19cc2d53
17 changed files with 80 additions and 57 deletions
|
@ -403,9 +403,9 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
|
||||||
|
|
||||||
// Little thing to get out of invalid theme state
|
// Little thing to get out of invalid theme state
|
||||||
window.resetThemes = () => {
|
window.resetThemes = () => {
|
||||||
store.dispatch('resetThemeV3')
|
useInterfaceStore().resetThemeV3()
|
||||||
store.dispatch('resetThemeV3Palette')
|
useInterfaceStore().resetThemeV3Palette()
|
||||||
store.dispatch('resetThemeV2')
|
useInterfaceStore().resetThemeV2()
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use(vClickOutside)
|
app.use(vClickOutside)
|
||||||
|
|
|
@ -63,7 +63,7 @@ const BookmarkFolderEdit = {
|
||||||
this.$router.push({ name: 'bookmark-folders' })
|
this.$router.push({ name: 'bookmark-folders' })
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
this.$store.dispatch('pushGlobalNotice', {
|
this.$store.useInterfaceStore().pushGlobalNotice({
|
||||||
messageKey: 'bookmark_folders.error',
|
messageKey: 'bookmark_folders.error',
|
||||||
messageArgs: [e.message],
|
messageArgs: [e.message],
|
||||||
level: 'error'
|
level: 'error'
|
||||||
|
|
|
@ -9,6 +9,8 @@ import {
|
||||||
faBullhorn
|
faBullhorn
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
|
import { useInterfaceStore } from '../../stores/interface'
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
faUserPlus,
|
faUserPlus,
|
||||||
faComments,
|
faComments,
|
||||||
|
@ -42,7 +44,7 @@ const ExtraNotifications = {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openNotificationSettings () {
|
openNotificationSettings () {
|
||||||
return this.$store.dispatch('openSettingsModalTab', 'notifications')
|
return useInterfaceStore().openSettingsModalTab('notifications')
|
||||||
},
|
},
|
||||||
dismissConfigurationTip () {
|
dismissConfigurationTip () {
|
||||||
return this.$store.dispatch('setOption', { name: 'showExtraNotificationsTip', value: false })
|
return this.$store.dispatch('setOption', { name: 'showExtraNotificationsTip', value: false })
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default {
|
||||||
'name', 'label', 'modelValue', 'fallback', 'options', 'no-inherit'
|
'name', 'label', 'modelValue', 'fallback', 'options', 'no-inherit'
|
||||||
],
|
],
|
||||||
mounted () {
|
mounted () {
|
||||||
this.$store.dispatch('queryLocalFonts')
|
useInterfaceStore().queryLocalFonts()
|
||||||
},
|
},
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
data () {
|
data () {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { pollFormToMasto } from 'src/services/poll/poll.service.js'
|
||||||
import { reject, map, uniqBy, debounce } from 'lodash'
|
import { reject, map, uniqBy, debounce } from 'lodash'
|
||||||
import suggestor from '../emoji_input/suggestor.js'
|
import suggestor from '../emoji_input/suggestor.js'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import { mapState } from 'pinia'
|
import { mapState, mapActions } from 'pinia'
|
||||||
import Checkbox from '../checkbox/checkbox.vue'
|
import Checkbox from '../checkbox/checkbox.vue'
|
||||||
import Select from '../select/select.vue'
|
import Select from '../select/select.vue'
|
||||||
import DraftCloser from 'src/components/draft_closer/draft_closer.vue'
|
import DraftCloser from 'src/components/draft_closer/draft_closer.vue'
|
||||||
|
@ -32,7 +32,9 @@ import {
|
||||||
faChevronLeft,
|
faChevronLeft,
|
||||||
faChevronRight
|
faChevronRight
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
import { useInterfaceStore } from '../../stores/interface.js'
|
|
||||||
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
import { useMediaViewerStore } from 'src/stores/media_viewer.js'
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
faSmileBeam,
|
faSmileBeam,
|
||||||
|
@ -395,6 +397,7 @@ const PostStatusForm = {
|
||||||
this.removeBeforeUnloadListener()
|
this.removeBeforeUnloadListener()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useMediaViewerStore, ['increment']),
|
||||||
statusChanged () {
|
statusChanged () {
|
||||||
this.autoPreview()
|
this.autoPreview()
|
||||||
this.updateIdempotencyKey()
|
this.updateIdempotencyKey()
|
||||||
|
|
|
@ -386,7 +386,7 @@
|
||||||
:nsfw="false"
|
:nsfw="false"
|
||||||
:attachments="newStatus.files"
|
:attachments="newStatus.files"
|
||||||
:descriptions="newStatus.mediaDescriptions"
|
:descriptions="newStatus.mediaDescriptions"
|
||||||
:set-media="() => $store.dispatch('setMedia', newStatus.files)"
|
:set-media="() => setMedia()"
|
||||||
:editable="true"
|
:editable="true"
|
||||||
:edit-attachment="editAttachment"
|
:edit-attachment="editAttachment"
|
||||||
:remove-attachment="removeMediaFile"
|
:remove-attachment="removeMediaFile"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import Popover from '../popover/popover.vue'
|
import Popover from '../popover/popover.vue'
|
||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
import { mapState } from 'pinia'
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faFilter, faFont, faWrench } from '@fortawesome/free-solid-svg-icons'
|
import { faFilter, faFont, faWrench } from '@fortawesome/free-solid-svg-icons'
|
||||||
import { useInterfaceStore } from '../../stores/interface'
|
import { useInterfaceStore } from '../../stores/interface'
|
||||||
|
@ -29,8 +30,8 @@ const QuickFilterSettings = {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['mergedConfig']),
|
...mapGetters(['mergedConfig']),
|
||||||
...mapState({
|
...mapState(useInterfaceStore, {
|
||||||
mobileLayout: state => state.interface.layoutType === 'mobile'
|
mobileLayout: state => state.layoutType === 'mobile'
|
||||||
}),
|
}),
|
||||||
triggerAttrs () {
|
triggerAttrs () {
|
||||||
if (this.mobileLayout) {
|
if (this.mobileLayout) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Popover from 'src/components/popover/popover.vue'
|
import Popover from 'src/components/popover/popover.vue'
|
||||||
import QuickFilterSettings from 'src/components/quick_filter_settings/quick_filter_settings.vue'
|
import QuickFilterSettings from 'src/components/quick_filter_settings/quick_filter_settings.vue'
|
||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
import { mapState } from 'pinia'
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faList, faFolderTree, faBars, faWrench } from '@fortawesome/free-solid-svg-icons'
|
import { faList, faFolderTree, faBars, faWrench } from '@fortawesome/free-solid-svg-icons'
|
||||||
import { useInterfaceStore } from '../../stores/interface'
|
import { useInterfaceStore } from '../../stores/interface'
|
||||||
|
@ -30,8 +31,8 @@ const QuickViewSettings = {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['mergedConfig']),
|
...mapGetters(['mergedConfig']),
|
||||||
...mapState({
|
...mapState(useInterfaceStore, {
|
||||||
mobileLayout: state => state.interface.layoutType === 'mobile'
|
mobileLayout: state => state.layoutType === 'mobile'
|
||||||
}),
|
}),
|
||||||
loggedIn () {
|
loggedIn () {
|
||||||
return !!this.$store.state.users.currentUser
|
return !!this.$store.state.users.currentUser
|
||||||
|
|
|
@ -232,7 +232,7 @@ const EmojiTab = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
displayError (msg) {
|
displayError (msg) {
|
||||||
this.$store.dispatch('pushGlobalNotice', {
|
this.$store.useInterfaceStore().pushGlobalNotice({
|
||||||
messageKey: 'admin_dash.emoji.error',
|
messageKey: 'admin_dash.emoji.error',
|
||||||
messageArgs: [msg],
|
messageArgs: [msg],
|
||||||
level: 'error'
|
level: 'error'
|
||||||
|
|
|
@ -80,7 +80,7 @@ const FrontendsTab = {
|
||||||
this.$store.dispatch('loadFrontendsStuff')
|
this.$store.dispatch('loadFrontendsStuff')
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
const reason = await response.error.json()
|
const reason = await response.error.json()
|
||||||
this.$store.dispatch('pushGlobalNotice', {
|
this.$store.useInterfaceStore().pushGlobalNotice({
|
||||||
level: 'error',
|
level: 'error',
|
||||||
messageKey: 'admin_dash.frontend.failure_installing_frontend',
|
messageKey: 'admin_dash.frontend.failure_installing_frontend',
|
||||||
messageArgs: {
|
messageArgs: {
|
||||||
|
@ -90,7 +90,7 @@ const FrontendsTab = {
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('pushGlobalNotice', {
|
this.$store.useInterfaceStore().pushGlobalNotice({
|
||||||
level: 'success',
|
level: 'success',
|
||||||
messageKey: 'admin_dash.frontend.success_installing_frontend',
|
messageKey: 'admin_dash.frontend.success_installing_frontend',
|
||||||
messageArgs: {
|
messageArgs: {
|
||||||
|
|
|
@ -80,7 +80,7 @@ const SettingsModalAdminContent = {
|
||||||
}
|
}
|
||||||
// Clear the state of target tab, so that next time settings is opened
|
// Clear the state of target tab, so that next time settings is opened
|
||||||
// it doesn't force it.
|
// it doesn't force it.
|
||||||
this.$store.dispatch('clearSettingsModalTargetTab')
|
useInterfaceStore().clearSettingsModalTargetTab()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|
|
@ -4,11 +4,9 @@ import IntegerSetting from '../helpers/integer_setting.vue'
|
||||||
import FloatSetting from '../helpers/float_setting.vue'
|
import FloatSetting from '../helpers/float_setting.vue'
|
||||||
import UnitSetting, { defaultHorizontalUnits } from '../helpers/unit_setting.vue'
|
import UnitSetting, { defaultHorizontalUnits } from '../helpers/unit_setting.vue'
|
||||||
import PaletteEditor from 'src/components/palette_editor/palette_editor.vue'
|
import PaletteEditor from 'src/components/palette_editor/palette_editor.vue'
|
||||||
|
import Preview from './theme_tab/theme_preview.vue'
|
||||||
import FontControl from 'src/components/font_control/font_control.vue'
|
import FontControl from 'src/components/font_control/font_control.vue'
|
||||||
|
|
||||||
import { useInterfaceStore, normalizeThemeData } from 'src/stores/interface'
|
|
||||||
|
|
||||||
import { newImporter } from 'src/services/export_import/export_import.js'
|
import { newImporter } from 'src/services/export_import/export_import.js'
|
||||||
import { convertTheme2To3 } from 'src/services/theme_data/theme2_to_theme3.js'
|
import { convertTheme2To3 } from 'src/services/theme_data/theme2_to_theme3.js'
|
||||||
import { init } from 'src/services/theme_data/theme_data_3.service.js'
|
import { init } from 'src/services/theme_data/theme_data_3.service.js'
|
||||||
|
@ -20,17 +18,15 @@ import { deserialize } from 'src/services/theme_data/iss_deserializer.js'
|
||||||
|
|
||||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
|
import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
|
||||||
|
|
||||||
|
import { mapActions } from 'pinia'
|
||||||
|
import { useInterfaceStore, normalizeThemeData } from 'src/stores/interface'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import {
|
import {
|
||||||
faGlobe
|
faGlobe
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
import Preview from './theme_tab/theme_preview.vue'
|
|
||||||
|
|
||||||
// helper for debugging
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x))
|
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
faGlobe
|
faGlobe
|
||||||
)
|
)
|
||||||
|
@ -90,7 +86,7 @@ const AppearanceTab = {
|
||||||
PaletteEditor
|
PaletteEditor
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.$store.dispatch('getThemeData')
|
useInterfaceStore().getThemeData()
|
||||||
|
|
||||||
const updateIndex = (resource) => {
|
const updateIndex = (resource) => {
|
||||||
const capitalizedResource = resource[0].toUpperCase() + resource.slice(1)
|
const capitalizedResource = resource[0].toUpperCase() + resource.slice(1)
|
||||||
|
@ -100,7 +96,7 @@ const AppearanceTab = {
|
||||||
if (currentIndex) {
|
if (currentIndex) {
|
||||||
promise = Promise.resolve(currentIndex)
|
promise = Promise.resolve(currentIndex)
|
||||||
} else {
|
} else {
|
||||||
promise = this.$store.dispatch(`fetch${capitalizedResource}sIndex`)
|
promise = useInterfaceStore()[`fetch${capitalizedResource}sIndex`]()
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.then(index => {
|
return promise.then(index => {
|
||||||
|
@ -311,14 +307,14 @@ const AppearanceTab = {
|
||||||
},
|
},
|
||||||
onImport (parsed, filename) {
|
onImport (parsed, filename) {
|
||||||
if (filename.endsWith('.json')) {
|
if (filename.endsWith('.json')) {
|
||||||
this.$store.dispatch('setThemeCustom', parsed.source || parsed.theme)
|
useInterfaceStore().setThemeCustom(parsed.source || parsed.theme)
|
||||||
} else if (filename.endsWith('.iss')) {
|
} else if (filename.endsWith('.iss')) {
|
||||||
this.$store.dispatch('setStyleCustom', parsed)
|
useInterfaceStore().setStyleCustom(parsed)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onImportFailure (result) {
|
onImportFailure (result) {
|
||||||
console.error('Failure importing theme:', result)
|
console.error('Failure importing theme:', result)
|
||||||
this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_theme_imported', level: 'error' })
|
this.$store.useInterfaceStore().pushGlobalNotice({ messageKey: 'settings.invalid_theme_imported', level: 'error' })
|
||||||
},
|
},
|
||||||
importValidator (parsed, filename) {
|
importValidator (parsed, filename) {
|
||||||
if (filename.endsWith('.json')) {
|
if (filename.endsWith('.json')) {
|
||||||
|
@ -340,22 +336,20 @@ const AppearanceTab = {
|
||||||
isPaletteActive (key) {
|
isPaletteActive (key) {
|
||||||
return key === (this.mergedConfig.palette || this.$store.state.instance.palette)
|
return key === (this.mergedConfig.palette || this.$store.state.instance.palette)
|
||||||
},
|
},
|
||||||
setStyle (name) {
|
...mapActions(useInterfaceStore, [
|
||||||
this.$store.dispatch('setStyle', name)
|
'setStyle',
|
||||||
},
|
'setTheme'
|
||||||
setTheme (name) {
|
]),
|
||||||
this.$store.dispatch('setTheme', name)
|
|
||||||
},
|
|
||||||
setPalette (name, data) {
|
setPalette (name, data) {
|
||||||
this.$store.dispatch('setPalette', name)
|
useInterfaceStore().setPalette(name)
|
||||||
this.userPalette = data
|
this.userPalette = data
|
||||||
},
|
},
|
||||||
setPaletteCustom (data) {
|
setPaletteCustom (data) {
|
||||||
this.$store.dispatch('setPaletteCustom', data)
|
useInterfaceStore().setPaletteCustom(data)
|
||||||
this.userPalette = data
|
this.userPalette = data
|
||||||
},
|
},
|
||||||
resetTheming (name) {
|
resetTheming (name) {
|
||||||
this.$store.dispatch('setStyle', 'stock')
|
useInterfaceStore().setStyle('stock')
|
||||||
},
|
},
|
||||||
previewTheme (key, version, input) {
|
previewTheme (key, version, input) {
|
||||||
let theme3
|
let theme3
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { ref, reactive, computed, watch, watchEffect, provide, getCurrentInstance } from 'vue'
|
import { ref, reactive, computed, watch, watchEffect, provide, getCurrentInstance } from 'vue'
|
||||||
import { useStore } from 'vuex'
|
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
import { get, set, unset, throttle } from 'lodash'
|
import { get, set, unset, throttle } from 'lodash'
|
||||||
|
|
||||||
|
@ -81,14 +80,13 @@ export default {
|
||||||
},
|
},
|
||||||
setup (props, context) {
|
setup (props, context) {
|
||||||
const exports = {}
|
const exports = {}
|
||||||
const store = useStore()
|
|
||||||
const interfaceStore = useInterfaceStore()
|
const interfaceStore = useInterfaceStore()
|
||||||
// All rules that are made by editor
|
// All rules that are made by editor
|
||||||
const allEditedRules = ref(interfaceStore.styleDataUsed || {})
|
const allEditedRules = ref(interfaceStore.styleDataUsed || {})
|
||||||
const styleDataUsed = computed(() => interfaceStore.styleDataUsed)
|
const styleDataUsed = computed(() => interfaceStore.styleDataUsed)
|
||||||
|
|
||||||
watch([styleDataUsed], (value) => {
|
watch([styleDataUsed], (value) => {
|
||||||
onImport(store.state.interface.styleDataUsed)
|
onImport(interfaceStore.styleDataUsed)
|
||||||
}, { once: true })
|
}, { once: true })
|
||||||
|
|
||||||
exports.isActive = computed(() => {
|
exports.isActive = computed(() => {
|
||||||
|
@ -642,7 +640,7 @@ export default {
|
||||||
parser (string) { return deserialize(string) },
|
parser (string) { return deserialize(string) },
|
||||||
onImportFailure (result) {
|
onImportFailure (result) {
|
||||||
console.error('Failure importing style:', result)
|
console.error('Failure importing style:', result)
|
||||||
this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_theme_imported', level: 'error' })
|
this.$store.useInterfaceStore().pushGlobalNotice({ messageKey: 'settings.invalid_theme_imported', level: 'error' })
|
||||||
},
|
},
|
||||||
onImport
|
onImport
|
||||||
})
|
})
|
||||||
|
@ -666,7 +664,7 @@ export default {
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.clearStyle = () => {
|
exports.clearStyle = () => {
|
||||||
onImport(store.state.interface.styleDataUsed)
|
onImport(interfaceStore().styleDataUsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.exportStyle = () => {
|
exports.exportStyle = () => {
|
||||||
|
@ -678,7 +676,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.applyStyle = () => {
|
exports.applyStyle = () => {
|
||||||
store.dispatch('setStyleCustom', exportRules.value)
|
useInterfaceStore().setStyleCustom(exportRules.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const overallPreviewRules = ref([])
|
const overallPreviewRules = ref([])
|
||||||
|
|
|
@ -127,7 +127,7 @@ export default {
|
||||||
if (currentIndex) {
|
if (currentIndex) {
|
||||||
promise = Promise.resolve(currentIndex)
|
promise = Promise.resolve(currentIndex)
|
||||||
} else {
|
} else {
|
||||||
promise = this.$store.dispatch('fetchThemesIndex')
|
promise = useInterfaceStore().fetchThemesIndex()
|
||||||
}
|
}
|
||||||
|
|
||||||
promise.then(themesIndex => {
|
promise.then(themesIndex => {
|
||||||
|
@ -493,7 +493,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setCustomTheme () {
|
setCustomTheme () {
|
||||||
this.$store.dispatch('setThemeV2', {
|
useInterfaceStore().setThemeV2({
|
||||||
customTheme: {
|
customTheme: {
|
||||||
ignore: true,
|
ignore: true,
|
||||||
themeFileVersion: this.selectedVersion,
|
themeFileVersion: this.selectedVersion,
|
||||||
|
|
|
@ -117,9 +117,6 @@ const persistedStateOptions = {
|
||||||
// strict: process.env.NODE_ENV !== 'production'
|
// strict: process.env.NODE_ENV !== 'production'
|
||||||
})
|
})
|
||||||
window.vuex = store
|
window.vuex = store
|
||||||
if (storageError) {
|
|
||||||
store.dispatch('pushGlobalNotice', { messageKey: 'errors.storage_unavailable', level: 'error' })
|
|
||||||
}
|
|
||||||
// Temporarily passing pinia and vuex stores along with storageError result until migration is fully complete.
|
// Temporarily passing pinia and vuex stores along with storageError result until migration is fully complete.
|
||||||
return await afterStoreSetup({ pinia, store, storageError, i18n })
|
return await afterStoreSetup({ pinia, store, storageError, i18n })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
omitBy
|
omitBy
|
||||||
} from 'lodash'
|
} from 'lodash'
|
||||||
import apiService from '../services/api/api.service.js'
|
import apiService from '../services/api/api.service.js'
|
||||||
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
|
|
||||||
const emptyTl = (userId = 0) => ({
|
const emptyTl = (userId = 0) => ({
|
||||||
statuses: [],
|
statuses: [],
|
||||||
|
@ -510,7 +511,7 @@ const statuses = {
|
||||||
commit('setDeleted', { status })
|
commit('setDeleted', { status })
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
dispatch('pushGlobalNotice', {
|
useInterfaceStore().pushGlobalNotice({
|
||||||
level: 'error',
|
level: 'error',
|
||||||
messageKey: 'status.delete_error',
|
messageKey: 'status.delete_error',
|
||||||
messageArgs: [e.message],
|
messageArgs: [e.message],
|
||||||
|
|
|
@ -35,7 +35,8 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
cssFilter: window.CSS && window.CSS.supports && (
|
cssFilter: window.CSS && window.CSS.supports && (
|
||||||
window.CSS.supports('filter', 'drop-shadow(0 0)') ||
|
window.CSS.supports('filter', 'drop-shadow(0 0)') ||
|
||||||
window.CSS.supports('-webkit-filter', 'drop-shadow(0 0)')
|
window.CSS.supports('-webkit-filter', 'drop-shadow(0 0)')
|
||||||
)
|
),
|
||||||
|
localFonts: typeof window.queryLocalFonts === 'function'
|
||||||
},
|
},
|
||||||
layoutType: 'normal',
|
layoutType: 'normal',
|
||||||
globalNotices: [],
|
globalNotices: [],
|
||||||
|
@ -95,9 +96,9 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
clearSettingsModalTargetTab () {
|
clearSettingsModalTargetTab () {
|
||||||
this.settingsModalTargetTab = null
|
this.settingsModalTargetTab = null
|
||||||
},
|
},
|
||||||
openSettingsModalTab (value) {
|
openSettingsModalTab (value, mode = 'user') {
|
||||||
this.settingsModalTargetTab = value
|
this.settingsModalTargetTab = value
|
||||||
this.openSettingsModal()
|
this.openSettingsModal(mode)
|
||||||
},
|
},
|
||||||
removeGlobalNotice (notice) {
|
removeGlobalNotice (notice) {
|
||||||
this.globalNotices = this.globalNotices.filter(n => n !== notice)
|
this.globalNotices = this.globalNotices.filter(n => n !== notice)
|
||||||
|
@ -147,6 +148,31 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
this.layoutType = wideLayout ? 'wide' : normalOrMobile
|
this.layoutType = wideLayout ? 'wide' : normalOrMobile
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setFontsList (value) {
|
||||||
|
this.localFonts = [...(new Set(value.map(font => font.family))).values()]
|
||||||
|
},
|
||||||
|
queryLocalFonts () {
|
||||||
|
if (this.localFonts !== null) return
|
||||||
|
this.setFontsList([])
|
||||||
|
|
||||||
|
if (!this.browserSupport.localFonts) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window
|
||||||
|
.queryLocalFonts()
|
||||||
|
.then((fonts) => {
|
||||||
|
this.setFontsList(fonts)
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.pushGlobalNotice({
|
||||||
|
messageKey: 'settings.style.themes3.font.font_list_unavailable',
|
||||||
|
messageArgs: {
|
||||||
|
error: e
|
||||||
|
},
|
||||||
|
level: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
setLastTimeline (value) {
|
setLastTimeline (value) {
|
||||||
this.lastTimeline = value
|
this.lastTimeline = value
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue