15,06 Add a Show tasks in one list Setting

This commit is contained in:
Fredrick W Warren 2021-02-11 16:40:59 -08:00
parent 2f72c80175
commit 92a7f0df0d
5 changed files with 56 additions and 8 deletions

View File

@ -4,8 +4,13 @@
enter-active-class="animated zoomIn" enter-active-class="animated zoomIn"
leave-active-class="animated zoomOut" leave-active-class="animated zoomOut"
> >
<div class="q-mt-lg"> <div
<list-header bgColor="bg-green-4">Completed</list-header> :class="{ 'q-mt-lg' : !settings.showTasksInOnelist }"
>
<list-header
v-if="!settings.showTasksInOnelist"
bgColor="bg-green-4"
>Completed</list-header>
<q-list <q-list
separator separator
bordered> bordered>
@ -22,6 +27,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
import task from 'components/Tasks/Task.vue' import task from 'components/Tasks/Task.vue'
import listHeader from 'components/Shared/ListHeader.vue' import listHeader from 'components/Shared/ListHeader.vue'
@ -33,7 +39,10 @@ export default {
}, },
props: [ props: [
'tasksCompleted' 'tasksCompleted'
] ],
computed: {
...mapGetters('settings', ['settings'])
}
} }
</script> </script>

View File

@ -5,7 +5,10 @@
leave-active-class="animated zoomOut absolute-top" leave-active-class="animated zoomOut absolute-top"
> >
<div> <div>
<list-header bgColor="bg-orange-4">Todo</list-header> <list-header
v-if="!settings.showTasksInOnelist"
bgColor="bg-orange-4"
>Todo</list-header>
<q-list <q-list
separator separator
bordered> bordered>
@ -23,6 +26,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
import task from 'components/Tasks/Task.vue' import task from 'components/Tasks/Task.vue'
import listHeader from 'components/Shared/ListHeader.vue' import listHeader from 'components/Shared/ListHeader.vue'
@ -34,7 +38,10 @@ export default {
}, },
props: [ props: [
'tasksTodo' 'tasksTodo'
] ],
computed: {
...mapGetters('settings', ['settings'])
}
} }
</script> </script>

View File

@ -14,6 +14,19 @@
/> />
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item tag="label" v-ripple>
<q-item-section>
<q-item-label>Show tasks in one list</q-item-label>
</q-item-section>
<q-item-section side >
<q-toggle
color="blue"
v-model="showTasksInOnelist"
/>
</q-item-section>
</q-item>
</q-list> </q-list>
</q-page> </q-page>
</template> </template>
@ -32,10 +45,21 @@ export default {
set (value) { set (value) {
this.setShow12HourTimeFormat(value) this.setShow12HourTimeFormat(value)
} }
},
showTasksInOnelist: {
get () {
return this.settings.showTasksInOnelist
},
set (value) {
this.setShowTasksInOnelist(value)
}
} }
}, },
methods: { methods: {
...mapActions('settings', ['setShow12HourTimeFormat']) ...mapActions('settings', [
'setShow12HourTimeFormat',
'setShowTasksInOnelist'
])
} }
} }
</script> </script>

View File

@ -14,7 +14,7 @@
No Search Results No Search Results
</p> </p>
<noTasks <noTasks
v-if="!Object.keys(tasksTodo).length && !search" /> v-if="!Object.keys(tasksTodo).length && !search && !settings.showTasksInOnelist" />
<tasks-todo <tasks-todo
v-if="Object.keys(tasksTodo).length" v-if="Object.keys(tasksTodo).length"
@ -72,6 +72,7 @@ export default {
}, },
computed: { computed: {
...mapGetters('tasks', ['tasksTodo', 'tasksCompleted']), ...mapGetters('tasks', ['tasksTodo', 'tasksCompleted']),
...mapGetters('settings', ['settings']),
...mapState('tasks', ['search']) ...mapState('tasks', ['search'])
}, },
mounted () { mounted () {

View File

@ -1,18 +1,25 @@
const state = { const state = {
settings: { settings: {
show12HourTimeFormat: false show12HourTimeFormat: false,
showTasksInOnelist: false
} }
} }
const mutations = { const mutations = {
setShow12HourTimeFormat (state, value) { setShow12HourTimeFormat (state, value) {
state.settings.show12HourTimeFormat = value state.settings.show12HourTimeFormat = value
},
setShowTasksInOnelist (state, value) {
state.settings.showTasksInOnelist = value
} }
} }
const actions = { const actions = {
setShow12HourTimeFormat ({ commit }, value) { setShow12HourTimeFormat ({ commit }, value) {
commit('setShow12HourTimeFormat', value) commit('setShow12HourTimeFormat', value)
},
setShowTasksInOnelist ({ commit }, value) {
commit('setShowTasksInOnelist', value)
} }
} }