/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import React from "react"; import { observer } from "mobx-react"; import { ArrowNarrowRightOutline, FullScreenPeekOutline, LinkOutline, ModalPeekOutline, SidePeekOutline, } from "@makeplane/propel/icons"; import { Listbox, Transition } from "@headlessui/react"; // ui import { TOAST_TYPE, setToast } from "@plane/propel/toast"; // helpers import { copyTextToClipboard } from "@/helpers/string.helper"; // hooks import { useIssueDetails } from "@/hooks/store/use-issue-details"; import useClipboardWritePermission from "@/hooks/use-clipboard-write-permission"; // types import type { IIssue, IPeekMode } from "@/types/issue"; type Props = { handleClose: () => void; issueDetails: IIssue | undefined; }; const PEEK_MODES: { key: IPeekMode; icon: any; label: string; }[] = [ { key: "side", icon: SidePeekOutline, label: "Side Peek" }, { key: "modal", icon: ModalPeekOutline, label: "Modal", }, { key: "full", icon: FullScreenPeekOutline, label: "Full Screen", }, ]; export const PeekOverviewHeader = observer(function PeekOverviewHeader(props: 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: "Work item link copied to clipboard.", }); }); }; const Icon = PEEK_MODES.find((m) => m.key === peekMode)?.icon ?? SidePeekOutline; return ( <>