// react import React, { useState } from "react"; // next import { useRouter } from "next/router"; // react hook forms import { Control, Controller, useWatch } from "react-hook-form"; // icons import { BlockedIcon, BlockerIcon } from "components/icons"; import { ChevronDown, PlayIcon, User, X, CalendarDays, LayoutGrid, Users } from "lucide-react"; // hooks import useEstimateOption from "hooks/use-estimate-option"; // ui import { SecondaryButton, CustomDatePicker } from "components/ui"; // components import { Label, StateSelect, PrioritySelect, AssigneeSelect, EstimateSelect, ParentSelect, BlockerSelect, } from "components/web-view"; // types import type { IIssue } from "types"; type Props = { control: Control; submitChanges: (data: Partial) => Promise; }; export const IssuePropertiesDetail: React.FC = (props) => { const { control, submitChanges } = props; const blockerIssue = useWatch({ control, name: "blocker_issues", }); const blockedIssue = useWatch({ control, name: "blocked_issues", }); const startDate = useWatch({ control, name: "start_date", }); const router = useRouter(); const { workspaceSlug } = router.query; const [isViewAllOpen, setIsViewAllOpen] = useState(false); const { isEstimateActive } = useEstimateOption(); return (
State
( submitChanges({ state: val })} /> )} />
Priority
( submitChanges({ priority: val })} /> )} />
Assignee
( submitChanges({ assignees_list: [val] })} /> )} />
{isViewAllOpen && ( <> {isEstimateActive && (
Estimate
( submitChanges({ estimate_point: val })} /> )} />
)}
Parent
( submitChanges({ parent: val })} /> )} />
Blocking
( submitChanges({ blocker_issues: val, blockers_list: val?.map((i: any) => i.blocker_issue_detail?.id ?? ""), }) } /> )} />
{blockerIssue && blockerIssue.map((issue) => (
{`${issue.blocker_issue_detail?.project_detail.identifier}-${issue.blocker_issue_detail?.sequence_id}`}
))}
Blocked by
( submitChanges({ blocked_issues: val, blocks_list: val?.map((i: any) => i.blocker_issue_detail?.id ?? ""), }) } /> )} />
{blockedIssue && blockedIssue.map((issue) => (
{`${issue?.blocked_issue_detail?.project_detail?.identifier}-${issue?.blocked_issue_detail?.sequence_id}`}
))}
Due date
( submitChanges({ target_date: val, }) } className="border-transparent !shadow-none !w-[6.75rem]" minDate={startDate ? new Date(startDate) : undefined} /> )} />
)}
setIsViewAllOpen((prev) => !prev)} className="w-full flex justify-center items-center gap-1 !py-2" > {isViewAllOpen ? "View less" : "View all"}
); };