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>
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import useSWR from "swr";
|
|
|
|
// services
|
|
import issuesService from "services/issues.service";
|
|
// hooks
|
|
import useIssuesView from "hooks/use-issues-view";
|
|
// fetch-keys
|
|
import { PROJECT_ISSUES_LIST_WITH_PARAMS } from "constants/fetch-keys";
|
|
|
|
const useGanttChartIssues = (workspaceSlug: string | undefined, projectId: string | undefined) => {
|
|
const { orderBy, filters, showSubIssues } = useIssuesView();
|
|
|
|
const params: any = {
|
|
order_by: orderBy,
|
|
type: filters?.type ? filters?.type : undefined,
|
|
sub_issue: showSubIssues,
|
|
assignees: filters?.assignees ? filters?.assignees.join(",") : undefined,
|
|
state: filters?.state ? filters?.state.join(",") : undefined,
|
|
priority: filters?.priority ? filters?.priority.join(",") : undefined,
|
|
labels: filters?.labels ? filters?.labels.join(",") : undefined,
|
|
created_by: filters?.created_by ? filters?.created_by.join(",") : undefined,
|
|
target_date: filters?.target_date ? filters?.target_date.join(",") : undefined,
|
|
start_target_date: true, // to fetch only issues with a start and target date
|
|
};
|
|
|
|
// all issues under the workspace and project
|
|
const { data: ganttIssues, mutate: mutateGanttIssues } = useSWR(
|
|
workspaceSlug && projectId ? PROJECT_ISSUES_LIST_WITH_PARAMS(projectId, params) : null,
|
|
workspaceSlug && projectId
|
|
? () =>
|
|
issuesService.getIssuesWithParams(workspaceSlug.toString(), projectId.toString(), params)
|
|
: null
|
|
);
|
|
|
|
return {
|
|
ganttIssues,
|
|
mutateGanttIssues,
|
|
};
|
|
};
|
|
|
|
export default useGanttChartIssues;
|