fix: resolve modal overlapping issue (#2885)

This commit is contained in:
Anmol Singh Bhatia 2023-11-27 12:16:59 +05:30 committed by sriram veeraghanta
parent 6d46771109
commit 70994d1da7

View File

@ -33,7 +33,7 @@ export const CommandPalette: FC = observer(() => {
commandPalette, commandPalette,
theme: { toggleSidebar }, theme: { toggleSidebar },
user: { currentUser }, user: { currentUser },
trackEvent: { setTrackElement } trackEvent: { setTrackElement },
} = useMobxStore(); } = useMobxStore();
const { const {
toggleCommandPaletteModal, toggleCommandPaletteModal,
@ -57,6 +57,18 @@ export const CommandPalette: FC = observer(() => {
toggleDeleteIssueModal, toggleDeleteIssueModal,
} = commandPalette; } = commandPalette;
const isAnyModalOpen = Boolean(
isCreateIssueModalOpen ||
isCreateCycleModalOpen ||
isCreatePageModalOpen ||
isCreateProjectModalOpen ||
isCreateModuleModalOpen ||
isCreateViewModalOpen ||
isShortcutModalOpen ||
isBulkDeleteIssueModalOpen ||
isDeleteIssueModalOpen
);
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();
const { data: issueDetails } = useSWR( const { data: issueDetails } = useSWR(
@ -111,7 +123,7 @@ export const CommandPalette: FC = observer(() => {
e.preventDefault(); e.preventDefault();
toggleSidebar(); toggleSidebar();
} }
} else { } else if (!isAnyModalOpen) {
if (keyPressed === "c") { if (keyPressed === "c") {
setTrackElement("SHORTCUT_KEY"); setTrackElement("SHORTCUT_KEY");
toggleCreateIssueModal(true); toggleCreateIssueModal(true);
@ -148,6 +160,7 @@ export const CommandPalette: FC = observer(() => {
toggleCreateIssueModal, toggleCreateIssueModal,
projectId, projectId,
workspaceSlug, workspaceSlug,
isAnyModalOpen,
] ]
); );