// headless ui import { Disclosure } from "@headlessui/react"; import { getStateGroupIcon } from "components/icons"; // components import { SidebarAssigneeSelect, SidebarEstimateSelect, SidebarPrioritySelect, SidebarStateSelect, TPeekOverviewModes, } from "components/issues"; // icons import { CustomDatePicker, Icon } from "components/ui"; import { copyTextToClipboard } from "helpers/string.helper"; import useToast from "hooks/use-toast"; // types import { IIssue } from "types"; type Props = { handleDeleteIssue: () => void; issue: IIssue; mode: TPeekOverviewModes; onChange: (issueProperty: Partial) => void; readOnly: boolean; workspaceSlug: string; }; export const PeekOverviewIssueProperties: React.FC = ({ handleDeleteIssue, issue, mode, onChange, 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
onChange({ state: val })} disabled={readOnly} />
Assignees
onChange({ assignees_list: val })} disabled={readOnly} />
Priority
onChange({ priority: val })} disabled={readOnly} />
Start date
{issue.start_date ? ( onChange({ start_date: val, }) } className="bg-custom-background-100" wrapperClassName="w-full" maxDate={maxDate ?? undefined} disabled={readOnly} /> ) : ( Empty )}
Due date
{issue.target_date ? ( onChange({ target_date: val, }) } className="bg-custom-background-100" wrapperClassName="w-full" minDate={minDate ?? undefined} disabled={readOnly} /> ) : ( Empty )}
{/*
Estimate
onChange({ estimate_point: val })} disabled={readOnly} />
*/} {/* {({ open }) => ( <> Show {open ? "Less" : "More"} Disclosure Panel )} */}
); };