diff --git a/apps/app/components/command-palette/command-pallette.tsx b/apps/app/components/command-palette/command-pallette.tsx index b0fb03efa..4dc29afec 100644 --- a/apps/app/components/command-palette/command-pallette.tsx +++ b/apps/app/components/command-palette/command-pallette.tsx @@ -23,8 +23,10 @@ import inboxService from "services/inbox.service"; import { INBOX_LIST, ISSUE_DETAILS } from "constants/fetch-keys"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; +import { observable } from "mobx"; +import { observer } from "mobx-react-lite"; -export const CommandPalette: React.FC = () => { +export const CommandPalette: React.FC = observer(() => { const store: any = useMobxStore(); const [isPaletteOpen, setIsPaletteOpen] = useState(false); @@ -76,45 +78,48 @@ export const CommandPalette: React.FC = () => { (e: KeyboardEvent) => { const { key, ctrlKey, metaKey, altKey, shiftKey } = e; if (!key) return; + const keyPressed = key.toLowerCase(); const cmdClicked = ctrlKey || metaKey; // if on input, textarea or editor, don't do anything if ( - !(e.target instanceof HTMLTextAreaElement) && - !(e.target instanceof HTMLInputElement) && - !(e.target as Element).classList?.contains("tiptap-editor-container") - ) { - if ((ctrlKey || metaKey) && keyPressed === "k") { - e.preventDefault(); - setIsPaletteOpen(true); - } else if (keyPressed === "c" && altKey) { - e.preventDefault(); - copyIssueUrlToClipboard(); - } else if (keyPressed === "b") { - e.preventDefault(); - store.theme.setSidebarCollapsed(); - } else if (keyPressed === "backspace") { - console.log("KEYDOWN") - e.preventDefault(); - setIsBulkDeleteIssuesModalOpen(true); + e.target instanceof HTMLTextAreaElement || + e.target instanceof HTMLInputElement || + (e.target as Element).classList?.contains("ProseMirror") + ) + return; + + if (cmdClicked) { + if (keyPressed === "k") { + e.preventDefault(); + setIsPaletteOpen(true); + } else if (keyPressed === "c" && altKey) { + e.preventDefault(); + copyIssueUrlToClipboard(); + } else if (keyPressed === "b") { + e.preventDefault(); + store.theme.setSidebarCollapsed(!store?.theme?.sidebarCollapsed); + } + } else { + if (keyPressed === "c") { + setIsIssueModalOpen(true); + } else if (keyPressed === "p") { + setIsProjectModalOpen(true); + } else if (keyPressed === "v") { + setIsCreateViewModalOpen(true); + } else if (keyPressed === "d") { + setIsCreateUpdatePageModalOpen(true); + } else if (keyPressed === "h") { + setIsShortcutsModalOpen(true); + } else if (keyPressed === "q") { + setIsCreateCycleModalOpen(true); + } else if (keyPressed === "m") { + setIsCreateModuleModalOpen(true); + } else if (keyPressed === "backspace" || keyPressed === "delete") { + e.preventDefault(); + setIsBulkDeleteIssuesModalOpen(true); + } } - } else { - if (keyPressed === "c") { - setIsIssueModalOpen(true); - } else if (keyPressed === "p") { - setIsProjectModalOpen(true); - } else if (keyPressed === "v") { - setIsCreateViewModalOpen(true); - } else if (keyPressed === "d") { - setIsCreateUpdatePageModalOpen(true); - } else if (keyPressed === "h") { - setIsShortcutsModalOpen(true); - } else if (keyPressed === "q") { - setIsCreateCycleModalOpen(true); - } else if (keyPressed === "m") { - setIsCreateModuleModalOpen(true); - } - } }, [copyIssueUrlToClipboard] ); @@ -191,4 +196,4 @@ export const CommandPalette: React.FC = () => { /> ); -}; +}) \ No newline at end of file diff --git a/apps/app/components/issues/description-form.tsx b/apps/app/components/issues/description-form.tsx index 1eb02915f..4914cdcbe 100644 --- a/apps/app/components/issues/description-form.tsx +++ b/apps/app/components/issues/description-form.tsx @@ -55,7 +55,7 @@ export const IssueDescriptionForm: FC = ({ const handleDescriptionFormSubmit = useCallback( async (formData: Partial) => { - console.log("formdata", formData) + // console.log("formdata", formData) if (!formData?.name || formData?.name.length === 0 || formData?.name.length > 255) return; await handleFormSubmit({ @@ -99,8 +99,9 @@ export const IssueDescriptionForm: FC = ({ {characterLimit && (
255 ? "text-red-500" : "" - }`} + className={`${ + watch("name").length === 0 || watch("name").length > 255 ? "text-red-500" : "" + }`} > {watch("name").length} @@ -119,7 +120,9 @@ export const IssueDescriptionForm: FC = ({ return ( { const router = useRouter(); const { workspaceSlug, projectId, issueId } = router.query; - console.log(workspaceSlug, "workspaceSlug") + // console.log(workspaceSlug, "workspaceSlug") const { user } = useUserAuth();