import { useRouter } from "next/router";
// ui
import { Tooltip } from "components/ui";
// icons
import { StateGroupIcon } 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 (
router.push(`/${workspaceSlug}/projects/${data?.project}/issues/${data?.id}`)}
>
{data?.name}
{renderShortDate(data?.start_date ?? "")} to{" "}
{renderShortDate(data?.target_date ?? "")}
}
position="top-left"
>
{data?.name}
);
};
// 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 (
router.push(`/${workspaceSlug}/projects/${data?.project}/issues/${data?.id}`)}
>
{data?.project_detail?.identifier} {data?.sequence_id}
{data?.name}
{duration} day{duration > 1 ? "s" : ""}
);
};