From 34ff8fecc55d9be4531b72c96e81045a96022e0d Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:01:19 +0530 Subject: [PATCH] feat: add create page option in cmdk menu (#799) --- .../command-palette/command-pallette.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/app/components/command-palette/command-pallette.tsx b/apps/app/components/command-palette/command-pallette.tsx index cc11fc600..53e9cd5a7 100644 --- a/apps/app/components/command-palette/command-pallette.tsx +++ b/apps/app/components/command-palette/command-pallette.tsx @@ -179,6 +179,7 @@ export const CommandPalette: React.FC = () => { (e: KeyboardEvent) => { const singleShortcutKeys = ["p", "v", "d", "h", "q", "m"]; const { key, ctrlKey, metaKey, altKey, shiftKey } = e; + if (!key) return; const keyPressed = key.toLowerCase(); if ( !(e.target instanceof HTMLTextAreaElement) && @@ -299,6 +300,11 @@ export const CommandPalette: React.FC = () => { setIsCreateViewModalOpen(true); }; + const createNewPage = () => { + setIsPaletteOpen(false); + setIsCreateUpdatePageModalOpen(true); + }; + const createNewModule = () => { setIsPaletteOpen(false); setIsCreateModuleModalOpen(true); @@ -654,7 +660,17 @@ export const CommandPalette: React.FC = () => { Create new view - Q + V + + + + + +
+ + Create new page +
+ D