import React, { useEffect, useState } from "react"; import { useRouter } from "next/router"; import { Dialog, Transition } from "@headlessui/react"; import { observer } from "mobx-react-lite"; // components import { FullScreenPeekView, SidePeekView } from "components/issues/peek-overview"; // types import type { IIssue } from "types/issue"; // lib import { useMobxStore } from "lib/mobx/store-provider"; type Props = { isOpen: boolean; onClose: () => void; }; export const IssuePeekOverview: React.FC = observer((props) => { const { isOpen, onClose } = props; // router const router = useRouter(); const { workspace_slug, project_slug } = router.query; // store const { issueDetails: issueDetailStore } = useMobxStore(); const issueDetails = issueDetailStore.peekId ? issueDetailStore.details[issueDetailStore.peekId] : null; console.log("issueDetails", issueDetails); useEffect(() => { if (workspace_slug && project_slug && issueDetailStore.peekId) { if (!issueDetails) { issueDetailStore.fetchIssueDetails(workspace_slug.toString(), project_slug.toString(), issueDetailStore.peekId); } } }, [workspace_slug, project_slug, issueDetailStore, issueDetails]); const handleClose = () => { onClose(); issueDetailStore.setPeekMode("side"); }; return ( {/* add backdrop conditionally */} {(issueDetailStore.peekMode === "modal" || issueDetailStore.peekMode === "full") && (
)}
{(issueDetailStore.peekMode === "side" || issueDetailStore.peekMode === "modal") && ( )} {issueDetailStore.peekMode === "full" && ( )}
); });