From a28be950027d380ec52d9f0f376f50c80b44f4de Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Thu, 16 Feb 2023 18:01:14 +0530 Subject: [PATCH] fix: workspace name and breadcrumb title , refactor: command palette (#290) * refactor: command pallette * fix: workspace name trim * fix: breadcrumb title responsiveness added --- apps/app/components/breadcrumbs/index.tsx | 4 ++-- .../command-palette/command-pallette.tsx | 19 ++++++++----------- apps/app/pages/create-workspace.tsx | 5 ++++- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/app/components/breadcrumbs/index.tsx b/apps/app/components/breadcrumbs/index.tsx index 75fd3bfe5..ccd17fb4e 100644 --- a/apps/app/components/breadcrumbs/index.tsx +++ b/apps/app/components/breadcrumbs/index.tsx @@ -44,10 +44,10 @@ const BreadcrumbItem: React.FC = ({ title, link, icon }) => ) : ( -
+

{icon} - {title} + {title}

)} diff --git a/apps/app/components/command-palette/command-pallette.tsx b/apps/app/components/command-palette/command-pallette.tsx index cb4f398b9..0ec31ca84 100644 --- a/apps/app/components/command-palette/command-pallette.tsx +++ b/apps/app/components/command-palette/command-pallette.tsx @@ -102,10 +102,10 @@ export const CommandPalette: React.FC = () => { !(e.target instanceof HTMLInputElement) && !(e.target as Element).classList?.contains("remirror-editor") ) { - if ((e.ctrlKey || e.metaKey) && (e.key === "k" || e.key === "K")) { + if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k") { e.preventDefault(); setIsPaletteOpen(true); - } else if ((e.ctrlKey || e.metaKey) && (e.key === "c" || e.key === "C")) { + } else if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "c") { if (e.altKey) { e.preventDefault(); if (!router.query.issueId) return; @@ -124,26 +124,23 @@ export const CommandPalette: React.FC = () => { title: "Some error occurred", }); }); - console.log("URL Copied"); - } else { - console.log("Text copied"); } - } else if (e.key === "c" || e.key === "C") { + } else if (e.key.toLowerCase() === "c") { e.preventDefault(); setIsIssueModalOpen(true); - } else if (e.key === "p" || e.key === "P") { + } else if (e.key.toLowerCase() === "p") { e.preventDefault(); setIsProjectModalOpen(true); - } else if ((e.ctrlKey || e.metaKey) && (e.key === "b" || e.key === "B")) { + } else if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "b") { e.preventDefault(); toggleCollapsed(); - } else if (e.key === "h" || e.key === "H") { + } else if (e.key.toLowerCase() === "h") { e.preventDefault(); setIsShortcutsModalOpen(true); - } else if (e.key === "q" || e.key === "Q") { + } else if (e.key.toLowerCase() === "q") { e.preventDefault(); setIsCreateCycleModalOpen(true); - } else if (e.key === "m" || e.key === "M") { + } else if (e.key.toLowerCase() === "m") { e.preventDefault(); setIsCreateModuleModalOpen(true); } else if (e.key === "Delete") { diff --git a/apps/app/pages/create-workspace.tsx b/apps/app/pages/create-workspace.tsx index 2c4b1a6a4..0af942a06 100644 --- a/apps/app/pages/create-workspace.tsx +++ b/apps/app/pages/create-workspace.tsx @@ -107,7 +107,10 @@ const CreateWorkspace: NextPage = () => { placeholder="Enter name" autoComplete="off" onChange={(e) => - setValue("slug", e.target.value.toLocaleLowerCase().replace(/ /g, "-")) + setValue( + "slug", + e.target.value.toLocaleLowerCase().trim().replace(/ /g, "-") + ) } validations={{ required: "Workspace name is required",