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
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import useSWR from "swr";
|
|
|
|
// services
|
|
import issuesService from "services/issues.service";
|
|
// hooks
|
|
import useIssuesView from "hooks/use-issues-view";
|
|
// fetch-keys
|
|
import { VIEW_ISSUES } from "constants/fetch-keys";
|
|
|
|
const useGanttChartViewIssues = (
|
|
workspaceSlug: string | undefined,
|
|
projectId: string | undefined,
|
|
viewId: string | undefined
|
|
) => {
|
|
const { params } = useIssuesView();
|
|
const { order_by, group_by, ...viewGanttParams } = params;
|
|
|
|
// all issues under the view
|
|
const { data: ganttIssues, mutate: mutateGanttIssues } = useSWR(
|
|
workspaceSlug && projectId && viewId
|
|
? VIEW_ISSUES(viewId.toString(), { ...viewGanttParams, start_target_date: true })
|
|
: null,
|
|
workspaceSlug && projectId && viewId
|
|
? () =>
|
|
issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
|
...viewGanttParams,
|
|
start_target_date: true,
|
|
})
|
|
: null
|
|
);
|
|
|
|
return {
|
|
ganttIssues,
|
|
mutateGanttIssues,
|
|
};
|
|
};
|
|
|
|
export default useGanttChartViewIssues;
|