This repository has been archived on 2024-03-13. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
timekeeper/components/MissionButton.vue

34 lines
702 B
Vue
Raw Normal View History

<template>
<progress-button
:label="mission.name"
:description="mission.description"
:max="max"
:value="value"
@click="complete"
/>
</template>
<script>
export default {
props: {
mission: { type: Object, required: true },
},
computed: {
value() {
return 'cost' in this.mission.completionCriteria
? this.$store.state.currency
: this.$store.state.playerAge
},
max() {
return 'cost' in this.mission.completionCriteria
? this.mission.completionCriteria.cost
: this.$store.state.playerAgeMax
},
},
methods: {
complete() {
this.$store.commit('completeMission', this.mission)
},
},
}
</script>