mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-01 06:53:11 +02:00
Start of command palette
This commit is contained in:
24
src-web/hooks/useCommandPalette.tsx
Normal file
24
src-web/hooks/useCommandPalette.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
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: () => <CommandPalette />,
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user