forked from github/plane
chore: issue peek overview improvement (#3821)
This commit is contained in:
parent
895ff03cf2
commit
1f5d54260a
@ -5,6 +5,7 @@ import { observer } from "mobx-react-lite";
|
|||||||
// hooks
|
// hooks
|
||||||
import useOutsideClickDetector from "hooks/use-outside-click-detector";
|
import useOutsideClickDetector from "hooks/use-outside-click-detector";
|
||||||
import useKeypress from "hooks/use-keypress";
|
import useKeypress from "hooks/use-keypress";
|
||||||
|
import useToast from "hooks/use-toast";
|
||||||
// store hooks
|
// store hooks
|
||||||
import { useIssueDetail } from "hooks/store";
|
import { useIssueDetail } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
@ -47,12 +48,18 @@ export const IssueView: FC<IIssueView> = observer((props) => {
|
|||||||
issue: { getIssueById },
|
issue: { getIssueById },
|
||||||
} = useIssueDetail();
|
} = useIssueDetail();
|
||||||
const issue = getIssueById(issueId);
|
const issue = getIssueById(issueId);
|
||||||
|
// hooks
|
||||||
|
const { alerts } = useToast();
|
||||||
// remove peek id
|
// remove peek id
|
||||||
const removeRoutePeekId = () => {
|
const removeRoutePeekId = () => {
|
||||||
setPeekIssue(undefined);
|
setPeekIssue(undefined);
|
||||||
};
|
};
|
||||||
// hooks
|
|
||||||
useOutsideClickDetector(issuePeekOverviewRef, () => !isAnyModalOpen && removeRoutePeekId());
|
useOutsideClickDetector(issuePeekOverviewRef, () => {
|
||||||
|
if (!isAnyModalOpen && (!alerts || alerts.length === 0)) {
|
||||||
|
removeRoutePeekId();
|
||||||
|
}
|
||||||
|
});
|
||||||
const handleKeyDown = () => !isAnyModalOpen && removeRoutePeekId();
|
const handleKeyDown = () => !isAnyModalOpen && removeRoutePeekId();
|
||||||
useKeypress("Escape", handleKeyDown);
|
useKeypress("Escape", handleKeyDown);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user