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 openPeekOverview = () => {
const { query } = router;
router.push({
pathname: router.pathname,
query: { ...query, peekIssue: data.id },
});
};
return (
{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 duration = findTotalDaysInRange(data?.start_date ?? "", data?.target_date ?? "", true);
const openPeekOverview = () => {
const { query } = router;
router.push({
pathname: router.pathname,
query: { ...query, peekIssue: data.id },
});
};
return (
{data?.project_detail?.identifier} {data?.sequence_id}
{data?.name}
{duration} day{duration > 1 ? "s" : ""}
);
};