From 1f5d54260af3edb13e7af04e58a3075fbdf43636 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:22:20 +0530 Subject: [PATCH] chore: issue peek overview improvement (#3821) --- web/components/issues/peek-overview/view.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web/components/issues/peek-overview/view.tsx b/web/components/issues/peek-overview/view.tsx index e69692ecc..8f49a00b7 100644 --- a/web/components/issues/peek-overview/view.tsx +++ b/web/components/issues/peek-overview/view.tsx @@ -5,6 +5,7 @@ import { observer } from "mobx-react-lite"; // hooks import useOutsideClickDetector from "hooks/use-outside-click-detector"; import useKeypress from "hooks/use-keypress"; +import useToast from "hooks/use-toast"; // store hooks import { useIssueDetail } from "hooks/store"; // components @@ -47,12 +48,18 @@ export const IssueView: FC = observer((props) => { issue: { getIssueById }, } = useIssueDetail(); const issue = getIssueById(issueId); + // hooks + const { alerts } = useToast(); // remove peek id const removeRoutePeekId = () => { setPeekIssue(undefined); }; - // hooks - useOutsideClickDetector(issuePeekOverviewRef, () => !isAnyModalOpen && removeRoutePeekId()); + + useOutsideClickDetector(issuePeekOverviewRef, () => { + if (!isAnyModalOpen && (!alerts || alerts.length === 0)) { + removeRoutePeekId(); + } + }); const handleKeyDown = () => !isAnyModalOpen && removeRoutePeekId(); useKeypress("Escape", handleKeyDown);