Skip to content

Commit e3f7315

Browse files
committed
fix: improve useKeyboardShortcuts usage, fix i18n keys
1 parent 8506dd2 commit e3f7315

7 files changed

Lines changed: 9 additions & 12 deletions

File tree

app/components/AppFooter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const closeModal = () => modalRef.value?.close?.()
9797
</li>
9898
</ul>
9999
<p class="text-fg-muted leading-relaxed">
100-
<i18n-t keypath="shortcuts.disable_shortcuts_description" tag="span" scope="global">
100+
<i18n-t keypath="shortcuts.disable" tag="span" scope="global">
101101
<template #settings>
102102
<NuxtLink
103103
:to="{ name: 'settings' }"

app/components/Compare/PackageSelector.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ function removePackage(name: string) {
9797
packages.value = packages.value.filter(p => p !== name)
9898
}
9999
100+
const keyboardShortcutsEnabled = useKeyboardShortcuts()
101+
100102
function handleKeydown(e: KeyboardEvent) {
101-
if (!useKeyboardShortcuts().value) return
103+
if (!keyboardShortcutsEnabled) return
102104
103105
const items = navigableItems.value
104106
const count = items.length

app/components/Link/Base.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ const isLink = computed(() => props.variant === 'link')
5959
const isButton = computed(() => !isLink.value)
6060
const isButtonSmall = computed(() => props.size === 'small' && !isLink.value)
6161
const isButtonMedium = computed(() => props.size === 'medium' && !isLink.value)
62-
const keyboardShortcutsEnabled = computed(() => import.meta.client && useKeyboardShortcuts().value)
62+
const keyboardShortcuts = useKeyboardShortcuts()
63+
const keyboardShortcutsEnabled = computed(() => import.meta.client && keyboardShortcuts.value)
6364
</script>
6465

6566
<template>

i18n/locales/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
"go_to_result": "Go to result",
3535
"open_code_view": "Open code view",
3636
"open_docs": "Open docs",
37-
"disable_shortcuts": "Disable shortcuts",
38-
"disable_shortcuts_description": "You could disable keyboard shortcuts in {settings}."
37+
"disable_shortcuts": "You could disable keyboard shortcuts in {settings}."
3938
},
4039
"search": {
4140
"label": "Search npm packages",

i18n/schema.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@
108108
},
109109
"disable_shortcuts": {
110110
"type": "string"
111-
},
112-
"disable_shortcuts_description": {
113-
"type": "string"
114111
}
115112
},
116113
"additionalProperties": false

lunaria/files/en-GB.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
"go_to_result": "Go to result",
3434
"open_code_view": "Open code view",
3535
"open_docs": "Open docs",
36-
"disable_shortcuts": "Disable shortcuts",
37-
"disable_shortcuts_description": "You could disable keyboard shortcuts in {settings}."
36+
"disable_shortcuts": "You could disable keyboard shortcuts in {settings}."
3837
},
3938
"search": {
4039
"label": "Search npm packages",

lunaria/files/en-US.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
"go_to_result": "Go to result",
3434
"open_code_view": "Open code view",
3535
"open_docs": "Open docs",
36-
"disable_shortcuts": "Disable shortcuts",
37-
"disable_shortcuts_description": "You could disable keyboard shortcuts in {settings}."
36+
"disable_shortcuts": "You could disable keyboard shortcuts in {settings}."
3837
},
3938
"search": {
4039
"label": "Search npm packages",

0 commit comments

Comments
 (0)