it is working. finally.

This commit is contained in:
Henry Jameson 2024-10-02 16:22:28 +03:00
commit e8d0e45b5b
7 changed files with 168 additions and 64 deletions

View file

@ -174,7 +174,11 @@ const AppearanceTab = {
},
isCustomThemeUsed () {
const { theme } = this.mergedConfig
return theme === 'custom' || theme === null
return theme === 'custom'
},
isCustomStyleUsed (name) {
const { style } = this.mergedConfig
return style === 'custom'
},
...SharedComputedObject()
},
@ -196,12 +200,26 @@ const AppearanceTab = {
const { theme } = this.mergedConfig
return key === theme
},
async setTheme (name) {
await this.$store.dispatch('setTheme', name)
isStyleActive (key) {
const { style } = this.mergedConfig
return key === style
},
isPaletteActive (key) {
const { palette } = this.mergedConfig
return key === palette
},
setTheme (name) {
this.$store.dispatch('setTheme', name)
this.$store.dispatch('applyTheme')
},
async setPalette (name) {
await this.$store.dispatch('setPalette', name)
setPalette (name) {
this.$store.dispatch('setPalette', name)
this.$store.dispatch('applyTheme')
},
resetTheming (name) {
this.$store.dispatch('resetThemeV2')
this.$store.dispatch('resetThemeV3')
this.$store.dispatch('setStyle', 'stock')
this.$store.dispatch('applyTheme')
},
previewTheme (key, input) {

View file

@ -9,7 +9,8 @@
<button
class="button-default theme-preview"
data-theme-key="stock"
@click="setTheme(null)"
@click="resetTheming"
:class="{ toggled: isStyleActive('stock') }"
>
<!-- eslint-disable vue/no-v-text-v-html-on-component -->
<component
@ -49,7 +50,7 @@
v-html="previewTheme(style.key, style.data)"
/>
<!-- eslint-enable vue/no-v-text-v-html-on-component -->
<preview :class="{ placeholder: ready }" :id="'theme-preview-' + style.key"/>
<preview :id="'theme-preview-' + style.key"/>
<h4 class="theme-name">
{{ style.name }}
<span class="alert neutral version">{{ style.version }}</span>
@ -61,8 +62,9 @@
<button
v-for="p in availablePalettes"
class="btn button-default palette-entry"
:class="{ toggled: isPaletteActive(p.key) }"
:key="p.name"
@click="() => setPalette(p)"
@click="() => setPalette(p.key)"
>
<label>
{{ p.name }}