Add hint text + some fixes

This commit is contained in:
kolaente 2021-05-30 17:43:34 +02:00
parent 455ccad3c4
commit 4566624df2
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 21 additions and 2 deletions

View File

@ -19,6 +19,10 @@
/>
</div>
<div class="has-text-grey-light p-4" v-if="hintText !== ''">
{{ hintText }}
</div>
<div class="results" v-if="selectedCmd === null">
<div v-for="(r, k) in results" :key="k" class="result">
<span class="result-title">
@ -143,6 +147,21 @@ export default {
return 'Type a command or search...'
},
hintText() {
let namespace
if (this.selectedCmd !== null) {
switch (this.selectedCmd.action) {
case CMD_NEW_TASK:
return `Create a task in the current list (${this.currentList.title})`
case CMD_NEW_LIST:
namespace = this.$store.getters['namespaces/getNamespaceById'](this.currentList.namespaceId)
return `Create a list in the current namespace (${namespace.title})`
}
}
return ''
},
currentList() {
return Object.keys(this.$store.state[CURRENT_LIST]).length === 0 ? null : this.$store.state[CURRENT_LIST]
},
@ -182,7 +201,7 @@ export default {
this.searchTasks()
},
searchTasks() {
if (this.query === '') {
if (this.query === '' || this.selectedCmd !== null) {
return
}

View File

@ -522,7 +522,7 @@ export default {
}
const list = this.$store.getters['namespaces/getListAndNamespaceById'](this.task.listId)
this.$store.commit(CURRENT_LIST, list)
this.$store.commit(CURRENT_LIST, list.list)
return list
},
canWrite() {