1
0
mirror of https://github.com/kihashi/stardew_community_checklist.git synced 2025-10-19 08:03:17 +00:00

Settings fully working

This commit is contained in:
lachie-underhill 2023-06-02 15:33:42 +10:00
parent b82af3e12d
commit 7e67a53a01
No known key found for this signature in database
GPG Key ID: 48057E0D2C37AC20
2 changed files with 10 additions and 61 deletions

View File

@ -1,65 +1,16 @@
<script setup lang="ts">
defineProps(['modelValue'])
defineEmits(['update:modelValue'])
</script>
<template> <template>
<button <button
class="button is-rounded" class="button is-rounded"
:class="shouldBeChecked ? checked_class : unchecked_class" :class="modelValue ? 'is-info' : ''"
v-on:click="updateInput" @click="$emit('update:modelValue', !modelValue)"
> >
<slot></slot> <slot></slot>
</button> </button>
</template> </template>
<script>
export default {
name: 'button-checkbox',
model: {
prop: 'checked',
event: 'change'
},
props: {
checked_class: {
default: 'is-info'
},
unchecked_class: {
default: ''
},
checked: {
default: false
},
value: String,
trueValue: {
default: true
},
falseValue: {
default: false
}
},
computed: {
shouldBeChecked() {
if (this.checked instanceof Array) {
return this.checked.includes(this.value)
}
return this.checked === this.trueValue
}
},
methods: {
updateInput() {
if (this.checked instanceof Array) {
let newValue = [...this.checked]
if (!this.shouldBeChecked) {
newValue.push(this.value)
} else {
newValue.splice(newValue.indexOf(this.value), 1)
}
this.$emit('change', newValue)
} else {
this.$emit('change', this.shouldBeChecked ? this.falseValue : this.trueValue)
}
}
}
}
</script>
<style></style> <style></style>

View File

@ -39,13 +39,11 @@ function onDelete() {
<div class="container"> <div class="container">
<h2 class="subtitle">Spoilers and Displayed Items</h2> <h2 class="subtitle">Spoilers and Displayed Items</h2>
<div class="field"> <div class="field">
<ButtonCheckbox v-model="store.HideCompleted" :checked="store.HideCompleted"> <ButtonCheckbox v-model="store.HideCompleted"> Hide Completed </ButtonCheckbox>
Hide Completed
</ButtonCheckbox>
<p class="help">Hides items that have been turned in to the community center.</p> <p class="help">Hides items that have been turned in to the community center.</p>
</div> </div>
<div class="field"> <div class="field">
<button-checkbox v-model="store.HideSpoilers"> Hide Spoilers </button-checkbox> <ButtonCheckbox v-model="store.HideSpoilers"> Hide Spoilers </ButtonCheckbox>
<p class="help">Hides things that are considered spoilers, as defined below.</p> <p class="help">Hides things that are considered spoilers, as defined below.</p>
</div> </div>
<label class="label"> Spoilers </label> <label class="label"> Spoilers </label>
@ -86,7 +84,7 @@ function onDelete() {
those. those.
</p> </p>
<div class="field"> <div class="field">
<button-checkbox v-model="store.CompactView"> Use Compact View </button-checkbox> <ButtonCheckbox v-model="store.CompactView"> Use Compact View </ButtonCheckbox>
<p class="help">Enables a compact tabular view for item information.</p> <p class="help">Enables a compact tabular view for item information.</p>
</div> </div>
</div> </div>