From 5d4b3cea4ceb6fe2a780b1d2d8b633ff6f8e43ca Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Thu, 28 Mar 2024 14:32:16 +0530 Subject: [PATCH] [WEB-833] chore: remove `create a new issue` option from command k modal if no projects are there. (#4083) --- .../command-palette/command-modal.tsx | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/web/components/command-palette/command-modal.tsx b/web/components/command-palette/command-modal.tsx index ddbf45dc8..aa36eabed 100644 --- a/web/components/command-palette/command-modal.tsx +++ b/web/components/command-palette/command-modal.tsx @@ -40,7 +40,7 @@ const issueService = new IssueService(); export const CommandModal: React.FC = observer(() => { // hooks - const { getProjectById } = useProject(); + const { getProjectById, workspaceProjectIds } = useProject(); const { isMobile } = usePlatformOS(); // states const [placeholder, setPlaceholder] = useState("Type a command or search..."); @@ -282,22 +282,24 @@ export const CommandModal: React.FC = observer(() => { setSearchTerm={(newSearchTerm) => setSearchTerm(newSearchTerm)} /> )} - - { - closePalette(); - setTrackElement("Command Palette"); - toggleCreateIssueModal(true); - }} - className="focus:bg-custom-background-80" - > -
- - Create new issue -
- C -
-
+ {workspaceSlug && workspaceProjectIds && workspaceProjectIds.length > 0 && ( + + { + closePalette(); + setTrackElement("Command Palette"); + toggleCreateIssueModal(true); + }} + className="focus:bg-custom-background-80" + > +
+ + Create new issue +
+ C +
+
+ )} {workspaceSlug && (