mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 01:40:13 -04:00
e8df67d5d5
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Cleanup shortcuts with new hooks <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Centralized keyboard shortcut system for consistent shortcut behavior across the app and moved preference toggles to a unified registry. * **New Features** * Added explicit shortcuts for Command Menu, AI Assistant, Inline Editor, and result copy/download actions. * Hotkey preferences UI now renders dynamically from the centralized shortcut list. * **Tests** * Test helpers updated to include the command menu provider for accurate shortcut behavior in tests. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
22 lines
741 B
TypeScript
22 lines
741 B
TypeScript
import type { PropsWithChildren } from 'react'
|
|
import { CommandProvider } from 'ui-patterns/CommandMenu'
|
|
|
|
import { useStudioCommandMenuTelemetry } from '@/hooks/misc/useStudioCommandMenuTelemetry'
|
|
import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
|
|
import { useIsShortcutEnabled } from '@/state/shortcuts/useIsShortcutEnabled'
|
|
|
|
export function StudioCommandProvider({ children }: PropsWithChildren) {
|
|
const { onTelemetry } = useStudioCommandMenuTelemetry()
|
|
const commandMenuHotkeyEnabled = useIsShortcutEnabled(SHORTCUT_IDS.COMMAND_MENU_OPEN)
|
|
|
|
return (
|
|
<CommandProvider
|
|
app="studio"
|
|
onTelemetry={onTelemetry}
|
|
openKey={commandMenuHotkeyEnabled ? 'k' : ''}
|
|
>
|
|
{children}
|
|
</CommandProvider>
|
|
)
|
|
}
|