This commit is contained in:
syuilo 2018-10-10 21:23:38 +09:00
parent 40d2e3e97c
commit 1fad3cbaae
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
3 changed files with 57 additions and 15 deletions

View File

@ -131,15 +131,28 @@ pre
[data-fa] [data-fa]
display inline-block display inline-block
.swal2-container
z-index 10000 !important
&.swal2-shown
background-color rgba(0, 0, 0, 0.5) !important
.swal2-popup .swal2-popup
background var(--face) !important background var(--face) !important
.swal-icon-only .swal2-content
width 180px !important color var(--text) !important
> .swal2-header .swal2-confirm
> .swal2-icon background-color var(--primary) !important
margin 1.25em auto 1.875em border-left-color var(--primary) !important
border-right-color var(--primary) !important
color var(--primaryForeground) !important
> .swal2-title &:hover
display none background-image none !important
background-color var(--primaryDarken5) !important
&:active
background-image none !important
background-color var(--primaryDarken5) !important

View File

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

View File

@ -170,7 +170,10 @@ export default Vue.extend({
this.$store.state.i.bannerUrl = i.bannerUrl; this.$store.state.i.bannerUrl = i.bannerUrl;
if (notify) { if (notify) {
alert('%i18n:@saved%'); this.$swal({
type: 'success',
text: '%i18n:@saved%'
});
} }
}); });
} }