import { FC } from "react"; import { observer } from "mobx-react-lite"; import { Signal, Tag, Triangle, LayoutPanelTop, CircleDot, CopyPlus, XCircle, CalendarClock, CalendarCheck2, } from "lucide-react"; // hooks // ui icons import { DiceIcon, DoubleCircleIcon, UserGroupIcon, ContrastIcon, RelatedIcon } from "@plane/ui"; // components import { DateDropdown, EstimateDropdown, PriorityDropdown, MemberDropdown, StateDropdown } from "components/dropdowns"; import { IssueLinkRoot, IssueCycleSelect, IssueModuleSelect, IssueParentSelect, IssueLabel, TIssueOperations, IssueRelationSelect, } from "components/issues"; // helpers import { cn } from "helpers/common.helper"; import { getDate, renderFormattedPayloadDate } from "helpers/date-time.helper"; import { shouldHighlightIssueDueDate } from "helpers/issue.helper"; import { useIssueDetail, useProject, useProjectState } from "hooks/store"; 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(); const { getStateById } = useProjectState(); // derived values const issue = getIssueById(issueId); if (!issue) return <>; const projectDetails = getProjectById(issue.project_id); const isEstimateEnabled = projectDetails?.estimate; const stateDetails = getStateById(issue.state_id); const minDate = getDate(issue.start_date); minDate?.setDate(minDate.getDate()); const maxDate = getDate(issue.target_date); 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 > 1 ? "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" // TODO: add this logic // showPlaceholderIcon />
{/* 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={cn("text-sm", { "text-custom-text-400": !issue.target_date, "text-red-500": shouldHighlightIssueDueDate(issue.target_date, stateDetails?.group), })} hideIcon clearIconClassName="h-3 w-3 hidden group-hover:inline !text-custom-text-100" // TODO: add this logic // showPlaceholderIcon />
{/* 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
); });