|
|
|
|
@ -1,30 +1,23 @@
|
|
|
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
|
|
|
|
|
|
|
|
import AppSelector, { AppSelectorProps as SProps } from '@/components/app/AppSelector'
|
|
|
|
|
import AppCheckbox from '@/components/app/AppCheckbox'
|
|
|
|
|
import { PageModule } from '@/store/page'
|
|
|
|
|
import { LoginPosition } from '@/models/page'
|
|
|
|
|
import { AppModule } from '@/store/app'
|
|
|
|
|
import AppIcon from '@/components/app/AppIcon.vue'
|
|
|
|
|
import { generateDesktopIcons, languageMap } from '@/utils/helper'
|
|
|
|
|
import AppButton from '@/components/app/AppButton'
|
|
|
|
|
import { osList } from '@/models/app'
|
|
|
|
|
import SettingsUsers from './SettingsUsers'
|
|
|
|
|
import SettingsHotkeys from './SettingsHotkeys'
|
|
|
|
|
import SettingsCheckboxes from './SettingsCheckboxes'
|
|
|
|
|
import SettingsSelectors from './SettingsSelectors'
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
components: {
|
|
|
|
|
AppIcon,
|
|
|
|
|
AppSelector,
|
|
|
|
|
SettingsUsers,
|
|
|
|
|
SettingsHotkeys
|
|
|
|
|
SettingsHotkeys,
|
|
|
|
|
SettingsSelectors,
|
|
|
|
|
SettingsCheckboxes
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
export default class SettingsGeneral extends Vue {
|
|
|
|
|
get bodyClass() {
|
|
|
|
|
return AppModule.bodyClass
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get showFrameRate() {
|
|
|
|
|
return AppModule.showFrameRate
|
|
|
|
|
}
|
|
|
|
|
@ -33,68 +26,6 @@ export default class SettingsGeneral extends Vue {
|
|
|
|
|
return AppModule.viewThemeOnly
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get languageList() {
|
|
|
|
|
return PageModule.languages.map((language) => ({
|
|
|
|
|
text: languageMap[language],
|
|
|
|
|
value: language
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get menuPositionItems() {
|
|
|
|
|
const positions = ['top', 'left', 'right', 'bottom', 'center']
|
|
|
|
|
return positions.map(word => ({
|
|
|
|
|
value: word,
|
|
|
|
|
text: this.$t(`settings.login-position.${word}`).toString()
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get menuPositionValue() {
|
|
|
|
|
return {
|
|
|
|
|
value: PageModule.loginPosition,
|
|
|
|
|
text: this.$t(`settings.login-position.${PageModule.loginPosition}`).toString()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeLanguage(value: string) {
|
|
|
|
|
this.$i18n.locale = value
|
|
|
|
|
localStorage.setItem('language', value)
|
|
|
|
|
PageModule.SET_STATE_PAGE({ key: 'language', value })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeLoginPosition(position: string) {
|
|
|
|
|
localStorage.setItem('loginPosition', position)
|
|
|
|
|
PageModule.SET_STATE_PAGE({ key: 'loginPosition', value: position as LoginPosition })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeDesktop(value: string) {
|
|
|
|
|
AppModule.SAVE_STATE_APP({ key: 'desktop', value })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeOs(value: string) {
|
|
|
|
|
AppModule.SAVE_STATE_APP({ key: 'currentOs', value })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildCheckbox(name: string) {
|
|
|
|
|
return <AppCheckbox
|
|
|
|
|
label={ this.$t(`settings.${name}`) }
|
|
|
|
|
value={ this.bodyClass[name] }
|
|
|
|
|
onInput={ (value: boolean) => {
|
|
|
|
|
AppModule.CHANGE_BODY_CLASS({ key: name, value })
|
|
|
|
|
AppModule.syncStoreWithQuery()
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildSelector(labelI18n: SProps['label'], items: SProps['items'], value: SProps['value'], callback: (value: string) => void) {
|
|
|
|
|
const label = this.$t(`settings.${labelI18n}`)
|
|
|
|
|
return <AppSelector
|
|
|
|
|
label={ label }
|
|
|
|
|
items={ items }
|
|
|
|
|
value={ value }
|
|
|
|
|
onInput={ callback }
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resetSettings() {
|
|
|
|
|
localStorage.clear()
|
|
|
|
|
AppModule.setUpSettings()
|
|
|
|
|
@ -103,34 +34,13 @@ export default class SettingsGeneral extends Vue {
|
|
|
|
|
if (hasQyery) { this.$router.replace({}) }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildSettingsSection() {
|
|
|
|
|
return <div class="grid-two">
|
|
|
|
|
<h2 class="title"> { this.$t('settings.title') } </h2>
|
|
|
|
|
{ this.buildSelector('choice-language', this.languageList, PageModule.language, this.changeLanguage) }
|
|
|
|
|
{ this.buildSelector('login-position.about', this.menuPositionItems, this.menuPositionValue, this.changeLoginPosition) }
|
|
|
|
|
{ !this.isViewThemeOnly && this.buildSelector('choice-desktop', generateDesktopIcons(), AppModule.currentDesktop?.key, this.changeDesktop) }
|
|
|
|
|
{ !this.isViewThemeOnly && this.buildSelector('choice-os', osList, AppModule.currentOs, this.changeOs) }
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildCheckboxSection() {
|
|
|
|
|
return <div class="grid-two">
|
|
|
|
|
<h2 class="title"> { this.$t('settings.performance') } </h2>
|
|
|
|
|
{ this.buildCheckbox('blur') }
|
|
|
|
|
{ this.buildCheckbox('show-framerate') }
|
|
|
|
|
{ this.buildCheckbox('no-transition') }
|
|
|
|
|
{ this.buildCheckbox('only-ui') }
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
return <div class='user-settings-general'>
|
|
|
|
|
{ this.buildCheckboxSection() }
|
|
|
|
|
{ this.buildSettingsSection() }
|
|
|
|
|
<SettingsCheckboxes />
|
|
|
|
|
<SettingsSelectors />
|
|
|
|
|
|
|
|
|
|
{ !this.isViewThemeOnly && <SettingsUsers /> }
|
|
|
|
|
|
|
|
|
|
{ <SettingsHotkeys />}
|
|
|
|
|
<SettingsHotkeys />
|
|
|
|
|
|
|
|
|
|
<div class="help-block">
|
|
|
|
|
<AppButton onClick={ this.resetSettings } block>
|
|
|
|
|
|