mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-21 17:05:22 +03:00
feat: add several new shortcut keys for navigation (#2618)
This commit is contained in:
parent
3584151fab
commit
edcc8741bf
3 changed files with 64 additions and 1 deletions
|
@ -40,6 +40,10 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
|||
// description: t('magic_keys.groups.navigation.previous_status'),
|
||||
// shortcut: { keys: ['k'], isSequence: false },
|
||||
// },
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_search'),
|
||||
shortcut: { keys: ['/'], isSequence: false },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_home'),
|
||||
shortcut: { keys: ['g', 'h'], isSequence: true },
|
||||
|
@ -48,6 +52,42 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
|||
description: t('magic_keys.groups.navigation.go_to_notifications'),
|
||||
shortcut: { keys: ['g', 'n'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_conversations'),
|
||||
shortcut: { keys: ['g', 'c'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_favourites'),
|
||||
shortcut: { keys: ['g', 'f'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_bookmarks'),
|
||||
shortcut: { keys: ['g', 'b'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_explore'),
|
||||
shortcut: { keys: ['g', 'e'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_local'),
|
||||
shortcut: { keys: ['g', 'l'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_federated'),
|
||||
shortcut: { keys: ['g', 't'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_lists'),
|
||||
shortcut: { keys: ['g', 'i'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_settings'),
|
||||
shortcut: { keys: ['g', 's'], isSequence: true },
|
||||
},
|
||||
{
|
||||
description: t('magic_keys.groups.navigation.go_to_profile'),
|
||||
shortcut: { keys: ['g', 'p'], isSequence: true },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -226,7 +226,7 @@
|
|||
"boost": "Boost",
|
||||
"command_mode": "Command mode",
|
||||
"compose": "Compose",
|
||||
"favourite": "Favourite",
|
||||
"favourite": "Favorite",
|
||||
"search": "Search",
|
||||
"show_new_items": "Show new items",
|
||||
"title": "Actions"
|
||||
|
@ -235,8 +235,18 @@
|
|||
"title": "Media"
|
||||
},
|
||||
"navigation": {
|
||||
"go_to_bookmarks": "Bookmarks",
|
||||
"go_to_conversations": "Conversations",
|
||||
"go_to_explore": "Explore",
|
||||
"go_to_favourites": "Favorites",
|
||||
"go_to_federated": "Federated",
|
||||
"go_to_home": "Home",
|
||||
"go_to_lists": "Lists",
|
||||
"go_to_local": "Local",
|
||||
"go_to_notifications": "Notifications",
|
||||
"go_to_profile": "Profile",
|
||||
"go_to_search": "Search",
|
||||
"go_to_settings": "Settings",
|
||||
"next_status": "Next post",
|
||||
"previous_status": "Previous post",
|
||||
"shortcut_help": "Shortcut help",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import type { RouteLocationRaw } from 'vue-router'
|
||||
import { useMagicSequence } from '~/composables/magickeys'
|
||||
import { currentUser, getInstanceDomain } from '~/composables/users'
|
||||
|
||||
export default defineNuxtPlugin(({ $scrollToTop }) => {
|
||||
const keys = useMagicKeys()
|
||||
|
@ -35,8 +36,20 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
|
|||
}
|
||||
whenever(logicAnd(isAuthenticated, notUsingInput, keys.c), defaultPublishDialog)
|
||||
|
||||
const instanceDomain = currentInstance.value ? getInstanceDomain(currentInstance.value) : 'm.webtoo.ls'
|
||||
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 'h'])), () => navigateTo('/home'))
|
||||
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'n'])), () => navigateTo('/notifications'))
|
||||
// TODO: always overridden by 'c' (compose) shortcut
|
||||
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'c'])), () => navigateTo('/conversations'))
|
||||
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'f'])), () => navigateTo('/favourites'))
|
||||
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'b'])), () => navigateTo('/bookmarks'))
|
||||
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 'e'])), () => navigateTo(`/${instanceDomain}/explore`))
|
||||
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 'l'])), () => navigateTo(`/${instanceDomain}/public/local`))
|
||||
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 't'])), () => navigateTo(`/${instanceDomain}/public`))
|
||||
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'i'])), () => navigateTo('/lists'))
|
||||
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 's'])), () => navigateTo('/settings'))
|
||||
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'p'])), () => navigateTo(`/${instanceDomain}/@${currentUser.value?.account.username}`))
|
||||
whenever(logicAnd(notUsingInput, keys['/']), () => navigateTo('/search'))
|
||||
|
||||
const toggleFavouriteActiveStatus = () => {
|
||||
// TODO: find a better solution than clicking buttons...
|
||||
|
|
Loading…
Reference in a new issue