22.02 Add a Loading View for the Todo Page

This commit is contained in:
Fredrick W. Warren 2021-02-15 09:02:15 -08:00
parent f6de60571b
commit 13559be43a
2 changed files with 44 additions and 33 deletions

View File

@ -3,41 +3,47 @@
<div class="q-pa-md absolute full-width full-height column">
<div class="row q-mb-lg">
<search />
<sort />
</div>
<template v-if="tasksDownloaded">
<div class="row q-mb-lg">
<search />
<sort />
</div>
<q-scroll-area class="q-scroll-area-tasks">
<p
v-if="search && !Object.keys(tasksTodo).length && !Object.keys(tasksCompleted).length">
No Search Results
</p>
<noTasks
v-if="!Object.keys(tasksTodo).length && !search && !settings.showTasksInOnelist" />
<q-scroll-area class="q-scroll-area-tasks">
<p
v-if="search && !Object.keys(tasksTodo).length && !Object.keys(tasksCompleted).length">
No Search Results
</p>
<noTasks
v-if="!Object.keys(tasksTodo).length && !search && !settings.showTasksInOnelist" />
<tasks-todo
v-if="Object.keys(tasksTodo).length"
:tasksTodo="tasksTodo" />
<tasks-todo
v-if="Object.keys(tasksTodo).length"
:tasksTodo="tasksTodo" />
<tasks-completed
v-if="Object.keys(tasksCompleted).length"
:tasksCompleted="tasksCompleted"
class="q-mb-xl" />
</q-scroll-area>
<tasks-completed
v-if="Object.keys(tasksCompleted).length"
:tasksCompleted="tasksCompleted"
class="q-mb-xl" />
</q-scroll-area>
<div class="absolute-bottom text-center q-mb-lg no-pointer-events">
<q-btn
@click="showAddTask = true"
round
class="all-pointer-events"
color="primary"
size="24px"
icon="add"
/>
</div>
<div class="absolute-bottom text-center q-mb-lg no-pointer-events">
<q-btn
@click="showAddTask = true"
round
class="all-pointer-events"
color="primary"
size="24px"
icon="add"
/>
</div>
</template>
</div>
<template v-else>
<p>Loading...</p>
</template>
</div>
<q-dialog v-model="showAddTask">
<add-task @close="showAddTask = false" />
@ -73,7 +79,7 @@ export default {
computed: {
...mapGetters('tasks', ['tasksTodo', 'tasksCompleted']),
...mapGetters('settings', ['settings']),
...mapState('tasks', ['search'])
...mapState('tasks', ['search', 'tasksDownloaded'])
},
mounted () {
this.$root.$on('showAddTask', () => {

View File

@ -26,7 +26,8 @@ const state = {
*/
},
search: '',
sort: 'name'
sort: 'name',
tasksDownloaded: false
}
const mutations = {
@ -44,7 +45,11 @@ const mutations = {
},
setSort (state, value) {
state.sort = value
}
},
setTasksDownloaded (state, value) {
state.tasksDownloaded = value
},
}
const actions = {