import { useRouter } from "next/router"; import { ArrowRightAlt, CloseFullscreen, East, OpenInFull } from "@mui/icons-material"; // hooks import useToast from "hooks/use-toast"; // ui import { Icon } from "components/ui"; // helpers import { copyTextToClipboard } from "helpers/string.helper"; // store import { IPeekMode } from "store/issue_details"; import { RootStore } from "store/root"; // lib import { useMobxStore } from "lib/mobx/store-provider"; // types import { IIssue } from "types"; type Props = { handleClose: () => void; issueDetails: IIssue; }; const peekModes: { key: IPeekMode; icon: string; label: string; }[] = [ { key: "side", icon: "side_navigation", label: "Side Peek" }, { key: "modal", icon: "dialogs", label: "Modal Peek", }, { key: "full", icon: "nearby", label: "Full Screen Peek", }, ]; export const PeekOverviewHeader: React.FC = (props) => { const { issueDetails, handleClose } = props; const { issueDetails: issueDetailStore }: RootStore = useMobxStore(); const router = useRouter(); const { workspaceSlug } = router.query; const { setToastAlert } = useToast(); const handleCopyLink = () => { const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${issueDetails.project}/`).then(() => { setToastAlert({ type: "success", title: "Link copied!", message: "Issue link copied to clipboard", }); }); }; return (
{issueDetailStore.peekMode === "side" && ( )} {issueDetailStore.peekMode === "modal" || issueDetailStore.peekMode === "full" ? ( ) : ( )}
{(issueDetailStore.peekMode === "side" || issueDetailStore.peekMode === "modal") && (
)}
); };