-
-
Notifications
You must be signed in to change notification settings - Fork 365
feat(ui): add β+K command palette for quick nav and actions #2159
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
Open
serhalp
wants to merge
2
commits into
main
Choose a base branch
from
serhalp/cmdk-palette
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,541
β65
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,6 +144,8 @@ if (import.meta.client) { | |
| <NuxtPage /> | ||
| </div> | ||
|
|
||
| <CommandPalette /> | ||
|
|
||
| <AppFooter /> | ||
|
|
||
| <ScrollToTop /> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,8 @@ import { NPMX_DOCS_SITE } from '#shared/utils/constants' | |
|
|
||
| const keyboardShortcuts = useKeyboardShortcuts() | ||
| const discord = useDiscordLink() | ||
| const { open: openCommandPalette } = useCommandPalette() | ||
| const { commandPaletteShortcutLabel } = usePlatformModifierKey() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the platform-aware modifier label in the tooltip title.
Suggested fix-const { commandPaletteShortcutLabel } = usePlatformModifierKey()
+const { commandPaletteShortcutLabel, primaryModifierKeyLabel } = usePlatformModifierKey()
...
-:title="$t('shortcuts.command_palette_description', { ctrlKey: $t('shortcuts.ctrl_key') })"
+:title="$t('shortcuts.command_palette_description', { ctrlKey: primaryModifierKeyLabel })"Also applies to: 268-268 |
||
|
|
||
| withDefaults( | ||
| defineProps<{ | ||
|
|
@@ -258,6 +260,24 @@ onKeyStroke( | |
| <!-- Spacer when logo is hidden on desktop --> | ||
| <span v-else class="hidden sm:block w-1" /> | ||
|
|
||
| <ButtonBase | ||
| type="button" | ||
| variant="secondary" | ||
| class="hidden lg:inline-flex shrink-0 gap-2 px-2.5 me-3" | ||
| :aria-label="$t('shortcuts.command_palette')" | ||
| :title="$t('shortcuts.command_palette_description', { ctrlKey: $t('shortcuts.ctrl_key') })" | ||
| @click="openCommandPalette" | ||
| > | ||
| <span>{{ $t('command_palette.quick_actions') }}</span> | ||
| <span class="inline-flex items-center gap-1 text-xs text-fg-subtle"> | ||
| <kbd | ||
| class="inline-flex items-center justify-center rounded border border-border bg-bg-muted px-1.5 py-0.5 font-mono text-[0.7rem] text-fg-muted" | ||
| > | ||
| {{ commandPaletteShortcutLabel }} | ||
| </kbd> | ||
| </span> | ||
| </ButtonBase> | ||
|
|
||
| <!-- Center: Search bar + nav items --> | ||
| <div | ||
| class="flex-1 flex items-center md:gap-6" | ||
|
|
@@ -293,7 +313,7 @@ onKeyStroke( | |
| </div> | ||
|
|
||
| <!-- End: Desktop nav items + Mobile menu button --> | ||
| <div class="hidden sm:flex flex-shrink-0"> | ||
| <div class="hidden sm:flex flex-shrink-0 items-center gap-2"> | ||
| <!-- Desktop: Explore link --> | ||
| <LinkBase | ||
| v-for="link in desktopLinks" | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the platform-aware modifier label in the description text.
The shortcut row uses
commandPaletteShortcutLabel, but the description still interpolatesshortcuts.ctrl_key. On Apple devices this can produce mixed messaging.Suggested fix
Also applies to: 56-60