mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-22 18:47:57 +01:00
25 lines
652 B
TypeScript
25 lines
652 B
TypeScript
import { CommandPalette } from '../components/CommandPalette';
|
|
import { useDialog } from '../components/DialogContext';
|
|
import { useAppInfo } from './useAppInfo';
|
|
import { useHotKey } from './useHotKey';
|
|
|
|
export function useCommandPalette() {
|
|
const dialog = useDialog();
|
|
const appInfo = useAppInfo();
|
|
useHotKey('command_palette.toggle', () => {
|
|
// Disabled in production for now
|
|
if (!appInfo.data?.isDev) {
|
|
return;
|
|
}
|
|
|
|
dialog.toggle({
|
|
id: 'command_palette',
|
|
size: 'md',
|
|
hideX: true,
|
|
noPadding: true,
|
|
noScroll: true,
|
|
render: ({ hide }) => <CommandPalette onClose={hide} />,
|
|
});
|
|
});
|
|
}
|