forked from github/plane
785a6e8871
* chore: gantt chart resizable blocks * chore: right scroll added * chore: left scroll added * fix: build errors * chore: remove unnecessary console logs * chore: add block type and remove info toggle * feat: gantt chart blocks y-axis drag and drop * chore: disable drag flag * fix: y-axis drag mutation * fix: scroll container undefined error * fix: negative scroll * fix: negative scroll * style: blocks tooltip consistency
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import useSWR from "swr";
|
|
|
|
// services
|
|
import cyclesService from "services/cycles.service";
|
|
// hooks
|
|
import useIssuesView from "hooks/use-issues-view";
|
|
// fetch-keys
|
|
import { CYCLE_ISSUES_WITH_PARAMS } from "constants/fetch-keys";
|
|
|
|
const useGanttChartCycleIssues = (
|
|
workspaceSlug: string | undefined,
|
|
projectId: string | undefined,
|
|
cycleId: string | undefined
|
|
) => {
|
|
const { orderBy, filters, showSubIssues } = useIssuesView();
|
|
|
|
const params: any = {
|
|
order_by: orderBy,
|
|
type: filters?.type ? filters?.type : undefined,
|
|
sub_issue: showSubIssues,
|
|
start_target_date: true,
|
|
};
|
|
|
|
// all issues under the workspace and project
|
|
const { data: ganttIssues, mutate: mutateGanttIssues } = useSWR(
|
|
workspaceSlug && projectId && cycleId
|
|
? CYCLE_ISSUES_WITH_PARAMS(cycleId.toString(), params)
|
|
: null,
|
|
workspaceSlug && projectId && cycleId
|
|
? () =>
|
|
cyclesService.getCycleIssuesWithParams(
|
|
workspaceSlug.toString(),
|
|
projectId.toString(),
|
|
cycleId.toString(),
|
|
params
|
|
)
|
|
: null
|
|
);
|
|
|
|
return {
|
|
ganttIssues,
|
|
mutateGanttIssues,
|
|
};
|
|
};
|
|
|
|
export default useGanttChartCycleIssues;
|