3963ed8ff7
* wip * tabun ok * better msg * oops * fix lint * Update gulpfile.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update src/client/scripts/set-i18n-contexts.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * refactor Co-authored-by: acid-chicken <root@acid-chicken.com> * ✨ * wip * fix lint * たぶんおk * fix flush * Translate Notification * remove console.log * fix * add notifications * remove san * wip * ok * ✌️ * Update src/prelude/array.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * wip * i18n refactor * Update init.ts * ✌️ Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
83 lines
2 KiB
Vue
83 lines
2 KiB
Vue
<template>
|
|
<section class="_card">
|
|
<div class="_title"><fa :icon="faListUl"/> {{ $t('sidebar') }}</div>
|
|
<div class="_content">
|
|
<mk-textarea v-model="items" tall>
|
|
<span>{{ $t('sidebar') }}</span>
|
|
<template #desc><button class="_textButton" @click="addItem">{{ $t('addItem') }}</button></template>
|
|
</mk-textarea>
|
|
</div>
|
|
<div class="_footer">
|
|
<mk-button inline @click="save()" primary><fa :icon="faSave"/> {{ $t('save') }}</mk-button>
|
|
<mk-button inline @click="reset()"><fa :icon="faRedo"/> {{ $t('default') }}</mk-button>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import Vue from 'vue';
|
|
import { faListUl, faSave, faRedo } from '@fortawesome/free-solid-svg-icons';
|
|
import MkButton from '../../components/ui/button.vue';
|
|
import MkTextarea from '../../components/ui/textarea.vue';
|
|
import { defaultDeviceUserSettings } from '../../store';
|
|
|
|
export default Vue.extend({
|
|
components: {
|
|
MkButton,
|
|
MkTextarea,
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
menuDef: this.$store.getters.nav({}),
|
|
items: '',
|
|
faListUl, faSave, faRedo
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
splited(): string[] {
|
|
return this.items.trim().split('\n').filter(x => x.trim() !== '');
|
|
}
|
|
},
|
|
|
|
created() {
|
|
this.items = this.$store.state.deviceUser.menu.join('\n');
|
|
},
|
|
|
|
methods: {
|
|
async addItem() {
|
|
const menu = Object.keys(this.menuDef).filter(k => !this.$store.state.deviceUser.menu.includes(k));
|
|
const { canceled, result: item } = await this.$root.dialog({
|
|
type: null,
|
|
title: this.$t('addItem'),
|
|
select: {
|
|
items: [...menu.map(k => ({
|
|
value: k, text: this.$t(this.menuDef[k].title)
|
|
})), ...[{
|
|
value: '-', text: this.$t('divider')
|
|
}]]
|
|
},
|
|
showCancelButton: true
|
|
});
|
|
if (canceled) return;
|
|
this.items = [...this.splited, item].join('\n');
|
|
this.save();
|
|
},
|
|
|
|
save() {
|
|
this.$store.commit('deviceUser/setMenu', this.splited);
|
|
},
|
|
|
|
reset() {
|
|
this.$store.commit('deviceUser/setMenu', defaultDeviceUserSettings.menu);
|
|
this.items = this.$store.state.deviceUser.menu.join('\n');
|
|
},
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
</style>
|