forked from github/plane
e08fc59114
* feat: spreadsheet view * fix: fix scroll and overflow issues, feat: updated issue properties component, style: ui improvements * feat: sub-issue toggle and sub-issue hook added, chore: code refactor * fix: only render parent issue * feat: sub issue fetching hook updated and nested sub issue added, chore: code refactor * style: title sticky to left on scroll and column styling * fix: tooltip , filter and view z-index fix * feat: spreadsheet view column sorting, fix: sticky scroll issue fix * feat: updated issue view filter for spreadsheet view * style: spreadsheet view column * feat: double click to edit title * fix: estimate sorting fix * style: spreadsheet view columns * fix: spreadsheet view mutation, feat: edit , copy and delete option added * fix: edit sub issue fix
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
import { useRouter } from "next/router";
|
|
|
|
// ui
|
|
import { CustomDatePicker, Tooltip } from "components/ui";
|
|
// helpers
|
|
import { findHowManyDaysLeft } from "helpers/date-time.helper";
|
|
// services
|
|
import trackEventServices from "services/track-event.service";
|
|
// types
|
|
import { ICurrentUserResponse, IIssue } from "types";
|
|
|
|
type Props = {
|
|
issue: IIssue;
|
|
partialUpdateIssue: (formData: Partial<IIssue>, issueId: string) => void;
|
|
noBorder?: boolean;
|
|
user: ICurrentUserResponse | undefined;
|
|
isNotAllowed: boolean;
|
|
};
|
|
|
|
export const ViewDueDateSelect: React.FC<Props> = ({
|
|
issue,
|
|
partialUpdateIssue,
|
|
noBorder = false,
|
|
user,
|
|
isNotAllowed,
|
|
}) => {
|
|
const router = useRouter();
|
|
const { workspaceSlug } = router.query;
|
|
|
|
return (
|
|
<Tooltip tooltipHeading="Due Date" tooltipContent={issue.target_date ?? "N/A"}>
|
|
<div
|
|
className={`group relative max-w-[6.5rem] ${
|
|
issue.target_date === null
|
|
? ""
|
|
: issue.target_date < new Date().toISOString()
|
|
? "text-red-600"
|
|
: findHowManyDaysLeft(issue.target_date) <= 3 && "text-orange-400"
|
|
}`}
|
|
>
|
|
<CustomDatePicker
|
|
placeholder="Due date"
|
|
value={issue?.target_date}
|
|
onChange={(val) => {
|
|
partialUpdateIssue(
|
|
{
|
|
target_date: val,
|
|
priority: issue.priority,
|
|
state: issue.state,
|
|
},
|
|
issue.id
|
|
);
|
|
trackEventServices.trackIssuePartialPropertyUpdateEvent(
|
|
{
|
|
workspaceSlug,
|
|
workspaceId: issue.workspace,
|
|
projectId: issue.project_detail.id,
|
|
projectIdentifier: issue.project_detail.identifier,
|
|
projectName: issue.project_detail.name,
|
|
issueId: issue.id,
|
|
},
|
|
"ISSUE_PROPERTY_UPDATE_DUE_DATE",
|
|
user
|
|
);
|
|
}}
|
|
className={issue?.target_date ? "w-[6.5rem]" : "w-[5rem] text-center"}
|
|
noBorder={noBorder}
|
|
disabled={isNotAllowed}
|
|
/>
|
|
</div>
|
|
</Tooltip>
|
|
);
|
|
};
|