show warning about palettes being unsupported when using v2 theme
This commit is contained in:
parent
13838a75a9
commit
81d9537f9d
|
@ -34,7 +34,7 @@ const AppearanceTab = {
|
||||||
return {
|
return {
|
||||||
availableStyles: [],
|
availableStyles: [],
|
||||||
availablePalettes: [],
|
availablePalettes: [],
|
||||||
themeImporter: newImporter({
|
fileImporter: newImporter({
|
||||||
accept: '.json, .piss',
|
accept: '.json, .piss',
|
||||||
validator: this.importValidator,
|
validator: this.importValidator,
|
||||||
onImport: this.onImport,
|
onImport: this.onImport,
|
||||||
|
@ -179,6 +179,10 @@ const AppearanceTab = {
|
||||||
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
|
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
customThemeVersion () {
|
||||||
|
const { themeVersion } = this.$store.state.interface
|
||||||
|
return themeVersion
|
||||||
|
},
|
||||||
isCustomThemeUsed () {
|
isCustomThemeUsed () {
|
||||||
const { theme } = this.mergedConfig
|
const { theme } = this.mergedConfig
|
||||||
return theme === 'custom'
|
return theme === 'custom'
|
||||||
|
@ -202,8 +206,8 @@ const AppearanceTab = {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
importTheme () {
|
importFile () {
|
||||||
this.themeImporter.importData()
|
this.fileImporter.importData()
|
||||||
},
|
},
|
||||||
onImport (parsed, filename) {
|
onImport (parsed, filename) {
|
||||||
if (filename.endsWith('.json')) {
|
if (filename.endsWith('.json')) {
|
||||||
|
@ -234,14 +238,18 @@ const AppearanceTab = {
|
||||||
const { palette } = this.mergedConfig
|
const { palette } = this.mergedConfig
|
||||||
return key === palette
|
return key === palette
|
||||||
},
|
},
|
||||||
importStyle () {
|
setStyle (name) {
|
||||||
|
this.$store.dispatch('resetThemeV2')
|
||||||
|
this.$store.dispatch('setTheme', name)
|
||||||
|
this.$store.dispatch('applyTheme')
|
||||||
},
|
},
|
||||||
setTheme (name) {
|
setTheme (name) {
|
||||||
|
this.$store.dispatch('resetThemeV3')
|
||||||
this.$store.dispatch('setTheme', name)
|
this.$store.dispatch('setTheme', name)
|
||||||
this.$store.dispatch('applyTheme')
|
this.$store.dispatch('applyTheme')
|
||||||
},
|
},
|
||||||
setPalette (name) {
|
setPalette (name) {
|
||||||
|
this.$store.dispatch('resetThemeV2')
|
||||||
this.$store.dispatch('setPalette', name)
|
this.$store.dispatch('setPalette', name)
|
||||||
this.$store.dispatch('applyTheme')
|
this.$store.dispatch('applyTheme')
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
grid-gap: 0.5em;
|
grid-gap: 0.5em;
|
||||||
|
|
||||||
|
.unsupported-theme-v2 {
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.palette-entry {
|
.palette-entry {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<h2>{{ $t('settings.theme') }}</h2>
|
<h2>{{ $t('settings.theme') }}</h2>
|
||||||
<button
|
<button
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
@click="importTheme"
|
@click="importFile"
|
||||||
>
|
>
|
||||||
<FAIcon icon="folder-open" />
|
<FAIcon icon="folder-open" />
|
||||||
{{ $t('settings.style.themes3.editor.load_style') }}
|
{{ $t('settings.style.themes3.editor.load_style') }}
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
v-html="previewTheme('stock')"
|
v-html="previewTheme('stock')"
|
||||||
/>
|
/>
|
||||||
<!-- eslint-enable vue/no-v-text-v-html-on-component -->
|
<!-- eslint-enable vue/no-v-text-v-html-on-component -->
|
||||||
<preview />
|
<preview id="theme-preview-stock" />
|
||||||
<h4 class="theme-name">
|
<h4 class="theme-name">
|
||||||
{{ $t('settings.style.stock_theme_used') }}
|
{{ $t('settings.style.stock_theme_used') }}
|
||||||
<span class="alert neutral version">v3</span>
|
<span class="alert neutral version">v3</span>
|
||||||
|
@ -71,6 +71,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<h3>{{ $t('settings.style.themes3.palette.label') }}</h3>
|
<h3>{{ $t('settings.style.themes3.palette.label') }}</h3>
|
||||||
<div class="palettes">
|
<div class="palettes">
|
||||||
|
<template v-if="customThemeVersion === 'v3'">
|
||||||
<button
|
<button
|
||||||
v-for="p in availablePalettes"
|
v-for="p in availablePalettes"
|
||||||
:key="p.name"
|
:key="p.name"
|
||||||
|
@ -88,6 +89,12 @@
|
||||||
:style="{ backgroundColor: p[c], border: '1px solid ' + (p[c] ?? 'var(--text)') }"
|
:style="{ backgroundColor: p[c], border: '1px solid ' + (p[c] ?? 'var(--text)') }"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="customThemeVersion === 'v2'">
|
||||||
|
<div class="alert neutral theme-notice unsupported-theme-v2">
|
||||||
|
{{$t('settings.style.themes3.palette.v2_unsupported')}}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert neutral theme-notice">
|
<div class="alert neutral theme-notice">
|
||||||
|
|
|
@ -771,7 +771,8 @@
|
||||||
"cOrange": "Orange color",
|
"cOrange": "Orange color",
|
||||||
"extra1": "Extra 1",
|
"extra1": "Extra 1",
|
||||||
"extra2": "Extra 2",
|
"extra2": "Extra 2",
|
||||||
"extra3": "Extra 3"
|
"extra3": "Extra 3",
|
||||||
|
"v2_unsupported": "Older v2 themes don't support palettes. Switch to v3 theme to make use of palettes",
|
||||||
},
|
},
|
||||||
"editor": {
|
"editor": {
|
||||||
"title": "Style",
|
"title": "Style",
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { convertTheme2To3 } from 'src/services/theme_data/theme2_to_theme3.js'
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
localFonts: null,
|
localFonts: null,
|
||||||
themeApplied: false,
|
themeApplied: false,
|
||||||
|
themeVersion: 'v3',
|
||||||
temporaryChangesTimeoutId: null, // used for temporary options that revert after a timeout
|
temporaryChangesTimeoutId: null, // used for temporary options that revert after a timeout
|
||||||
temporaryChangesConfirm: () => {}, // used for applying temporary options
|
temporaryChangesConfirm: () => {}, // used for applying temporary options
|
||||||
temporaryChangesRevert: () => {}, // used for reverting temporary options
|
temporaryChangesRevert: () => {}, // used for reverting temporary options
|
||||||
|
@ -307,7 +308,7 @@ const interfaceMod = {
|
||||||
commit('setOption', { name: 'customThemeSource', value: null })
|
commit('setOption', { name: 'customThemeSource', value: null })
|
||||||
},
|
},
|
||||||
async applyTheme (
|
async applyTheme (
|
||||||
{ dispatch, commit, rootState },
|
{ dispatch, commit, rootState, state },
|
||||||
{ recompile = true } = {}
|
{ recompile = true } = {}
|
||||||
) {
|
) {
|
||||||
// If we're not not forced to recompile try using
|
// If we're not not forced to recompile try using
|
||||||
|
@ -398,6 +399,8 @@ const interfaceMod = {
|
||||||
majorVersionUsed = 'v3'
|
majorVersionUsed = 'v3'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.themeVersion = majorVersionUsed
|
||||||
|
|
||||||
let styleDataUsed = null
|
let styleDataUsed = null
|
||||||
let styleNameUsed = null
|
let styleNameUsed = null
|
||||||
let paletteDataUsed = null
|
let paletteDataUsed = null
|
||||||
|
|
Loading…
Reference in a new issue