diff --git a/apps/app/components/core/board-view/single-issue.tsx b/apps/app/components/core/board-view/single-issue.tsx index 6da636efb..7f8a89aa2 100644 --- a/apps/app/components/core/board-view/single-issue.tsx +++ b/apps/app/components/core/board-view/single-issue.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useState } from "react"; +import React, { useCallback, useEffect, useRef, useState } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; @@ -17,6 +17,7 @@ import issuesService from "services/issues.service"; // hooks import useIssuesView from "hooks/use-issues-view"; import useToast from "hooks/use-toast"; +import useOutsideClickDetector from "hooks/use-outside-click-detector"; // components import { ViewAssigneeSelect, @@ -36,6 +37,7 @@ import { XMarkIcon, ArrowTopRightOnSquareIcon, PaperClipIcon, + EllipsisHorizontalIcon, } from "@heroicons/react/24/outline"; import { LayerDiagonalIcon } from "components/icons"; // helpers @@ -90,6 +92,9 @@ export const SingleBoardIssue: React.FC = ({ // context menu const [contextMenu, setContextMenu] = useState(false); const [contextMenuPosition, setContextMenuPosition] = useState({ x: 0, y: 0 }); + const [isMenuActive, setIsMenuActive] = useState(false); + + const actionSectionRef = useRef(null); const { orderBy, params } = useIssuesView(); @@ -207,6 +212,7 @@ export const SingleBoardIssue: React.FC = ({ title: "Link Copied!", message: "Issue link copied to clipboard.", }); + setIsMenuActive(false); }); }; @@ -214,6 +220,8 @@ export const SingleBoardIssue: React.FC = ({ if (snapshot.isDragging) handleTrashBox(snapshot.isDragging); }, [snapshot, handleTrashBox]); + useOutsideClickDetector(actionSectionRef, () => setIsMenuActive(false)); + const isNotAllowed = userAuth.isGuest || userAuth.isViewer || isCompleted; return ( @@ -266,9 +274,23 @@ export const SingleBoardIssue: React.FC = ({ >
{!isNotAllowed && ( -
+