Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] keyboard shortcut #1843

Merged
merged 4 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion frontend/components/tasks/toolbar/ToolbarLaptop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
@click:cancel="dialogClear = false"
/>
</v-dialog>

<button-keyboard-shortcut @click:open="dialogShortcut = true" />
<v-dialog v-model="dialogShortcut">
<form-keyboard-shortcut @click:close="dialogShortcut = false" />
</v-dialog>
</v-btn-toggle>
<slot />
<v-spacer />
Expand All @@ -61,10 +66,12 @@ import ButtonFilter from './buttons/ButtonFilter.vue'
import ButtonGuideline from './buttons/ButtonGuideline.vue'
import ButtonPagination from './buttons/ButtonPagination.vue'
import ButtonReview from './buttons/ButtonReview.vue'
import ButtonKeyboardShortcut from './buttons/ButtonKeyboardShortcut.vue'
import FormAutoLabeling from './forms/FormAutoLabeling.vue'
import FormClearLabel from './forms/FormClearLabel.vue'
import FormComment from './forms/FormComment.vue'
import FormGuideline from './forms/FormGuideline.vue'
import FormKeyboardShortcut from './forms/FormKeyboardShortcut.vue'

export default Vue.extend({
components: {
Expand All @@ -73,12 +80,14 @@ export default Vue.extend({
ButtonComment,
ButtonFilter,
ButtonGuideline,
ButtonKeyboardShortcut,
ButtonPagination,
ButtonReview,
FormAutoLabeling,
FormClearLabel,
FormComment,
FormGuideline
FormGuideline,
FormKeyboardShortcut
},

props: {
Expand Down Expand Up @@ -112,6 +121,7 @@ export default Vue.extend({
dialogClear: false,
dialogComment: false,
dialogGuideline: false,
dialogShortcut: false,
errorMessage: ''
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<v-tooltip bottom>
<template #activator="{ on }">
<v-btn icon v-on="on" @click="$emit('click:open')">
<v-icon>
{{ mdiKeyboardOutline }}
</v-icon>
</v-btn>
</template>
<span>Keyboard Shortcut</span>
</v-tooltip>
</template>

<script>
import { mdiKeyboardOutline } from '@mdi/js'

export default {
data() {
return {
mdiKeyboardOutline
}
}
}
</script>
75 changes: 75 additions & 0 deletions frontend/components/tasks/toolbar/forms/FormKeyboardShortcut.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<base-card title="Keyboard Shortcut" :cancel-text="$t('generic.close')" @cancel="close">
<template #content>
<v-simple-table>
<template #default>
<thead>
<tr>
<th class="text-left">Action</th>
<th class="text-left">Key</th>
</tr>
</thead>
<tbody>
<tr v-for="item in items" :key="item.name">
<td>{{ item.name }}</td>
<td>
<v-chip
v-for="key in item.key"
:key="key"
color="grey darken-3 white--text"
class="ma-1"
label
small
>{{ key }}</v-chip
>
</td>
</tr>
</tbody>
</template>
</v-simple-table>
</template>
</base-card>
</template>

<script>
import BaseCard from '@/components/utils/BaseCard'

export default {
components: {
BaseCard
},

data() {
return {
items: [
{
name: 'Jump to the first data',
key: ['shift', '←']
},
{
name: 'Jump to the last data',
key: ['shift', '→']
},
{
name: 'Move to the previous data',
key: ['←']
},
{
name: 'Move to the next data',
key: ['→']
},
{
name: 'Confirm the data',
key: ['enter']
}
]
}
},

methods: {
close() {
this.$emit('click:close')
}
}
}
</script>