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

#139 compact view (#144)

* Add styles to better display tag lists

* Add components to display data in a table

* Add compact view setting

* Fix spelling

* Add table view if enabled
This commit is contained in:
John Cleaver 2019-12-05 14:51:37 -05:00 committed by GitHub
parent 19570bc266
commit 47b50394c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 228 additions and 11 deletions

View File

@ -55,6 +55,24 @@
</div> </div>
</div> </div>
</section> </section>
<section class="section">
<div class="container">
<h2 class="subtitle">
Compact View
</h2>
<p class="content">
Enable a more compact table view instead of the card view.
Note that this may result in horizontal scrolling on smaller (phone-sized) devices.
The card view is recommended for those.
</p>
<div class="field">
<button-checkbox v-model="CompactView">
Use Compact View
</button-checkbox>
<p class="help">Enables a compact tabular view for item information.</p>
</div>
</div>
</section>
<section class="section"> <section class="section">
<div class="container"> <div class="container">
<h2 class="subtitle"> <h2 class="subtitle">
@ -188,6 +206,14 @@ export default {
this.$store.commit('toggleSkills') this.$store.commit('toggleSkills')
} }
}, },
CompactView: {
get () {
return this.$store.state.CompactView
},
set (newValue) {
this.$store.commit('toggleCompactView')
}
},
SavedData: function () { SavedData: function () {
return this.$store.getters.GetSerializedState return this.$store.getters.GetSerializedState
} }

View File

@ -23,12 +23,9 @@
<progress class="progress is-info" :value="GetRoomItemsRedeemed(bundle.room)" :max="bundle.room.items_required" /> <progress class="progress is-info" :value="GetRoomItemsRedeemed(bundle.room)" :max="bundle.room.items_required" />
</div> </div>
</div> </div>
<!-- Room Progress -->
<!-- Bundle Progress -->
<!-- </section>
<section class="section"> -->
<div class="columns is-multiline"> <div class="columns is-multiline">
<div class="column is-3-widescreen is-4-desktop is-12-mobile is-6-tablet is-flex" v-for="bundleitem in bundleItems" :key="bundleitem.id"> <item-table v-if="CompactView" :items="bundleItems.map(i => i.item)" />
<div v-else class="column is-3-widescreen is-4-desktop is-12-mobile is-6-tablet is-flex" v-for="bundleitem in bundleItems" :key="bundleitem.id">
<item-card :item="bundleitem.item"></item-card> <item-card :item="bundleitem.item"></item-card>
</div> </div>
</div> </div>
@ -38,6 +35,7 @@
<script> <script>
import ItemCard from '@/components/item_card/ItemCard' import ItemCard from '@/components/item_card/ItemCard'
import ItemTable from '@/components/item_table/ItemTable.vue'
export default { export default {
name: 'bundle-items', name: 'bundle-items',
computed: { computed: {
@ -49,6 +47,9 @@ export default {
}, },
bundleItems: function () { bundleItems: function () {
return this.bundle.items.filter(item => !(this.$store.state.HideCompleted && this.isItemComplete(item))) return this.bundle.items.filter(item => !(this.$store.state.HideCompleted && this.isItemComplete(item)))
},
CompactView () {
return this.$store.state.CompactView
} }
}, },
methods: { methods: {
@ -59,7 +60,8 @@ export default {
GetRoomItemsRedeemed: function (room) { return this.$store.getters.GetRoomItemsRedeemed(room) } GetRoomItemsRedeemed: function (room) { return this.$store.getters.GetRoomItemsRedeemed(room) }
}, },
components: { components: {
ItemCard ItemCard,
ItemTable
} }
} }
</script> </script>

View File

