Add keyboard shortcuts
This commit is contained in:
parent
4566624df2
commit
4dcc377243
|
@ -37,6 +37,14 @@
|
||||||
|
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<update/>
|
<update/>
|
||||||
|
<a
|
||||||
|
@click="openQuickActions"
|
||||||
|
class="trigger-button pr-0"
|
||||||
|
@shortkey="openQuickActions"
|
||||||
|
v-shortkey="['ctrl', 'k']"
|
||||||
|
>
|
||||||
|
<icon icon="search"/>
|
||||||
|
</a>
|
||||||
<notifications/>
|
<notifications/>
|
||||||
<div class="user">
|
<div class="user">
|
||||||
<img :src="userAvatar" alt="" class="avatar"/>
|
<img :src="userAvatar" alt="" class="avatar"/>
|
||||||
|
@ -83,7 +91,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import {CURRENT_LIST} from '@/store/mutation-types'
|
import {CURRENT_LIST, QUICK_ACTIONS_ACTIVE} from '@/store/mutation-types'
|
||||||
import Rights from '@/models/rights.json'
|
import Rights from '@/models/rights.json'
|
||||||
import Update from '@/components/home/update'
|
import Update from '@/components/home/update'
|
||||||
import ListSettingsDropdown from '@/components/list/list-settings-dropdown'
|
import ListSettingsDropdown from '@/components/list/list-settings-dropdown'
|
||||||
|
@ -113,6 +121,9 @@ export default {
|
||||||
this.$store.dispatch('auth/logout')
|
this.$store.dispatch('auth/logout')
|
||||||
this.$router.push({name: 'user.login'})
|
this.$router.push({name: 'user.login'})
|
||||||
},
|
},
|
||||||
|
openQuickActions() {
|
||||||
|
this.$store.commit(QUICK_ACTIONS_ACTIVE, true)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="notifications">
|
<div class="notifications">
|
||||||
<a @click.stop="showNotifications = !showNotifications" class="trigger">
|
<a @click.stop="showNotifications = !showNotifications" class="trigger-button">
|
||||||
<span class="unread-indicator" v-if="unreadNotifications > 0"></span>
|
<span class="unread-indicator" v-if="unreadNotifications > 0"></span>
|
||||||
<icon icon="bell"/>
|
<icon icon="bell"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<modal v-if="active" class="quick-actions">
|
<modal v-if="active" class="quick-actions" @close="closeQuickActions">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="action-input" :class="{'has-active-cmd': selectedCmd !== null}">
|
<div class="action-input" :class="{'has-active-cmd': selectedCmd !== null}">
|
||||||
<div class="active-cmd tag" v-if="selectedCmd !== null">
|
<div class="active-cmd tag" v-if="selectedCmd !== null">
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
@keydown.down.prevent="() => select(0, 0)"
|
@keydown.down.prevent="() => select(0, 0)"
|
||||||
@keyup.prevent.delete="unselectCmd"
|
@keyup.prevent.delete="unselectCmd"
|
||||||
@keyup.prevent.enter="doCmd"
|
@keyup.prevent.enter="doCmd"
|
||||||
|
@keyup.prevent.esc="closeQuickActions"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ import TaskModel from '@/models/task'
|
||||||
import NamespaceModel from '@/models/namespace'
|
import NamespaceModel from '@/models/namespace'
|
||||||
import TeamModel from '@/models/team'
|
import TeamModel from '@/models/team'
|
||||||
|
|
||||||
import {CURRENT_LIST} from '@/store/mutation-types'
|
import {CURRENT_LIST, QUICK_ACTIONS_ACTIVE} from '@/store/mutation-types'
|
||||||
import ListModel from '@/models/list'
|
import ListModel from '@/models/list'
|
||||||
|
|
||||||
const TYPE_LIST = 'list'
|
const TYPE_LIST = 'list'
|
||||||
|
@ -90,7 +91,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
active: () => true, // TODO: use state + keyboard shortcut
|
active() {
|
||||||
|
const active = this.$store.state[QUICK_ACTIONS_ACTIVE]
|
||||||
|
if (!active) {
|
||||||
|
this.reset()
|
||||||
|
}
|
||||||
|
return active
|
||||||
|
},
|
||||||
results() {
|
results() {
|
||||||
const lists = (Object.values(this.$store.state.lists).filter(l => {
|
const lists = (Object.values(this.$store.state.lists).filter(l => {
|
||||||
return l.title.toLowerCase().includes(this.query.toLowerCase())
|
return l.title.toLowerCase().includes(this.query.toLowerCase())
|
||||||
|
@ -150,7 +157,7 @@ export default {
|
||||||
hintText() {
|
hintText() {
|
||||||
let namespace
|
let namespace
|
||||||
|
|
||||||
if (this.selectedCmd !== null) {
|
if (this.selectedCmd !== null && this.currentList !== null) {
|
||||||
switch (this.selectedCmd.action) {
|
switch (this.selectedCmd.action) {
|
||||||
case CMD_NEW_TASK:
|
case CMD_NEW_TASK:
|
||||||
return `Create a task in the current list (${this.currentList.title})`
|
return `Create a task in the current list (${this.currentList.title})`
|
||||||
|
@ -221,6 +228,9 @@ export default {
|
||||||
})
|
})
|
||||||
}, 150)
|
}, 150)
|
||||||
},
|
},
|
||||||
|
closeQuickActions() {
|
||||||
|
this.$store.commit(QUICK_ACTIONS_ACTIVE, false)
|
||||||
|
},
|
||||||
doAction(type, item) {
|
doAction(type, item) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_LIST:
|
case TYPE_LIST:
|
||||||
|
@ -358,6 +368,10 @@ export default {
|
||||||
|
|
||||||
this.selectedCmd = null
|
this.selectedCmd = null
|
||||||
},
|
},
|
||||||
|
reset() {
|
||||||
|
this.query = ''
|
||||||
|
this.selectedCmd = null
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,24 +1,16 @@
|
||||||
.notifications {
|
.notifications {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
|
|
||||||
.trigger {
|
.unread-indicator {
|
||||||
cursor: pointer;
|
position: absolute;
|
||||||
color: $grey-400;
|
top: 1rem;
|
||||||
padding: 1rem;
|
right: .75rem;
|
||||||
font-size: 1.25rem;
|
width: .75rem;
|
||||||
position: relative;
|
height: .75rem;
|
||||||
|
|
||||||
.unread-indicator {
|
background: $primary;
|
||||||
position: absolute;
|
border-radius: 100%;
|
||||||
top: 1rem;
|
border: 2px solid $white;
|
||||||
right: .75rem;
|
|
||||||
width: .75rem;
|
|
||||||
height: .75rem;
|
|
||||||
|
|
||||||
background: $primary;
|
|
||||||
border-radius: 100%;
|
|
||||||
border: 2px solid $white;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.notifications-list {
|
.notifications-list {
|
||||||
|
|
|
@ -318,112 +318,123 @@
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar .user {
|
.navbar {
|
||||||
span {
|
.trigger-button {
|
||||||
font-family: $vikunja-font;
|
cursor: pointer;
|
||||||
|
color: $grey-400;
|
||||||
|
padding: 1rem;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.user {
|
||||||
-webkit-border-radius: 100%;
|
span {
|
||||||
-moz-border-radius: 100%;
|
font-family: $vikunja-font;
|
||||||
border-radius: 100%;
|
}
|
||||||
vertical-align: middle;
|
|
||||||
height: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout-icon {
|
.avatar {
|
||||||
color: $grey-900;
|
-webkit-border-radius: 100%;
|
||||||
|
-moz-border-radius: 100%;
|
||||||
.icon {
|
border-radius: 100%;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-icon {
|
||||||
|
color: $grey-900;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-trigger .button {
|
||||||
|
background: none;
|
||||||
|
|
||||||
|
&:focus:not(:active), &:active {
|
||||||
|
outline: none !important;
|
||||||
|
-webkit-box-shadow: none !important;
|
||||||
|
-moz-box-shadow: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-trigger .button {
|
.menu-hide-button, .menu-show-button {
|
||||||
background: none;
|
display: none;
|
||||||
|
z-index: 31;
|
||||||
&:focus:not(:active), &:active {
|
font-weight: bold;
|
||||||
outline: none !important;
|
font-size: 2rem;
|
||||||
-webkit-box-shadow: none !important;
|
|
||||||
-moz-box-shadow: none !important;
|
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-hide-button, .menu-show-button {
|
|
||||||
display: none;
|
|
||||||
z-index: 31;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 2rem;
|
|
||||||
color: $text;
|
|
||||||
line-height: 1;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: $grey-900;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-hide-button {
|
|
||||||
position: fixed;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: $text;
|
color: $text;
|
||||||
|
line-height: 1;
|
||||||
|
|
||||||
|
&:hover, &:focus {
|
||||||
|
color: $grey-900;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand .menu-show-button {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-overlay {
|
|
||||||
display: none;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
background: rgba(250, 250, 250, 0.8);
|
|
||||||
z-index: 5;
|
|
||||||
opacity: 0;
|
|
||||||
transition: all $transition;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: $tablet) {
|
|
||||||
.menu-hide-button {
|
.menu-hide-button {
|
||||||
display: block;
|
position: fixed;
|
||||||
top: $hamburger-menu-icon-spacing;
|
|
||||||
right: $hamburger-menu-icon-spacing;
|
&:hover, &:focus {
|
||||||
|
color: $text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-show-button {
|
.navbar-brand .menu-show-button {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: $hamburger-menu-icon-spacing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile-overlay {
|
.mobile-overlay {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: rgba(250, 250, 250, 0.8);
|
||||||
|
z-index: 5;
|
||||||
|
opacity: 0;
|
||||||
|
transition: all $transition;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: $tablet) {
|
||||||
|
.menu-hide-button {
|
||||||
|
display: block;
|
||||||
|
top: $hamburger-menu-icon-spacing;
|
||||||
|
right: $hamburger-menu-icon-spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-show-button {
|
||||||
|
display: block;
|
||||||
|
margin-left: $hamburger-menu-icon-spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-overlay {
|
||||||
|
display: block;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar.is-dark .navbar-brand > .navbar-item {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-icon {
|
||||||
|
margin-right: 0.85rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-bottom-link {
|
||||||
|
width: 100%;
|
||||||
|
color: $grey-300;
|
||||||
|
text-align: center;
|
||||||
display: block;
|
display: block;
|
||||||
opacity: 1;
|
margin: 1rem 0;
|
||||||
}
|
font-size: .8rem;
|
||||||
|
|
||||||
.navbar.is-dark .navbar-brand > .navbar-item {
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.logout-icon {
|
|
||||||
margin-right: 0.85rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-bottom-link {
|
|
||||||
width: 100%;
|
|
||||||
color: $grey-300;
|
|
||||||
text-align: center;
|
|
||||||
display: block;
|
|
||||||
margin: 1rem 0;
|
|
||||||
font-size: .8rem;
|
|
||||||
}
|
|
||||||
|
|
Reference in New Issue