import React, { useState } from "react"; // headless ui import { Dialog, Transition } from "@headlessui/react"; import { FullScreenPeekView, SidePeekView } from "components/issues"; // types import { IIssue } from "types"; type Props = { handleDeleteIssue: () => void; handleUpdateIssue: (issue: Partial) => Promise; issue: IIssue | null; isOpen: boolean; onClose: () => void; workspaceSlug: string; readOnly: boolean; }; export type TPeekOverviewModes = "side" | "modal" | "full"; export const IssuePeekOverview: React.FC = ({ handleDeleteIssue, handleUpdateIssue, issue, isOpen, onClose, workspaceSlug, readOnly, }) => { const [peekOverviewMode, setPeekOverviewMode] = useState("side"); const handleClose = () => { onClose(); setPeekOverviewMode("side"); }; if (!issue || !isOpen) return null; return ( {/* add backdrop conditionally */} {(peekOverviewMode === "modal" || peekOverviewMode === "full") && (
)}
{(peekOverviewMode === "side" || peekOverviewMode === "modal") && ( setPeekOverviewMode(mode)} workspaceSlug={workspaceSlug} /> )} {peekOverviewMode === "full" && ( setPeekOverviewMode(mode)} workspaceSlug={workspaceSlug} /> )}
); };