chore: only check for mac once

This commit is contained in:
kolaente 2021-11-03 21:57:35 +01:00
parent e7114d24e9
commit ff52ceb92e
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 8 additions and 11 deletions

View File

@ -1,3 +1,7 @@
import {isMac} from '@/helpers/isMac'
const ctrl = isMac() ? '⌘' : 'ctrl'
export const KEYBOARD_SHORTCUTS = [
{
title: 'keyboardShortcuts.general',
@ -5,11 +9,11 @@ export const KEYBOARD_SHORTCUTS = [
shortcuts: [
{
title: 'keyboardShortcuts.toggleMenu',
keys: ['ctrl', 'e'],
keys: [ctrl, 'e'],
},
{
title: 'keyboardShortcuts.quickSearch',
keys: ['ctrl', 'k'],
keys: [ctrl, 'k'],
},
],
},
@ -19,7 +23,7 @@ export const KEYBOARD_SHORTCUTS = [
shortcuts: [
{
title: 'keyboardShortcuts.task.done',
keys: ['ctrl', 'click'],
keys: [ctrl, 'click'],
},
],
},

View File

@ -1,22 +1,15 @@
<template>
<span class="shortcuts">
<template v-for="(k, i) in keys" :key="i">
<kbd>{{ isMac ? k.replace('ctrl', '⌘') : k }}</kbd>
<kbd>{{ k }}</kbd>
<span v-if="i < keys.length - 1">{{ combination }}</span>
</template>
</span>
</template>
<script>
import {isMac} from '@/helpers/isMac'
export default {
name: 'shortcut',
data() {
return {
isMac: isMac(),
}
},
props: {
keys: {
type: Array,