mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
47abe9db5e
* style: gantt chart polishing * chore: sidebar y-axis drag and drop * chore: remove y-axis drag and drop from the main content * refactor: drop end function * refactor: resizing logic * chore: x-axis block move * chore: x-axis block move flag * chore: update scroll end logic * style: modules gantt chart * style: block background tint * refactor: context dispatcher types * refactor: draggable component * chore: filters added to gantt chart * refactor: folder structure * style: cycle blocks * chore: move to block arrow * chore: move to block on the right side arrow * chore: added proper comments for functions * refactor: blocks render logic * fix: x-axis drag and drop * chore: minor ui fixes * chore: remove link tag from blocks --------- Co-authored-by: Aaryan Khandelwal <aaryan610@Aaryans-MacBook-Pro.local>
68 lines
2.3 KiB
TypeScript
68 lines
2.3 KiB
TypeScript
import { useRouter } from "next/router";
|
|
|
|
// ui
|
|
import { Tooltip } from "components/ui";
|
|
// icons
|
|
import { getStateGroupIcon } from "components/icons";
|
|
// helpers
|
|
import { findTotalDaysInRange, renderShortDate } from "helpers/date-time.helper";
|
|
// types
|
|
import { IIssue } from "types";
|
|
|
|
export const IssueGanttBlock = ({ data }: { data: IIssue }) => {
|
|
const router = useRouter();
|
|
const { workspaceSlug } = router.query;
|
|
|
|
return (
|
|
<div
|
|
className="flex items-center relative h-full w-full rounded"
|
|
style={{ backgroundColor: data?.state_detail?.color }}
|
|
onClick={() => router.push(`/${workspaceSlug}/projects/${data?.project}/issues/${data?.id}`)}
|
|
>
|
|
<div className="absolute top-0 left-0 h-full w-full bg-custom-background-100/50" />
|
|
<Tooltip
|
|
tooltipContent={
|
|
<div className="space-y-1">
|
|
<h5>{data?.name}</h5>
|
|
<div>
|
|
{renderShortDate(data?.start_date ?? "")} to{" "}
|
|
{renderShortDate(data?.target_date ?? "")}
|
|
</div>
|
|
</div>
|
|
}
|
|
position="top-left"
|
|
>
|
|
<div className="relative text-custom-text-100 text-sm truncate py-1 px-2.5 w-full">
|
|
{data?.name}
|
|
</div>
|
|
</Tooltip>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
// rendering issues on gantt sidebar
|
|
export const IssueGanttSidebarBlock = ({ data }: { data: IIssue }) => {
|
|
const router = useRouter();
|
|
const { workspaceSlug } = router.query;
|
|
|
|
const duration = findTotalDaysInRange(data?.start_date ?? "", data?.target_date ?? "", true);
|
|
|
|
return (
|
|
<div
|
|
className="relative w-full flex items-center gap-2 h-full"
|
|
onClick={() => router.push(`/${workspaceSlug}/projects/${data?.project}/issues/${data?.id}`)}
|
|
>
|
|
{getStateGroupIcon(data?.state_detail?.group, "14", "14", data?.state_detail?.color)}
|
|
<div className="text-xs text-custom-text-300 flex-shrink-0">
|
|
{data?.project_detail?.identifier} {data?.sequence_id}
|
|
</div>
|
|
<div className="flex items-center justify-between gap-2 w-full flex-grow truncate">
|
|
<h6 className="text-sm font-medium flex-grow truncate">{data?.name}</h6>
|
|
<span className="flex-shrink-0 text-sm text-custom-text-200">
|
|
{duration} day{duration > 1 ? "s" : ""}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|