@ -44,5 +44,8 @@ export default {
</script> </script>
<style scoped> <style scoped>
.tags {
justify-content: center;
flex-wrap: no-wrap;
}
</style> </style>

View File

@ -20,5 +20,9 @@ export default {
</script> </script>
<style scoped> <style scoped>
.tags {
justify-content: center;
flex-wrap: nowrap;
}
</style> </style>

View File

@ -0,0 +1,53 @@
<template>
<table class="table is-bordered is-striped is-narrow is-fullwidth">
<thead>
<tr>
<th>
Item
</th>
<th>
Source
</th>
<th>
Seasons
</th>
<th>
Skills
</th>
<th>
Bundles
</th>
</tr>
</thead>
<tbody>
<item-table-row v-for="item in items" :key="item.id" :item="item" />
</tbody>
</table>
</template>
<script>
import ItemTableRow from '@/components/item_table/ItemTableRow.vue'
export default {
name: 'ItemTable',
components: {
ItemTableRow
},
data () {
return {
}
},
props: {
items: {
type: Array
}
}
}
</script>
<style lang="scss" scoped>
table {
table-layout: fixed
}
</style>

View File

@ -0,0 +1,118 @@
<template>
<tr>
<td>
{{item.name}}
</td>
<td>
{{item.source}}
</td>
<td v-if="showSeasonList">
<season-list :seasons="item.seasons"/>
</td>
<td v-if="showSkillList">
<skill-list :skills="item.skills"/>
</td>
<td>
<bundle-button v-for="bundleItem in item.bundles" :key="bundleItem.id" :bundle-item="bundleItem" :item="item"/>
</td>
</tr>
</template>
<script>
import SeasonList from '../item_card/SeasonList'
import SkillList from '../item_card/SkillList'
import BundleButton from '../item_card/BundleButton'
export default {
name: 'ItemTable',
components: {
BundleButton,
SkillList,
SeasonList
},
data () {
return {
}
},
computed: {
showItemDesc: function () {
return !(this.$store.state.HideSpoilers && this.$store.state.ItemInfoSpoilers)
},
showSeasonList: function () {
return !(this.$store.state.HideSpoilers && this.$store.state.SeasonsSpoilers)
},
showSkillList: function () {
return !(this.$store.state.HideSpoilers && this.$store.state.SkillsSpoilers)
}
},
props: {
item: {
type: Object,
default: function () {
return {
id: 22,
name: 'Purple Mushroom',
source: 'Can be found in the mines or in the farm cave if you selected the mushroom perk.',
seasons: [
{
id: 'spring',
order: 0,
name: 'Spring'
},
{
id: 'summer',
order: 1,
name: 'Summer'
},
{
id: 'fall',
order: 2,
name: 'Fall'
},
{
id: 'winter',
order: 3,
name: 'Winter'
}
],
skills: [
{
id: 'mining',
order: 1,
name: 'Mining'
},
{
id: 'foraging',
order: 2,
name: 'Foraging'
}
],
'bundles': [
{
'count': 1,
'bundle': {
id: 5,
name: 'Exotic Foraging Bundle',
room: 0,
reward: 'Autumn\'s Bounty (5)'
},
'id': 24
},
{
'count': 1,
'bundle': {
id: 23,
name: 'Field Research Bundle',
room: 4,
reward: 'Recycling Machine'
},
'id': 25
}
]
}
}
}
}
}
</script>

View File

@ -3,7 +3,8 @@
<search-form v-model="search"></search-form> <search-form v-model="search"></search-form>
<section class="container"> <section class="container">
<div class="columns is-multiline"> <div class="columns is-multiline">
<div class="column is-3-widescreen is-4-desktop is-12-mobile is-6-tablet is-flex" v-for="item in filtered_items" :key="item.id"> <item-table v-if="CompactView" :items="filtered_items" />
<div v-else class="column is-3-widescreen is-4-desktop is-12-mobile is-6-tablet is-flex" v-for="item in filtered_items" :key="item.id">
<item-card :item="item"></item-card> <item-card :item="item"></item-card>
</div> </div>
</div> </div>
@ -15,12 +16,14 @@
<script> <script>
import SearchForm from '@/components/search/SearchForm' import SearchForm from '@/components/search/SearchForm'
import ItemCard from '@/components/item_card/ItemCard' import ItemCard from '@/components/item_card/ItemCard'
import ItemTable from '@/components/item_table/ItemTable.vue'
import _ from 'lodash' import _ from 'lodash'
export default { export default {
name: 'search', name: 'search',
components: { components: {
SearchForm, SearchForm,
ItemCard ItemCard,
ItemTable
}, },
data () { data () {
return { return {
@ -49,6 +52,9 @@ export default {
, ,
'name' 'name'
) )
},
CompactView () {
return this.$store.state.CompactView
} }
}, },
methods: { methods: {

View File

@ -27,7 +27,8 @@ export default new Vuex.Store({
BundleRewardsSpoilers: true, BundleRewardsSpoilers: true,
ItemInfoSpoilers: true, ItemInfoSpoilers: true,
SeasonsSpoilers: true, SeasonsSpoilers: true,
SkillsSpoilers: true SkillsSpoilers: true,
CompactView: false
}, },
plugins: [ plugins: [
createPersistedState({ createPersistedState({
@ -39,7 +40,8 @@ export default new Vuex.Store({
BundleRewardsSpoilers: state.BundleRewardsSpoilers, BundleRewardsSpoilers: state.BundleRewardsSpoilers,
ItemInfoSpoilers: state.ItemInfoSpoilers, ItemInfoSpoilers: state.ItemInfoSpoilers,
SeasonsSpoilers: state.SeasonsSpoilers, SeasonsSpoilers: state.SeasonsSpoilers,
SkillsSpoilers: state.SkillsSpoilers SkillsSpoilers: state.SkillsSpoilers,
CompactView: state.CompactView
} }
) )
}) })
@ -106,6 +108,9 @@ export default new Vuex.Store({
toggleSkills (state) { toggleSkills (state) {
state.SkillsSpoilers = !state.SkillsSpoilers state.SkillsSpoilers = !state.SkillsSpoilers
}, },
toggleCompactView (state) {
state.CompactView = !state.CompactView
},
initState (state) { initState (state) {
Vue.set(state, 'seasons', prestate.seasons) Vue.set(state, 'seasons', prestate.seasons)
Vue.set(state, 'skills', prestate.skills) Vue.set(state, 'skills', prestate.skills)