🎨
This commit is contained in:
@ -219,7 +219,10 @@ export default Vue.extend({
|
||||
try {
|
||||
theme = JSON5.parse(code);
|
||||
} catch (e) {
|
||||
alert('%i18n:@invalid-theme%');
|
||||
this.$swal({
|
||||
type: 'error',
|
||||
text: '%i18n:@invalid-theme%'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -229,12 +232,18 @@ export default Vue.extend({
|
||||
}
|
||||
|
||||
if (theme.id == null) {
|
||||
alert('%i18n:@invalid-theme%');
|
||||
this.$swal({
|
||||
type: 'error',
|
||||
text: '%i18n:@invalid-theme%'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.$store.state.device.themes.some(t => t.id == theme.id)) {
|
||||
alert('%i18n:@already-installed%');
|
||||
this.$swal({
|
||||
type: 'info',
|
||||
text: '%i18n:@already-installed%'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -243,7 +252,10 @@ export default Vue.extend({
|
||||
key: 'themes', value: themes
|
||||
});
|
||||
|
||||
alert('%i18n:@installed%'.replace('{}', theme.name));
|
||||
this.$swal({
|
||||
type: 'success',
|
||||
text: '%i18n:@installed%'.replace('{}', theme.name)
|
||||
});
|
||||
},
|
||||
|
||||
uninstall() {
|
||||
@ -252,7 +264,11 @@ export default Vue.extend({
|
||||
this.$store.commit('device/set', {
|
||||
key: 'themes', value: themes
|
||||
});
|
||||
alert('%i18n:@uninstalled%'.replace('{}', theme.name));
|
||||
|
||||
this.$swal({
|
||||
type: 'info',
|
||||
text: '%i18n:@uninstalled%'.replace('{}', theme.name)
|
||||
});
|
||||
},
|
||||
|
||||
import_() {
|
||||
@ -284,16 +300,26 @@ export default Vue.extend({
|
||||
|
||||
gen() {
|
||||
const theme = this.myTheme;
|
||||
|
||||
if (theme.name == null || theme.name.trim() == '') {
|
||||
alert('%i18n:@theme-name-required%');
|
||||
this.$swal({
|
||||
type: 'warning',
|
||||
text: '%i18n:@theme-name-required%'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
theme.id = uuid();
|
||||
|
||||
const themes = this.$store.state.device.themes.concat(theme);
|
||||
this.$store.commit('device/set', {
|
||||
key: 'themes', value: themes
|
||||
});
|
||||
alert('%i18n:@saved%');
|
||||
|
||||
this.$swal({
|
||||
type: 'success',
|
||||
text: '%i18n:@saved%'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user