feat: group by created by option (#516)

This commit is contained in:
Aaryan Khandelwal
2023-03-24 01:11:42 +05:30
committed by GitHub
parent 6c6f9a5bfd
commit 472767ab67
13 changed files with 267 additions and 76 deletions

View File

@@ -10,7 +10,7 @@ import ToastAlert from "components/toast-alert";
import projectService from "services/project.service";
import viewsService from "services/views.service";
// types
import { IIssueFilterOptions, IProjectMember } from "types";
import { IIssueFilterOptions, IProjectMember, TIssueGroupByOptions } from "types";
// fetch-keys
import { USER_PROJECT_VIEW, VIEW_DETAILS } from "constants/fetch-keys";
@@ -18,7 +18,7 @@ export const issueViewContext = createContext<ContextType>({} as ContextType);
type IssueViewProps = {
issueView: "list" | "kanban";
groupByProperty: "state" | "priority" | "labels" | null;
groupByProperty: TIssueGroupByOptions;
orderBy: "created_at" | "updated_at" | "priority" | "sort_order";
showEmptyGroups: boolean;
filters: IIssueFilterOptions;
@@ -37,7 +37,7 @@ type ReducerActionType = {
};
type ContextType = IssueViewProps & {
setGroupByProperty: (property: "state" | "priority" | "labels" | null) => void;
setGroupByProperty: (property: TIssueGroupByOptions) => void;
setOrderBy: (property: "created_at" | "updated_at" | "priority" | "sort_order") => void;
setShowEmptyGroups: (property: boolean) => void;
setFilters: (filters: Partial<IIssueFilterOptions>, saveToServer?: boolean) => void;
@@ -49,7 +49,7 @@ type ContextType = IssueViewProps & {
type StateType = {
issueView: "list" | "kanban";
groupByProperty: "state" | "priority" | "labels" | null;
groupByProperty: TIssueGroupByOptions;
orderBy: "created_at" | "updated_at" | "priority" | "sort_order";
showEmptyGroups: boolean;
filters: IIssueFilterOptions;
@@ -167,11 +167,11 @@ const saveDataToServer = async (workspaceSlug: string, projectID: string, state:
const sendFilterDataToServer = async (
workspaceSlug: string,
projectID: string,
projectId: string,
viewId: string,
state: any
) => {
await viewsService.patchView(workspaceSlug, projectID, viewId, {
await viewsService.patchView(workspaceSlug, projectId, viewId, {
...state,
});
};
@@ -283,7 +283,7 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> =
}, [workspaceSlug, projectId, state, mutateMyViewProps]);
const setGroupByProperty = useCallback(
(property: "state" | "priority" | "labels" | null) => {
(property: TIssueGroupByOptions) => {
dispatch({
type: "SET_GROUP_BY_PROPERTY",
payload: {