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

Add Ability to Hide Completed (#108)

* Disable ES Lint warning

* Add methods to filter competled bundles

* Add completed items filter
This commit is contained in:
John Cleaver 2019-03-08 20:35:44 -05:00 committed by GitHub
parent 409bc00101
commit af65ee9378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -26,7 +26,7 @@
<!-- </section>
<section class="section"> -->
<div class="columns is-multiline">
<div class="column is-3 is-flex" v-for="bundleitem in bundle.items" :key="bundleitem.id">
<div class="column is-3 is-flex" v-for="bundleitem in bundleItems" :key="bundleitem.id">
<item-card :item="bundleitem.item"></item-card>
</div>
</div>
@ -44,6 +44,14 @@ export default {
},
hideBundleItems: function () {
return this.$store.state.HideSpoilers && this.$store.state.BundleRewardsSpoilers
},
bundleItems: function () {
return this.bundle.items.filter(item => !(this.$store.state.HideCompleted && this.isItemComplete(item)))
}
},
methods: {
isItemComplete: function (item) {
return item.item.bundles.every(this.$store.getters.IsBundleItemRedeemed)
}
},
components: {

View File

@ -42,6 +42,7 @@ export default {
var self = this
return _.orderBy(
self.$store.state.items
.filter(item => !(this.$store.state.HideCompleted && this.isItemComplete(item)))
.filter(item => item.name.toLowerCase().indexOf(self.search.name_filter.toLowerCase()) !== -1)
.filter(item => this.FilterSeasons(item.seasons.map(ssn => ssn.id), this.search.season_filter))
.filter(item => this.FilterSkills(item.skills.map(skl => skl.id), this.search.skill_filter))
@ -96,6 +97,9 @@ export default {
}
return false
}
},
isItemComplete: function (item) {
return item.bundles.every(this.$store.getters.IsBundleItemRedeemed)
}
}

View File

@ -81,6 +81,7 @@ export default new Vuex.Store({
})
function getById (array, id) {
// eslint-disable-next-line
return array.find(x => x.id == id)
}