mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
## Problem We now export components under a subpath in ui-patterns to avoid barrel files as they slow down every tools (from IDE to linters, etc.) and may also affect bundles our users have to download. ## Solution - Remove the UI patterns index file - Fix invalid impors
23 lines
736 B
TypeScript
23 lines
736 B
TypeScript
import { ICommand } from 'ui-patterns/CommandMenu'
|
|
|
|
import { SHORTCUT_IDS } from './registry'
|
|
|
|
/**
|
|
* Shared orderer for the Cmd+K "Shortcuts" section. Keeps the "Show all
|
|
* keyboard shortcuts" entry pinned to the bottom regardless of registration
|
|
* order; everything else is order-stable. Exported so `useDynamicShortcut`
|
|
* can share the same ordering behavior.
|
|
*/
|
|
export const orderShortcutCommands = (
|
|
commands: ICommand[],
|
|
commandsToInsert: ICommand[]
|
|
): ICommand[] => {
|
|
const mergedCommands = [...commands, ...commandsToInsert]
|
|
|
|
return mergedCommands.sort((a, b) => {
|
|
if (a.id === SHORTCUT_IDS.SHORTCUTS_OPEN_REFERENCE) return 1
|
|
if (b.id === SHORTCUT_IDS.SHORTCUTS_OPEN_REFERENCE) return -1
|
|
return 0
|
|
})
|
|
}
|