2026-01-29 20:33:59 +02:00
|
|
|
import { mapState } from 'pinia'
|
2026-01-08 17:26:52 +02:00
|
|
|
|
2026-01-06 16:23:17 +02:00
|
|
|
import FontControl from 'src/components/font_control/font_control.vue'
|
|
|
|
|
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
|
2020-10-01 01:43:07 +03:00
|
|
|
import BooleanSetting from '../helpers/boolean_setting.vue'
|
2021-03-11 16:55:14 +02:00
|
|
|
import ChoiceSetting from '../helpers/choice_setting.vue'
|
2025-11-24 17:06:55 +02:00
|
|
|
import FloatSetting from '../helpers/float_setting.vue'
|
2025-08-05 17:52:30 +03:00
|
|
|
import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
|
2020-06-07 00:15:10 +03:00
|
|
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
2026-01-06 16:23:17 +02:00
|
|
|
import UnitSetting from '../helpers/unit_setting.vue'
|
2020-05-10 06:46:06 +03:00
|
|
|
|
2026-01-29 20:40:00 +02:00
|
|
|
import { useInstanceStore } from 'src/stores/instance.js'
|
2026-02-13 14:26:39 +02:00
|
|
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
2026-02-16 02:24:44 +02:00
|
|
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
2026-01-29 20:40:00 +02:00
|
|
|
|
|
|
|
|
import localeService from 'src/services/locale/locale.service.js'
|
|
|
|
|
|
2020-05-10 06:46:06 +03:00
|
|
|
const GeneralTab = {
|
2026-01-06 16:22:52 +02:00
|
|
|
data() {
|
2020-05-10 06:46:06 +03:00
|
|
|
return {
|
2026-01-06 16:22:52 +02:00
|
|
|
absoluteTime12hOptions: ['24h', '12h'].map((mode) => ({
|
2025-01-27 12:00:28 +02:00
|
|
|
key: mode,
|
|
|
|
|
value: mode,
|
2026-01-06 16:22:52 +02:00
|
|
|
label: this.$t(`settings.absolute_time_format_12h_${mode}`),
|
2025-01-27 12:00:28 +02:00
|
|
|
})),
|
2026-01-06 16:22:52 +02:00
|
|
|
emailLanguage: this.$store.state.users.currentUser.language || [''],
|
2020-05-10 06:46:06 +03:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
2020-10-01 01:43:07 +03:00
|
|
|
BooleanSetting,
|
2021-03-11 16:55:14 +02:00
|
|
|
ChoiceSetting,
|
2024-04-24 15:58:26 +03:00
|
|
|
UnitSetting,
|
2025-11-24 17:06:55 +02:00
|
|
|
FloatSetting,
|
|
|
|
|
FontControl,
|
2022-02-22 23:31:40 +02:00
|
|
|
InterfaceLanguageSwitcher,
|
2026-01-06 16:22:52 +02:00
|
|
|
ProfileSettingIndicator,
|
2020-05-10 06:46:06 +03:00
|
|
|
},
|
|
|
|
|
computed: {
|
2024-07-25 11:58:58 +03:00
|
|
|
language: {
|
2026-01-06 16:22:52 +02:00
|
|
|
get: function () {
|
2026-02-13 14:26:39 +02:00
|
|
|
return useSyncConfigStore().mergedConfig.interfaceLanguage
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2024-07-25 11:58:58 +03:00
|
|
|
set: function (val) {
|
2026-02-16 16:58:11 +02:00
|
|
|
useSyncConfigStore().setSimplePrefAndSave({
|
|
|
|
|
path: 'interfaceLanguage',
|
2026-01-06 16:22:52 +02:00
|
|
|
value: val,
|
|
|
|
|
})
|
|
|
|
|
},
|
2024-07-25 11:58:58 +03:00
|
|
|
},
|
2025-08-03 18:32:18 +03:00
|
|
|
...SharedComputedObject(),
|
2026-02-05 00:28:45 +02:00
|
|
|
...mapState(useInstanceCapabilitiesStore, ['blockExpiration']),
|
2026-02-13 14:26:39 +02:00
|
|
|
...mapState(useSyncConfigStore, {
|
|
|
|
|
theme3hacks: (store) => store.mergedConfig.theme3hacks,
|
|
|
|
|
}),
|
2022-02-22 23:31:40 +02:00
|
|
|
},
|
|
|
|
|
methods: {
|
2026-01-06 16:22:52 +02:00
|
|
|
updateProfile() {
|
2025-08-04 13:48:09 +03:00
|
|
|
const params = {
|
2026-01-06 16:22:52 +02:00
|
|
|
language: localeService.internalToBackendLocaleMulti(
|
|
|
|
|
this.emailLanguage,
|
|
|
|
|
),
|
2025-08-04 13:48:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$store.state.api.backendInteractor
|
|
|
|
|
.updateProfile({ params })
|
|
|
|
|
.then((user) => {
|
|
|
|
|
this.$store.commit('addNewUsers', [user])
|
|
|
|
|
this.$store.commit('setCurrentUser', user)
|
|
|
|
|
})
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
updateFont(key, value) {
|
2026-02-16 16:58:11 +02:00
|
|
|
useSyncConfigStore().setSimplePrefAndSave({
|
|
|
|
|
path: 'theme3hacks',
|
2025-10-15 16:53:16 +03:00
|
|
|
value: {
|
|
|
|
|
...this.mergedConfig.theme3hacks,
|
|
|
|
|
fonts: {
|
|
|
|
|
...this.mergedConfig.theme3hacks.fonts,
|
2026-01-06 16:22:52 +02:00
|
|
|
[key]: value,
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-10-15 16:53:16 +03:00
|
|
|
})
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2020-05-10 06:46:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default GeneralTab
|