From 1fad3cbaaebf077c2eef9d0b7dcc816106bf63f0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 10 Oct 2018 21:23:38 +0900 Subject: [PATCH] :art: --- src/client/app/app.styl | 27 +++++++++---- .../app/common/views/components/theme.vue | 40 +++++++++++++++---- .../views/pages/settings/settings.profile.vue | 5 ++- 3 files changed, 57 insertions(+), 15 deletions(-) diff --git a/src/client/app/app.styl b/src/client/app/app.styl index 574ec306e2..725147f251 100644 --- a/src/client/app/app.styl +++ b/src/client/app/app.styl @@ -131,15 +131,28 @@ pre [data-fa] display inline-block +.swal2-container + z-index 10000 !important + + &.swal2-shown + background-color rgba(0, 0, 0, 0.5) !important + .swal2-popup background var(--face) !important -.swal-icon-only - width 180px !important +.swal2-content + color var(--text) !important - > .swal2-header - > .swal2-icon - margin 1.25em auto 1.875em +.swal2-confirm + background-color var(--primary) !important + border-left-color var(--primary) !important + border-right-color var(--primary) !important + color var(--primaryForeground) !important - > .swal2-title - display none + &:hover + background-image none !important + background-color var(--primaryDarken5) !important + + &:active + background-image none !important + background-color var(--primaryDarken5) !important diff --git a/src/client/app/common/views/components/theme.vue b/src/client/app/common/views/components/theme.vue index 26e8148755..c1c73b97cd 100644 --- a/src/client/app/common/views/components/theme.vue +++ b/src/client/app/common/views/components/theme.vue @@ -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%' + }); } } }); diff --git a/src/client/app/mobile/views/pages/settings/settings.profile.vue b/src/client/app/mobile/views/pages/settings/settings.profile.vue index 127f531902..77c59faf37 100644 --- a/src/client/app/mobile/views/pages/settings/settings.profile.vue +++ b/src/client/app/mobile/views/pages/settings/settings.profile.vue @@ -170,7 +170,10 @@ export default Vue.extend({ this.$store.state.i.bannerUrl = i.bannerUrl; if (notify) { - alert('%i18n:@saved%'); + this.$swal({ + type: 'success', + text: '%i18n:@saved%' + }); } }); }