Profectus/src/components/system/Options.vue

101 lines
2.6 KiB
Vue
Raw Normal View History

2021-05-22 20:29:06 +00:00
<template>
<Modal :show="show" @close="$emit('closeDialog', 'Options')">
<div slot="header">
<h2>Options</h2>
</div>
<div slot="body">
<div class="actions">
2021-06-12 04:38:16 +00:00
<button class="button" @click="save">Manually Save</button>
2021-06-16 04:46:34 +00:00
<button @click="exportSave" class="button">Export</button>
2021-06-12 04:38:16 +00:00
<button @click="importSave" class="button danger">Import</button>
<button @click="hardReset" class="button danger">Hard Reset</button>
2021-05-22 20:29:06 +00:00
</div>
2021-06-12 04:38:16 +00:00
<Select title="Theme" :options="themes" :value="theme" @change="setTheme" default="classic" />
<Select title="Show Milestones" :options="msDisplayOptions" :value="msDisplay" @change="setMSDisplay" default="all" />
2021-05-22 20:29:06 +00:00
<Toggle title="Autosave" :value="autosave" @change="toggleOption('autosave')" />
<Toggle title="Offline Production" :value="offlineProd" @change="toggleOption('offlineProd')" />
<Toggle title="Show TPS" :value="showTPS" @change="toggleOption('showTPS')" />
2021-06-12 04:38:16 +00:00
<Toggle title="Hide Maxed Challenges" :value="hideChallenges" @change="toggleOption('hideChallenges')" />
2021-05-22 20:29:06 +00:00
</div>
</Modal>
</template>
<script>
2021-05-26 01:57:02 +00:00
import themes from '../../data/themes';
import { camelToTitle } from '../../util/common';
2021-05-22 20:29:06 +00:00
import { mapState } from 'vuex';
2021-05-26 01:57:02 +00:00
import { player } from '../../store/proxies';
2021-05-22 20:29:06 +00:00
export default {
name: 'Options',
props: {
show: Boolean
},
data() {
return {
2021-06-12 04:38:16 +00:00
themes: Object.keys(themes).map(theme => ({ label: camelToTitle(theme), value: theme })),
msDisplayOptions: [ "all", "last", "configurable", "incomplete", "none" ]
.map(option => ({ label: camelToTitle(option), value: option }))
}
},
computed: {
...mapState([ "autosave", "offlineProd", "showTPS", "hideChallenges" ]),
theme() {
return { label: camelToTitle(player.theme), value: player.theme };
},
msDisplay() {
return { label: camelToTitle(player.msDisplay), value: player.msDisplay };
2021-05-22 20:29:06 +00:00
}
},
methods: {
toggleOption(option) {
2021-05-26 01:57:02 +00:00
player[option] = !player[option];
2021-05-22 20:29:06 +00:00
},
setTheme(theme) {
2021-05-26 01:57:02 +00:00
player.theme = theme;
2021-05-22 20:29:06 +00:00
},
2021-06-12 04:38:16 +00:00
setMSDisplay(msDisplay) {
player.msDisplay = msDisplay;
},
2021-05-22 20:29:06 +00:00
save() {
console.warn("Not yet implemented!");
2021-05-22 20:29:06 +00:00
},
hardReset() {
console.warn("Not yet implemented!");
2021-05-22 20:29:06 +00:00
},
exportSave() {
console.warn("Not yet implemented!");
2021-05-22 20:29:06 +00:00
},
importSave() {
console.warn("Not yet implemented!");
2021-05-22 20:29:06 +00:00
}
}
};
</script>
<style scoped>
.actions {
display: flex;
justify-content: space-between;
padding-bottom: 10px;
}
.actions * {
margin: 0;
}
.danger {
border: solid 2px var(--danger);
padding-right: 0;
}
.danger::after {
content: "!";
color: white;
background: var(--danger);
padding: 2px;
margin-left: 6px;
height: 100%;
}
</style>