import React from "react"; import { observer } from "mobx-react-lite"; import { MoveRight } from "lucide-react"; import { Listbox, Transition } from "@headlessui/react"; // ui import { Icon } from "@/components/ui"; // helpers import { copyTextToClipboard } from "@/helpers/string.helper"; // hooks import { useIssueDetails } from "@/hooks/store"; import useToast from "@/hooks/use-toast"; // store import { IPeekMode } from "@/store/issue-detail.store"; // types import { IIssue } from "@/types/issue"; type Props = { handleClose: () => void; issueDetails: IIssue | undefined; }; 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 = observer((props) => { const { handleClose } = props; const { peekMode, setPeekMode } = useIssueDetails(); const { setToastAlert } = useToast(); const handleCopyLink = () => { const urlToCopy = window.location.href; copyTextToClipboard(urlToCopy).then(() => { setToastAlert({ type: "success", title: "Link copied!", message: "Issue link copied to clipboard", }); }); }; return ( <>
{peekMode === "side" && ( )} setPeekMode(val)} className="relative flex-shrink-0 text-left" > m.key === peekMode)?.icon ?? ""} />
{peekModes.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 && }
)}
))}
{(peekMode === "side" || peekMode === "modal") && (
)}
); });