import React from "react"; import { observer } from "mobx-react-lite"; import { Link2, MoveRight } from "lucide-react"; import { Listbox, Transition } from "@headlessui/react"; // ui import { CenterPanelIcon, FullScreenPanelIcon, setToast, SidePanelIcon, TOAST_TYPE } from "@plane/ui"; // helpers import { copyTextToClipboard } from "@/helpers/string.helper"; // hooks import { useIssueDetails } from "@/hooks/store"; import useClipboardWritePermission from "@/hooks/use-clipboard-write-permission"; // types import { IIssue, IPeekMode } from "@/types/issue"; type Props = { handleClose: () => void; issueDetails: IIssue | undefined; }; const PEEK_MODES: { key: IPeekMode; icon: any; label: string; }[] = [ { key: "side", icon: SidePanelIcon, label: "Side Peek" }, { key: "modal", icon: CenterPanelIcon, label: "Modal", }, { key: "full", icon: FullScreenPanelIcon, label: "Full Screen", }, ]; export const PeekOverviewHeader: React.FC = observer((props) => { const { handleClose } = props; const { peekMode, setPeekMode } = useIssueDetails(); const isClipboardWriteAllowed = useClipboardWritePermission(); const handleCopyLink = () => { const urlToCopy = window.location.href; copyTextToClipboard(urlToCopy).then(() => { setToast({ type: TOAST_TYPE.SUCCESS, title: "Link copied!", message: "Issue link copied to clipboard.", }); }); }; const Icon = PEEK_MODES.find((m) => m.key === peekMode)?.icon ?? SidePanelIcon; return ( <>
{peekMode === "side" && ( )} setPeekMode(val)} className="relative flex-shrink-0 text-left" >
{PEEK_MODES.map((mode) => ( `cursor-pointer select-none truncate rounded px-1 py-1.5 ${ active || selected ? "bg-custom-background-80" : "" } ${selected ? "text-custom-text-100" : "text-custom-text-200"}` } > {({ selected }) => (
{mode.label}
{selected && }
)}
))}
{isClipboardWriteAllowed && (peekMode === "side" || peekMode === "modal") && (
)}
); });