// mobx import { observer } from "mobx-react-lite"; // headless ui import { Disclosure } from "@headlessui/react"; import { getStateGroupIcon } from "components/icons"; // hooks import useToast from "hooks/use-toast"; import useUser from "hooks/use-user"; // components import { SidebarAssigneeSelect, SidebarEstimateSelect, SidebarPrioritySelect, SidebarStateSelect, TPeekOverviewModes, } from "components/issues"; // ui import { CustomDatePicker, Icon } from "components/ui"; // helpers import { copyTextToClipboard } from "helpers/string.helper"; // types import { IIssue } from "types"; type Props = { handleDeleteIssue: () => void; handleUpdateIssue: (formData: Partial) => Promise; issue: IIssue; mode: TPeekOverviewModes; readOnly: boolean; workspaceSlug: string; }; export const PeekOverviewIssueProperties: React.FC = ({ handleDeleteIssue, handleUpdateIssue, issue, mode, readOnly, workspaceSlug, }) => { const { setToastAlert } = useToast(); const startDate = issue.start_date; const targetDate = issue.target_date; const minDate = startDate ? new Date(startDate) : null; minDate?.setDate(minDate.getDate()); const maxDate = targetDate ? new Date(targetDate) : null; maxDate?.setDate(maxDate.getDate()); const handleCopyLink = () => { const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; copyTextToClipboard( `${originURL}/${workspaceSlug}/projects/${issue.project}/issues/${issue.id}` ).then(() => { setToastAlert({ type: "success", title: "Link copied!", message: "Issue link copied to clipboard", }); }); }; return (
{mode === "full" && (
{getStateGroupIcon(issue.state_detail.group, "16", "16", issue.state_detail.color)} {issue.project_detail.identifier}-{issue.sequence_id}
)}
State
handleUpdateIssue({ state: val })} disabled={readOnly} />
Assignees
handleUpdateIssue({ assignees_list: val })} disabled={readOnly} />
Priority
handleUpdateIssue({ priority: val })} disabled={readOnly} />
Start date
handleUpdateIssue({ start_date: val, }) } className="bg-custom-background-80 border-none" maxDate={maxDate ?? undefined} disabled={readOnly} />
Due date
handleUpdateIssue({ target_date: val, }) } className="bg-custom-background-80 border-none" minDate={minDate ?? undefined} disabled={readOnly} />
{/*
Estimate
handleUpdateIssue({ estimate_point: val })} disabled={readOnly} />
*/} {/* {({ open }) => ( <> Show {open ? "Less" : "More"} Disclosure Panel )} */}
); };