import { FC, useState } from "react"; import { observer } from "mobx-react"; import { LayoutPanelTop } from "lucide-react"; import { ISearchIssueResponse, TIssue } from "@plane/types"; // components import { CycleDropdown, DateDropdown, EstimateDropdown, ModuleDropdown, PriorityDropdown, MemberDropdown, StateDropdown, } from "@/components/dropdowns"; import { ParentIssuesListModal } from "@/components/issues"; import { IssueLabelSelect } from "@/components/issues/select"; // helpers import { renderFormattedPayloadDate, getDate } from "@/helpers/date-time.helper"; // hooks import { useEstimate } from "@/hooks/store"; type TInboxIssueProperties = { projectId: string; data: Partial; handleData: (issueKey: keyof Partial, issueValue: Partial[keyof Partial]) => void; isVisible?: boolean; }; export const InboxIssueProperties: FC = observer((props) => { const { projectId, data, handleData, isVisible = false } = props; // hooks const { areEstimatesEnabledForProject } = useEstimate(); // states const [parentIssueModalOpen, setParentIssueModalOpen] = useState(false); const [selectedParentIssue, setSelectedParentIssue] = useState(undefined); true; const startDate = data?.start_date; const targetDate = data?.target_date; const minDate = getDate(startDate); minDate?.setDate(minDate.getDate()); const maxDate = getDate(targetDate); maxDate?.setDate(maxDate.getDate()); return (
{/* state */}
handleData("state_id", stateId)} projectId={projectId} buttonVariant="border-with-text" />
{/* priority */}
handleData("priority", priority)} buttonVariant="border-with-text" />
{/* Assignees */}
handleData("assignee_ids", assigneeIds)} buttonVariant={(data?.assignee_ids || [])?.length > 0 ? "transparent-without-text" : "border-with-text"} buttonClassName={(data?.assignee_ids || [])?.length > 0 ? "hover:bg-transparent" : ""} placeholder="Assignees" multiple />
{/* labels */}
{}} value={data?.label_ids || []} onChange={(labelIds) => handleData("label_ids", labelIds)} projectId={projectId} />
{/* start date */} {isVisible && (
(date ? handleData("start_date", renderFormattedPayloadDate(date)) : null)} buttonVariant="border-with-text" minDate={minDate ?? undefined} placeholder="Start date" />
)} {/* due date */}
(date ? handleData("target_date", renderFormattedPayloadDate(date)) : null)} buttonVariant="border-with-text" minDate={minDate ?? undefined} placeholder="Due date" />
{/* cycle */} {isVisible && (
handleData("cycle_id", cycleId)} projectId={projectId} placeholder="Cycle" buttonVariant="border-with-text" />
)} {/* module */} {isVisible && (
handleData("module_ids", moduleIds)} projectId={projectId} placeholder="Modules" buttonVariant="border-with-text" multiple showCount />
)} {/* estimate */} {isVisible && areEstimatesEnabledForProject(projectId) && (
handleData("estimate_point", estimatePoint)} projectId={projectId} buttonVariant="border-with-text" placeholder="Estimate" />
)} {/* add parent */} {isVisible && ( <> setParentIssueModalOpen(false)} onChange={(issue) => { handleData("parent_id", issue?.id); setSelectedParentIssue(issue); }} projectId={projectId} issueId={undefined} /> )}
); });