import React from "react"; import { observer } from "mobx-react"; import { useRouter } from "next/router"; import { CalendarCheck2, CopyPlus, Signal, Tag } from "lucide-react"; import { TInboxDuplicateIssueDetails, TIssue } from "@plane/types"; import { ControlLink, DoubleCircleIcon, Tooltip, UserGroupIcon } from "@plane/ui"; // components import { DateDropdown, PriorityDropdown, MemberDropdown, StateDropdown } from "@/components/dropdowns"; import { IssueLabel, TIssueOperations } from "@/components/issues"; // helper import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; // hooks import { useProject } from "@/hooks/store"; type Props = { workspaceSlug: string; projectId: string; issue: Partial; issueOperations: TIssueOperations; isEditable: boolean; duplicateIssueDetails: TInboxDuplicateIssueDetails | undefined; }; export const InboxIssueProperties: React.FC = observer((props) => { const { workspaceSlug, projectId, issue, issueOperations, isEditable, duplicateIssueDetails } = props; const router = useRouter(); // store hooks const { currentProjectDetails } = useProject(); const minDate = issue.start_date ? getDate(issue.start_date) : null; minDate?.setDate(minDate.getDate()); if (!issue || !issue?.id) return <>; return (
Properties
{/* State */}
State
{issue?.state_id && ( issue?.id && issueOperations.update(workspaceSlug, projectId, issue?.id, { state_id: val }) } projectId={projectId?.toString() ?? ""} disabled={!isEditable} buttonVariant="transparent-with-text" className="w-3/5 flex-grow group" buttonContainerClassName="w-full text-left" buttonClassName="text-sm" dropdownArrow dropdownArrowClassName="h-3.5 w-3.5 hidden group-hover:inline" /> )}
{/* Assignee */}
Assignees
issue?.id && issueOperations.update(workspaceSlug, projectId, issue?.id, { assignee_ids: val }) } disabled={!isEditable} projectId={projectId?.toString() ?? ""} placeholder="Add assignees" multiple buttonVariant={ (issue?.assignee_ids || [])?.length > 0 ? "transparent-without-text" : "transparent-with-text" } className="w-3/5 flex-grow group" buttonContainerClassName="w-full text-left" buttonClassName={`text-sm justify-between ${ (issue?.assignee_ids || [])?.length > 0 ? "" : "text-custom-text-400" }`} hideIcon={issue.assignee_ids?.length === 0} dropdownArrow dropdownArrowClassName="h-3.5 w-3.5 hidden group-hover:inline" />
{/* Priority */}
Priority
issue?.id && issueOperations.update(workspaceSlug, projectId, issue?.id, { priority: val }) } disabled={!isEditable} buttonVariant="border-with-text" className="w-3/5 flex-grow rounded px-2 hover:bg-custom-background-80" buttonContainerClassName="w-full text-left" buttonClassName="w-min h-auto whitespace-nowrap" />
{/* Due Date */}
Due date
issue?.id && issueOperations.update(workspaceSlug, projectId, issue?.id, { target_date: val ? renderFormattedPayloadDate(val) : null, }) } minDate={minDate ?? undefined} disabled={!isEditable} buttonVariant="transparent-with-text" className="w-3/5 flex-grow group" buttonContainerClassName="w-full text-left" buttonClassName={`text-sm ${issue?.target_date ? "" : "text-custom-text-400"}`} hideIcon clearIconClassName="h-3 w-3 hidden group-hover:inline" />
{/* Labels */}
Labels
{issue?.id && ( issue?.id && issueOperations.update(workspaceSlug, projectId, issue?.id, { label_ids: val }) } /> )}
{/* duplicate to*/} {duplicateIssueDetails && (
Duplicate of
{ router.push(`/${workspaceSlug}/projects/${projectId}/issues/${duplicateIssueDetails?.id}`); }} > {`${currentProjectDetails?.identifier}-${duplicateIssueDetails?.sequence_id}`}
)}
); });