import { FC } from "react"; import { observer } from "mobx-react-lite"; import { Signal, Tag, Triangle, LayoutPanelTop, CircleDot, CopyPlus, XCircle, CalendarClock, CalendarCheck2, } from "lucide-react"; // hooks import { useIssueDetail, useProject } from "hooks/store"; // ui icons import { DiceIcon, DoubleCircleIcon, UserGroupIcon, ContrastIcon, RelatedIcon } from "@plane/ui"; import { IssueLinkRoot, IssueCycleSelect, IssueModuleSelect, IssueParentSelect, IssueLabel, TIssueOperations, IssueRelationSelect, } from "components/issues"; import { DateDropdown, EstimateDropdown, PriorityDropdown, ProjectMemberDropdown, StateDropdown, } from "components/dropdowns"; // components import { renderFormattedPayloadDate } from "helpers/date-time.helper"; interface IPeekOverviewProperties { workspaceSlug: string; projectId: string; issueId: string; disabled: boolean; issueOperations: TIssueOperations; } export const PeekOverviewProperties: FC = observer((props) => { const { workspaceSlug, projectId, issueId, issueOperations, disabled } = props; // store hooks const { getProjectById } = useProject(); const { issue: { getIssueById }, } = useIssueDetail(); // derived values const issue = getIssueById(issueId); if (!issue) return <>; const projectDetails = getProjectById(issue.project_id); const isEstimateEnabled = projectDetails?.estimate; const minDate = issue.start_date ? new Date(issue.start_date) : null; minDate?.setDate(minDate.getDate()); const maxDate = issue.target_date ? new Date(issue.target_date) : null; maxDate?.setDate(maxDate.getDate()); return (
Properties
{/* TODO: render properties using a common component */}
{/* state */}
State
issueOperations.update(workspaceSlug, projectId, issueId, { state_id: val })} projectId={projectId} disabled={disabled} buttonVariant="transparent-with-text" className="w-3/4 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
issueOperations.update(workspaceSlug, projectId, issueId, { assignee_ids: val })} disabled={disabled} projectId={projectId} placeholder="Add assignees" multiple buttonVariant={issue?.assignee_ids?.length > 0 ? "transparent-without-text" : "transparent-with-text"} className="w-3/4 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
issueOperations.update(workspaceSlug, projectId, issueId, { priority: val })} disabled={disabled} buttonVariant="border-with-text" className="w-3/4 flex-grow rounded px-2 hover:bg-custom-background-80 group" buttonContainerClassName="w-full text-left" buttonClassName="w-min h-auto whitespace-nowrap" />
{/* start date */}
Start date
issueOperations.update(workspaceSlug, projectId, issueId, { start_date: val ? renderFormattedPayloadDate(val) : null, }) } placeholder="Add start date" buttonVariant="transparent-with-text" maxDate={maxDate ?? undefined} disabled={disabled} className="w-3/4 flex-grow group" buttonContainerClassName="w-full text-left" buttonClassName={`text-sm ${issue?.start_date ? "" : "text-custom-text-400"}`} hideIcon clearIconClassName="h-3 w-3 hidden group-hover:inline" />
{/* due date */}
Due date
issueOperations.update(workspaceSlug, projectId, issueId, { target_date: val ? renderFormattedPayloadDate(val) : null, }) } placeholder="Add due date" buttonVariant="transparent-with-text" minDate={minDate ?? undefined} disabled={disabled} className="w-3/4 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" />
{/* estimate */} {isEstimateEnabled && (
Estimate
issueOperations.update(workspaceSlug, projectId, issueId, { estimate_point: val })} projectId={projectId} disabled={disabled} buttonVariant="transparent-with-text" className="w-3/4 flex-grow group" buttonContainerClassName="w-full text-left" buttonClassName={`text-sm ${issue?.estimate_point !== null ? "" : "text-custom-text-400"}`} placeholder="None" hideIcon dropdownArrow dropdownArrowClassName="h-3.5 w-3.5 hidden group-hover:inline" />
)} {projectDetails?.module_view && (
Module
)} {projectDetails?.cycle_view && (
Cycle
)} {/* parent */}

Parent

{/* relates to */}
Relates to
{/* blocking */}
Blocking
{/* blocked by */}
Blocked by
{/* duplicate of */}
Duplicate of
{/* label */}
Labels
); });