Rename action to cmd

This commit is contained in:
kolaente 2021-05-30 16:49:02 +02:00
parent d8650c9570
commit af1eb8ca43
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 29 additions and 29 deletions

View File

@ -1,9 +1,9 @@
<template> <template>
<modal v-if="active" class="quick-actions"> <modal v-if="active" class="quick-actions">
<div class="card"> <div class="card">
<div class="action-input" :class="{'has-action': selectedAction !== null}"> <div class="action-input" :class="{'has-active-cmd': selectedCmd !== null}">
<div class="selected-action tag" v-if="selectedAction !== null"> <div class="active-cmd tag" v-if="selectedCmd !== null">
{{ selectedAction.title }} {{ selectedCmd.title }}
</div> </div>
<input <input
v-focus v-focus
@ -14,7 +14,7 @@
@keyup="search" @keyup="search"
ref="searchInput" ref="searchInput"
@keydown.down.prevent="() => select(0, 0)" @keydown.down.prevent="() => select(0, 0)"
@keyup.prevent.delete="() => selectedAction = null" @keyup.prevent.delete="() => selectedCmd = null"
/> />
</div> </div>
@ -48,38 +48,38 @@ import TaskService from '@/services/task'
const TYPE_LIST = 'list' const TYPE_LIST = 'list'
const TYPE_TASK = 'task' const TYPE_TASK = 'task'
const TYPE_ACTION = 'action' const TYPE_CMD = 'cmd'
const TYPE_TEAM = 'team' const TYPE_TEAM = 'team'
const ACTION_NEW_TASK = 'newTask' const CMD_NEW_TASK = 'newTask'
const ACTION_NEW_LIST = 'newList' const CMD_NEW_LIST = 'newList'
const ACTION_NEW_NAMESPACE = 'newNamespace' const CMD_NEW_NAMESPACE = 'newNamespace'
const ACTION_NEW_TEAM = 'newTeam' const CMD_NEW_TEAM = 'newTeam'
export default { export default {
name: 'quick-actions', name: 'quick-actions',
data() { data() {
return { return {
query: '', query: '',
availableActions: [ availableCmds: [
{ {
title: 'New task', title: 'New task',
action: ACTION_NEW_TASK, action: CMD_NEW_TASK,
}, },
{ {
title: 'New list', title: 'New list',
action: ACTION_NEW_LIST, action: CMD_NEW_LIST,
}, },
{ {
title: 'New namespace', title: 'New namespace',
action: ACTION_NEW_NAMESPACE, action: CMD_NEW_NAMESPACE,
}, },
{ {
title: 'New Team', title: 'New Team',
action: ACTION_NEW_TEAM, action: CMD_NEW_TEAM,
}, },
], ],
selectedAction: null, selectedCmd: null,
foundTasks: [], foundTasks: [],
taskSearchTimeout: null, taskSearchTimeout: null,
@ -95,14 +95,14 @@ export default {
return l.title.toLowerCase().includes(this.query.toLowerCase()) return l.title.toLowerCase().includes(this.query.toLowerCase())
}) ?? []) }) ?? [])
const actions = this.availableActions const cmds = this.availableCmds
.filter(a => a.title.toLowerCase().includes(this.query.toLowerCase())) .filter(a => a.title.toLowerCase().includes(this.query.toLowerCase()))
return [ return [
{ {
type: TYPE_ACTION, type: TYPE_CMD,
title: 'Actions', title: 'Commands',
items: actions, items: cmds,
}, },
{ {
type: TYPE_TASK, type: TYPE_TASK,
@ -128,15 +128,15 @@ export default {
return this.taskService.loading return this.taskService.loading
}, },
placeholder() { placeholder() {
if (this.selectedAction !== null) { if (this.selectedCmd !== null) {
switch (this.selectedAction.action) { switch (this.selectedCmd.action) {
case ACTION_NEW_TASK: case CMD_NEW_TASK:
return 'Enter the title of the new task...' return 'Enter the title of the new task...'
case ACTION_NEW_LIST: case CMD_NEW_LIST:
return 'Enter the title of the new list...' return 'Enter the title of the new list...'
case ACTION_NEW_TEAM: case CMD_NEW_TEAM:
return 'Enter the title of the new team...' return 'Enter the title of the new team...'
case ACTION_NEW_NAMESPACE: case CMD_NEW_NAMESPACE:
return 'Enter the title of the new namespace...' return 'Enter the title of the new namespace...'
} }
} }
@ -180,9 +180,9 @@ export default {
case TYPE_TASK: case TYPE_TASK:
this.$router.push({name: 'task.detail', params: {id: item.id}}) this.$router.push({name: 'task.detail', params: {id: item.id}})
break break
case TYPE_ACTION: case TYPE_CMD:
this.query = '' this.query = ''
this.selectedAction = item this.selectedCmd = item
this.$refs.searchInput.focus() this.$refs.searchInput.focus()
break break
} }

View File

@ -14,11 +14,11 @@
font-size: 1.5rem; font-size: 1.5rem;
} }
&.has-action .input { &.has-active-cmd .input {
padding-left: .5rem; padding-left: .5rem;
} }
.selected-action { .active-cmd {
font-size: 1.25rem; font-size: 1.25rem;
margin-left: .5rem; margin-left: .5rem;
} }