Improve usability

This commit is contained in:
syuilo 2018-10-08 15:23:10 +09:00
parent 73bae3751e
commit 25f7e00a66
4 changed files with 25 additions and 3 deletions

View file

@ -288,6 +288,8 @@ common/views/components/media-banner.vue:
common/views/components/theme.vue: common/views/components/theme.vue:
light-theme: "非ダークモード時に使用するテーマ" light-theme: "非ダークモード時に使用するテーマ"
dark-theme: "ダークモード時に使用するテーマ" dark-theme: "ダークモード時に使用するテーマ"
light-themes: "明るいテーマ"
dark-themes: "暗いテーマ"
install-a-theme: "テーマのインストール" install-a-theme: "テーマのインストール"
theme-code: "テーマコード" theme-code: "テーマコード"
install: "インストール" install: "インストール"

View file

@ -3,14 +3,24 @@
<label> <label>
<span>%i18n:@light-theme%</span> <span>%i18n:@light-theme%</span>
<ui-select v-model="light" placeholder="%i18n:@light-theme%"> <ui-select v-model="light" placeholder="%i18n:@light-theme%">
<option v-for="x in themes" :value="x.id" :key="x.id">{{ x.name }}</option> <optgroup label="%i18n:@light-themes%">
<option v-for="x in lightThemes" :value="x.id" :key="x.id">{{ x.name }}</option>
</optgroup>
<optgroup label="%i18n:@dark-themes%">
<option v-for="x in darkThemes" :value="x.id" :key="x.id">{{ x.name }}</option>
</optgroup>
</ui-select> </ui-select>
</label> </label>
<label> <label>
<span>%i18n:@dark-theme%</span> <span>%i18n:@dark-theme%</span>
<ui-select v-model="dark" placeholder="%i18n:@dark-theme%"> <ui-select v-model="dark" placeholder="%i18n:@dark-theme%">
<option v-for="x in themes" :value="x.id" :key="x.id">{{ x.name }}</option> <optgroup label="%i18n:@dark-themes%">
<option v-for="x in darkThemes" :value="x.id" :key="x.id">{{ x.name }}</option>
</optgroup>
<optgroup label="%i18n:@light-themes%">
<option v-for="x in lightThemes" :value="x.id" :key="x.id">{{ x.name }}</option>
</optgroup>
</ui-select> </ui-select>
</label> </label>
@ -120,7 +130,15 @@ export default Vue.extend({
computed: { computed: {
themes(): Theme[] { themes(): Theme[] {
return this.$store.state.device.themes.concat(builtinThemes); return builtinThemes.concat(this.$store.state.device.themes);
},
darkThemes(): Theme[] {
return this.themes.filter(t => t.base == 'dark' || t.kind == 'dark');
},
lightThemes(): Theme[] {
return this.themes.filter(t => t.base == 'light' || t.kind == 'light');
}, },
installedThemes(): Theme[] { installedThemes(): Theme[] {

View file

@ -4,6 +4,7 @@
name: 'Dark', name: 'Dark',
author: 'syuilo', author: 'syuilo',
desc: 'Default dark theme', desc: 'Default dark theme',
kind: 'dark',
vars: { vars: {
primary: '#fb4e4e', primary: '#fb4e4e',

View file

@ -4,6 +4,7 @@
name: 'Light', name: 'Light',
author: 'syuilo', author: 'syuilo',
desc: 'Default light theme', desc: 'Default light theme',
kind: 'light',
vars: { vars: {
primary: '#fb4e4e', primary: '#fb4e4e',