2023-10-18 14:28:05 +00:00
|
|
|
import { FC } from "react";
|
|
|
|
// ui icons
|
|
|
|
import { DoubleCircleIcon, UserGroupIcon } from "@plane/ui";
|
|
|
|
import { CalendarDays, Signal } from "lucide-react";
|
|
|
|
// components
|
|
|
|
import { IssuePropertyState } from "components/issues/issue-layouts/properties/state";
|
|
|
|
import { IssuePropertyPriority } from "components/issues/issue-layouts/properties/priority";
|
|
|
|
import { IssuePropertyAssignee } from "components/issues/issue-layouts/properties/assignee";
|
|
|
|
import { IssuePropertyDate } from "components/issues/issue-layouts/properties/date";
|
|
|
|
// types
|
2023-10-25 14:17:58 +00:00
|
|
|
import { IIssue, IState, IUserLite, TIssuePriorities } from "types";
|
2023-10-18 14:28:05 +00:00
|
|
|
|
|
|
|
interface IPeekOverviewProperties {
|
|
|
|
issue: IIssue;
|
|
|
|
issueUpdate: (issue: Partial<IIssue>) => void;
|
2023-10-25 14:17:58 +00:00
|
|
|
states: IState[] | null;
|
|
|
|
members: IUserLite[] | null;
|
2023-10-18 14:28:05 +00:00
|
|
|
priorities: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const PeekOverviewProperties: FC<IPeekOverviewProperties> = (props) => {
|
|
|
|
const { issue, issueUpdate, states, members, priorities } = props;
|
|
|
|
|
2023-10-25 14:17:58 +00:00
|
|
|
const handleState = (_state: IState) => {
|
|
|
|
issueUpdate({ ...issue, state: _state.id });
|
2023-10-18 14:28:05 +00:00
|
|
|
};
|
|
|
|
|
2023-10-25 14:17:58 +00:00
|
|
|
const handlePriority = (_priority: TIssuePriorities) => {
|
|
|
|
issueUpdate({ ...issue, priority: _priority });
|
2023-10-18 14:28:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleAssignee = (_assignees: string[]) => {
|
2023-10-25 14:17:58 +00:00
|
|
|
issueUpdate({ ...issue, assignees: _assignees });
|
2023-10-18 14:28:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleStartDate = (_startDate: string) => {
|
2023-10-25 14:17:58 +00:00
|
|
|
issueUpdate({ ...issue, start_date: _startDate });
|
2023-10-18 14:28:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleTargetDate = (_targetDate: string) => {
|
2023-10-25 14:17:58 +00:00
|
|
|
issueUpdate({ ...issue, target_date: _targetDate });
|
2023-10-18 14:28:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="space-y-4">
|
|
|
|
{/* state */}
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
<div className="flex-shrink-0 flex items-center gap-2 w-48 whitespace-nowrap">
|
|
|
|
<div className="w-4 h-4 flex justify-center items-center overflow-hidden">
|
|
|
|
<DoubleCircleIcon className="h-3.5 w-3.5 flex-shrink-0" />
|
|
|
|
</div>
|
|
|
|
<div className="font-medium text-custom-text-200 line-clamp-1">State</div>
|
|
|
|
</div>
|
|
|
|
<div className="w-full">
|
|
|
|
<IssuePropertyState
|
2023-10-25 14:17:58 +00:00
|
|
|
value={issue?.state_detail || null}
|
|
|
|
onChange={handleState}
|
|
|
|
states={states}
|
2023-10-18 14:28:05 +00:00
|
|
|
disabled={false}
|
2023-10-25 14:17:58 +00:00
|
|
|
hideDropdownArrow={true}
|
2023-10-18 14:28:05 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* assignees */}
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
<div className="flex-shrink-0 flex items-center gap-2 w-48 whitespace-nowrap">
|
|
|
|
<div className="w-4 h-4 flex justify-center items-center overflow-hidden">
|
|
|
|
<UserGroupIcon className="h-3.5 w-3.5" />
|
|
|
|
</div>
|
|
|
|
<div className="font-medium text-custom-text-200 line-clamp-1">Assignees</div>
|
|
|
|
</div>
|
|
|
|
<div className="w-full">
|
|
|
|
<IssuePropertyAssignee
|
|
|
|
value={issue?.assignees || null}
|
|
|
|
onChange={(ids: string[]) => handleAssignee(ids)}
|
|
|
|
disabled={false}
|
2023-10-25 14:17:58 +00:00
|
|
|
hideDropdownArrow={true}
|
|
|
|
members={members}
|
2023-10-18 14:28:05 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* priority */}
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
<div className="flex-shrink-0 flex items-center gap-2 w-48 whitespace-nowrap">
|
|
|
|
<div className="w-4 h-4 flex justify-center items-center overflow-hidden">
|
|
|
|
<Signal className="h-3.5 w-3.5" />
|
|
|
|
</div>
|
|
|
|
<div className="font-medium text-custom-text-200 line-clamp-1">Priority</div>
|
|
|
|
</div>
|
|
|
|
<div className="w-full">
|
|
|
|
<IssuePropertyPriority
|
|
|
|
value={issue?.priority || null}
|
2023-10-25 14:17:58 +00:00
|
|
|
onChange={handlePriority}
|
2023-10-18 14:28:05 +00:00
|
|
|
disabled={false}
|
2023-10-25 14:17:58 +00:00
|
|
|
hideDropdownArrow={true}
|
2023-10-18 14:28:05 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* start_date */}
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
<div className="flex-shrink-0 flex items-center gap-2 w-48 whitespace-nowrap">
|
|
|
|
<div className="w-4 h-4 flex justify-center items-center overflow-hidden">
|
|
|
|
<CalendarDays className="h-3.5 w-3.5" />
|
|
|
|
</div>
|
|
|
|
<div className="font-medium text-custom-text-200 line-clamp-1">Start date</div>
|
|
|
|
</div>
|
|
|
|
<div className="w-full">
|
|
|
|
<IssuePropertyDate
|
|
|
|
value={issue?.start_date || null}
|
|
|
|
onChange={(date: string) => handleStartDate(date)}
|
|
|
|
disabled={false}
|
|
|
|
placeHolder={`Start date`}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* target_date */}
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
<div className="flex-shrink-0 flex items-center gap-2 w-48 whitespace-nowrap">
|
|
|
|
<div className="w-4 h-4 flex justify-center items-center overflow-hidden">
|
|
|
|
<CalendarDays className="h-3.5 w-3.5" />
|
|
|
|
</div>
|
|
|
|
<div className="font-medium text-custom-text-200 line-clamp-1">Target date</div>
|
|
|
|
</div>
|
|
|
|
<div className="w-full">
|
|
|
|
<IssuePropertyDate
|
|
|
|
value={issue?.target_date || null}
|
|
|
|
onChange={(date: string) => handleTargetDate(date)}
|
|
|
|
disabled={false}
|
|
|
|
placeHolder={`Target date`}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|