Skip to content

Commit

Permalink
chore: issue peek overview improvement (#3821)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolsinghbhatia authored Feb 28, 2024
1 parent 895ff03 commit 1f5d542
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions web/components/issues/peek-overview/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -47,12 +48,18 @@ export const IssueView: FC<IIssueView> = 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);

Expand Down

0 comments on commit 1f5d542

Please sign in to comment.