import { FC } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react"; import { MoveRight, MoveDiagonal, Link2, Trash2 } from "lucide-react"; // ui import { CenterPanelIcon, CustomSelect, FullScreenPanelIcon, SidePanelIcon } from "@plane/ui"; // helpers import { copyUrlToClipboard } from "helpers/string.helper"; // hooks import useToast from "hooks/use-toast"; // store hooks import { useUser } from "hooks/store"; // components import { IssueSubscription, IssueUpdateStatus } from "components/issues"; export type TPeekModes = "side-peek" | "modal" | "full-screen"; const PEEK_OPTIONS: { key: TPeekModes; icon: any; title: string }[] = [ { key: "side-peek", icon: SidePanelIcon, title: "Side Peek", }, { key: "modal", icon: CenterPanelIcon, title: "Modal", }, { key: "full-screen", icon: FullScreenPanelIcon, title: "Full Screen", }, ]; export type PeekOverviewHeaderProps = { peekMode: TPeekModes; setPeekMode: (value: TPeekModes) => void; removeRoutePeekId: () => void; workspaceSlug: string; projectId: string; issueId: string; isArchived: boolean; disabled: boolean; toggleDeleteIssueModal: (value: boolean) => void; isSubmitting: "submitting" | "submitted" | "saved"; }; export const IssuePeekOverviewHeader: FC = observer((props) => { const { peekMode, setPeekMode, workspaceSlug, projectId, issueId, isArchived, disabled, removeRoutePeekId, toggleDeleteIssueModal, isSubmitting, } = props; // router const router = useRouter(); // store hooks const { currentUser } = useUser(); // hooks const { setToastAlert } = useToast(); // derived values const currentMode = PEEK_OPTIONS.find((m) => m.key === peekMode); const handleCopyText = (e: React.MouseEvent) => { e.stopPropagation(); e.preventDefault(); copyUrlToClipboard( `${workspaceSlug}/projects/${projectId}/${isArchived ? "archived-issues" : "issues"}/${issueId}` ).then(() => { setToastAlert({ type: "success", title: "Link Copied!", message: "Issue link copied to clipboard.", }); }); }; const redirectToIssueDetail = () => { router.push({ pathname: `/${workspaceSlug}/projects/${projectId}/${isArchived ? "archived-issues" : "issues"}/${issueId}`, }); removeRoutePeekId(); }; return (
{currentMode && (
setPeekMode(val)} customButton={ } > {PEEK_OPTIONS.map((mode) => (
{mode.title}
))}
)}
{currentUser && !isArchived && ( )} {!disabled && ( )}
); });