Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: MobX store folder structure #2435

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/components/project/publish-project/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { observer } from "mobx-react-lite";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root";
import { IProjectPublishSettings, TProjectPublishViews } from "store/project_publish";
import { IProjectPublishSettings, TProjectPublishViews } from "store/project";
// hooks
import useToast from "hooks/use-toast";
import useProjectDetails from "hooks/use-project-details";
Expand Down
2 changes: 1 addition & 1 deletion web/services/project/project_publish.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { API_BASE_URL } from "helpers/common.helper";
// services
import { APIService } from "services/api.service";
// types
import { IProjectPublishSettings } from "store/project_publish";
import { IProjectPublishSettings } from "store/project";

export class ProjectPublishService extends APIService {
constructor() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { observable, action, computed, makeObservable, runInAction } from "mobx";
// store
import { RootStore } from "./root";
import { RootStore } from "../root";
// types
import { IIssue } from "types";
// services
Expand Down Expand Up @@ -36,7 +36,7 @@ export interface ICycleIssueStore {
updateIssueStructure: (group_id: string | null, sub_group_id: string | null, issue: IIssue) => void;
}

class CycleIssueStore implements ICycleIssueStore {
export class CycleIssueStore implements ICycleIssueStore {
loader: boolean = false;
error: any | null = null;
issues: {
Expand Down Expand Up @@ -188,5 +188,3 @@ class CycleIssueStore implements ICycleIssueStore {
}
};
}

export default CycleIssueStore;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CycleService from "services/cycle.service";
// helpers
import { handleIssueQueryParamsByLayout } from "helpers/issue.helper";
// types
import { RootStore } from "./root";
import { RootStore } from "../root";
import { IIssueFilterOptions, TIssueParams } from "types";

export interface ICycleIssueFilterStore {
Expand All @@ -25,7 +25,7 @@ export interface ICycleIssueFilterStore {
appliedFilters: TIssueParams[] | null;
}

class CycleIssueFilterStore implements ICycleIssueFilterStore {
export class CycleIssueFilterStore implements ICycleIssueFilterStore {
// observables
loader: boolean = false;
error: any | null = null;
Expand Down Expand Up @@ -145,5 +145,3 @@ class CycleIssueFilterStore implements ICycleIssueFilterStore {
}
};
}

export default CycleIssueFilterStore;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { action, computed, makeObservable, observable, runInAction } from "mobx";
// types
import { RootStore } from "./root";
import { IIssueType } from "./issue";
import { RootStore } from "../root";
import { IIssueType } from "store/issue";

export interface ICycleIssueKanBanViewStore {
kanBanToggle: {
Expand All @@ -18,7 +18,7 @@ export interface ICycleIssueKanBanViewStore {
handleDragDrop: (source: any, destination: any) => void;
}

class CycleIssueKanBanViewStore implements ICycleIssueKanBanViewStore {
export class CycleIssueKanBanViewStore implements ICycleIssueKanBanViewStore {
kanBanToggle: {
groupByHeaderMinMax: string[];
subgroupByIssuesVisibility: string[];
Expand Down Expand Up @@ -447,5 +447,3 @@ class CycleIssueKanBanViewStore implements ICycleIssueKanBanViewStore {
}
};
}

export default CycleIssueKanBanViewStore;
6 changes: 2 additions & 4 deletions web/store/cycles.ts → web/store/cycle/cycles.store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action, computed, observable, makeObservable, runInAction } from "mobx";
// types
import { RootStore } from "./root";
import { RootStore } from "../root";
import { ICycle } from "types";
// services
import { ProjectService } from "services/project";
Expand Down Expand Up @@ -38,7 +38,7 @@ export interface ICycleStore {
removeCycleFromFavorites: (workspaceSlug: string, projectId: string, cycleId: string) => Promise<void>;
}

class CycleStore implements ICycleStore {
export class CycleStore implements ICycleStore {
loader: boolean = false;
error: any | null = null;

Expand Down Expand Up @@ -256,5 +256,3 @@ class CycleStore implements ICycleStore {
}
};
}

export default CycleStore;
4 changes: 4 additions & 0 deletions web/store/cycle/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from "./cycle_issue_filters.store";
export * from "./cycle_issue_kanban_view.store";
export * from "./cycle_issue.store";
export * from "./cycles.store";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { observable, action, makeObservable, runInAction } from "mobx";
// types
import { RootStore } from "./root";
import { RootStore } from "../root";
import { IIssueFilterOptions } from "types";

export interface IGlobalViewFiltersStore {
Expand All @@ -18,7 +18,7 @@ export interface IGlobalViewFiltersStore {
deleteStoredFilters: (viewId: string) => void;
}

class GlobalViewFiltersStore implements IGlobalViewFiltersStore {
export class GlobalViewFiltersStore implements IGlobalViewFiltersStore {
// states
loader: boolean = false;
error: any | null = null;
Expand Down Expand Up @@ -66,5 +66,3 @@ class GlobalViewFiltersStore implements IGlobalViewFiltersStore {
});
};
}

export default GlobalViewFiltersStore;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import WorkspaceService from "services/workspace.service";
// helpers
import { handleIssueQueryParamsByLayout } from "helpers/issue.helper";
// types
import { RootStore } from "./root";
import { RootStore } from "../root";
import { IIssue, IIssueFilterOptions, TStaticViewTypes } from "types";

export interface IGlobalViewIssuesStore {
Expand All @@ -23,7 +23,7 @@ export interface IGlobalViewIssuesStore {
fetchStaticIssues: (workspaceSlug: string, type: TStaticViewTypes) => Promise<any>;
}

class GlobalViewIssuesStore implements IGlobalViewIssuesStore {
export class GlobalViewIssuesStore implements IGlobalViewIssuesStore {
// states
loader: boolean = false;
error: any | null = null;
Expand Down Expand Up @@ -163,5 +163,3 @@ class GlobalViewIssuesStore implements IGlobalViewIssuesStore {
}
};
}

export default GlobalViewIssuesStore;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { observable, action, makeObservable, runInAction } from "mobx";
import { ProjectService } from "services/project";
import WorkspaceService from "services/workspace.service";
// types
import { RootStore } from "./root";
import { RootStore } from "../root";
import { IWorkspaceView } from "types/workspace-views";

export interface IGlobalViewsStore {
Expand All @@ -28,7 +28,7 @@ export interface IGlobalViewsStore {
deleteGlobalView: (workspaceSlug: string, viewId: string) => Promise<any>;
}

class GlobalViewsStore implements IGlobalViewsStore {
export class GlobalViewsStore implements IGlobalViewsStore {
// states
loader: boolean = false;
error: any | null = null;
Expand Down Expand Up @@ -203,5 +203,3 @@ class GlobalViewsStore implements IGlobalViewsStore {
}
};
}

export default GlobalViewsStore;
3 changes: 3 additions & 0 deletions web/store/global-view/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./global_view_filters.store";
export * from "./global_view_issues.store";
export * from "./global_views.store";
5 changes: 5 additions & 0 deletions web/store/issue/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from "./issue_detail.store";
export * from "./issue_draft.store";
export * from "./issue_filters.store";
export * from "./issue_kanban_view.store";
export * from "./issue.store";
6 changes: 2 additions & 4 deletions web/store/issue.ts → web/store/issue/issue.store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { observable, action, computed, makeObservable, runInAction } from "mobx";
// store
import { RootStore } from "./root";
import { RootStore } from "../root";
// types
import { IIssue } from "types";
// services
Expand Down Expand Up @@ -35,7 +35,7 @@ export interface IIssueStore {
updateIssueStructure: (group_id: string | null, sub_group_id: string | null, issue: IIssue) => void;
}

class IssueStore implements IIssueStore {
export class IssueStore implements IIssueStore {
loader: boolean = false;
error: any | null = null;
issues: {
Expand Down Expand Up @@ -185,5 +185,3 @@ class IssueStore implements IIssueStore {
}
};
}

export default IssueStore;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { observable, action, makeObservable, runInAction } from "mobx";
// services
import IssueService from "services/issue/issue.service";
// types
import { RootStore } from "./root";
import { RootStore } from "../root";
import { IUser, IIssue } from "types";

export type IPeekMode = "side" | "modal" | "full";
Expand Down Expand Up @@ -30,7 +30,7 @@ export interface IIssueDetailStore {
deleteIssue: (workspaceId: string, projectId: string, issueId: string, user: IUser) => void;
}

class IssueDetailStore implements IIssueDetailStore {
export class IssueDetailStore implements IIssueDetailStore {
loader: boolean = false;
error: any | null = null;

Expand Down Expand Up @@ -197,5 +197,3 @@ class IssueDetailStore implements IIssueDetailStore {
}
};
}

export default IssueDetailStore;
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { action, observable, runInAction, makeAutoObservable } from "mobx";
// services
import issueService from "services/issue/issue.service";
// types
import type { ICurrentUserResponse, IIssue } from "types";
import type { IIssue } from "types";

class DraftIssuesStore {
export class DraftIssuesStore {
issues: { [key: string]: IIssue } = {};
isIssuesLoading: boolean = false;
rootStore: any | null = null;
Expand Down Expand Up @@ -167,5 +167,3 @@ class DraftIssuesStore {
}
};
}

export default DraftIssuesStore;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IssueService } from "services/issue";
// helpers
import { handleIssueQueryParamsByLayout } from "helpers/issue.helper";
// types
import { RootStore } from "./root";
import { RootStore } from "../root";
import {
IIssueDisplayFilterOptions,
IIssueDisplayProperties,
Expand Down Expand Up @@ -40,7 +40,7 @@ export interface IIssueFilterStore {
appliedFilters: TIssueParams[] | null;
}

class IssueFilterStore implements IIssueFilterStore {
export class IssueFilterStore implements IIssueFilterStore {
loader: boolean = false;
error: any | null = null;

Expand Down Expand Up @@ -229,5 +229,3 @@ class IssueFilterStore implements IIssueFilterStore {
}
};
}

export default IssueFilterStore;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { action, computed, makeObservable, observable, runInAction } from "mobx";
// types
import { RootStore } from "./root";
import { IIssueType } from "./issue";
import { RootStore } from "../root";
import { IIssueType } from "./issue.store";

export interface IIssueKanBanViewStore {
kanBanToggle: {
Expand All @@ -18,7 +18,7 @@ export interface IIssueKanBanViewStore {
handleDragDrop: (source: any, destination: any) => void;
}

class IssueKanBanViewStore implements IIssueKanBanViewStore {
export class IssueKanBanViewStore implements IIssueKanBanViewStore {
kanBanToggle: {
groupByHeaderMinMax: string[];
subgroupByIssuesVisibility: string[];
Expand Down Expand Up @@ -447,5 +447,3 @@ class IssueKanBanViewStore implements IIssueKanBanViewStore {
}
};
}

export default IssueKanBanViewStore;
4 changes: 4 additions & 0 deletions web/store/module/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from "./module_filters.store";
export * from "./module_issue_kanban_view.store";
export * from "./module_issue.store";
export * from "./modules.store";
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ModuleService from "services/module.service";
// helpers
import { handleIssueQueryParamsByLayout } from "helpers/issue.helper";
// types
import { RootStore } from "./root";
import { RootStore } from "../root";
import { IIssueFilterOptions, IModule, TIssueParams } from "types";

export interface IModuleFilterStore {
Expand All @@ -27,7 +27,7 @@ export interface IModuleFilterStore {
appliedFilters: TIssueParams[] | null;
}

class ModuleFilterStore implements IModuleFilterStore {
export class ModuleFilterStore implements IModuleFilterStore {
loader: boolean = false;
error: any | null = null;

Expand Down Expand Up @@ -174,5 +174,3 @@ class ModuleFilterStore implements IModuleFilterStore {
}
};
}

export default ModuleFilterStore;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { observable, action, computed, makeObservable, runInAction } from "mobx";
// store
import { RootStore } from "./root";
import { RootStore } from "../root";
// types
import { IIssue } from "types";
// services
Expand Down Expand Up @@ -36,7 +36,7 @@ export interface IModuleIssueStore {
updateIssueStructure: (group_id: string | null, sub_group_id: string | null, issue: IIssue) => void;
}

class ModuleIssueStore implements IModuleIssueStore {
export class ModuleIssueStore implements IModuleIssueStore {
loader: boolean = false;
error: any | null = null;
issues: {
Expand Down Expand Up @@ -193,5 +193,3 @@ class ModuleIssueStore implements IModuleIssueStore {
}
};
}

export default ModuleIssueStore;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { action, computed, makeObservable, observable, runInAction } from "mobx";
// types
import { RootStore } from "./root";
import { IIssueType } from "./issue";
import { RootStore } from "../root";
import { IIssueType } from "../issue/issue.store";

export interface IModuleIssueKanBanViewStore {
kanBanToggle: {
Expand All @@ -18,7 +18,7 @@ export interface IModuleIssueKanBanViewStore {
handleDragDrop: (source: any, destination: any) => void;
}

class ModuleIssueKanBanViewStore implements IModuleIssueKanBanViewStore {
export class ModuleIssueKanBanViewStore implements IModuleIssueKanBanViewStore {
kanBanToggle: {
groupByHeaderMinMax: string[];
subgroupByIssuesVisibility: string[];
Expand Down Expand Up @@ -447,5 +447,3 @@ class ModuleIssueKanBanViewStore implements IModuleIssueKanBanViewStore {
}
};
}

export default ModuleIssueKanBanViewStore;
Loading
Loading