diff --git a/web/core/store/cycle.store.ts b/web/core/store/cycle.store.ts index c781fbc40..4c1541a78 100644 --- a/web/core/store/cycle.store.ts +++ b/web/core/store/cycle.store.ts @@ -8,13 +8,13 @@ import { ICycle, CycleDateCheckData, TCyclePlotType } from "@plane/types"; // helpers import { orderCycles, shouldFilterCycle } from "@/helpers/cycle.helper"; import { getDate } from "@/helpers/date-time.helper"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { CycleService } from "@/services/cycle.service"; import { CycleArchiveService } from "@/services/cycle_archive.service"; import { IssueService } from "@/services/issue"; import { ProjectService } from "@/services/project"; +// store +import { CoreRootStore } from "./root.store"; export interface ICycleStore { // loaders @@ -84,7 +84,7 @@ export class CycleStore implements ICycleStore { cycleService; cycleArchiveService; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // observables loader: observable.ref, diff --git a/web/core/store/cycle_filter.store.ts b/web/core/store/cycle_filter.store.ts index 675027a4f..070ab3b19 100644 --- a/web/core/store/cycle_filter.store.ts +++ b/web/core/store/cycle_filter.store.ts @@ -3,8 +3,8 @@ import { action, computed, observable, makeObservable, runInAction, reaction } f import { computedFn } from "mobx-utils"; // types import { TCycleDisplayFilters, TCycleFilters, TCycleFiltersByState } from "@plane/types"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; +// store +import { CoreRootStore } from "./root.store"; export interface ICycleFilterStore { // observables @@ -35,9 +35,9 @@ export class CycleFilterStore implements ICycleFilterStore { searchQuery: string = ""; archivedCyclesSearchQuery: string = ""; // root store - rootStore: RootStore; + rootStore: CoreRootStore; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // observables displayFilters: observable, diff --git a/web/core/store/dashboard.store.ts b/web/core/store/dashboard.store.ts index 46c376e48..9bdaadf4b 100644 --- a/web/core/store/dashboard.store.ts +++ b/web/core/store/dashboard.store.ts @@ -10,10 +10,10 @@ import { TWidgetKeys, TWidgetStatsRequestParams, } from "@plane/types"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { DashboardService } from "@/services/dashboard.service"; +// plane web store +import { CoreRootStore } from "./root.store"; export interface IDashboardStore { // error states @@ -74,7 +74,7 @@ export class DashboardStore implements IDashboardStore { // services dashboardService; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // error states widgetStatsError: observable, diff --git a/web/core/store/estimates/project-estimate.store.ts b/web/core/store/estimates/project-estimate.store.ts index 8626abead..c9e840812 100644 --- a/web/core/store/estimates/project-estimate.store.ts +++ b/web/core/store/estimates/project-estimate.store.ts @@ -6,12 +6,11 @@ import { action, computed, makeObservable, observable, runInAction } from "mobx" import { computedFn } from "mobx-utils"; // types import { IEstimate as IEstimateType, IEstimateFormData } from "@plane/types"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import estimateService from "@/services/project/estimate.service"; // store import { IEstimate, Estimate } from "@/store/estimates/estimate"; +import { CoreRootStore } from "../root.store"; type TEstimateLoader = "init-loader" | "mutation-loader" | undefined; type TErrorCodes = { @@ -52,7 +51,7 @@ export class ProjectEstimateStore implements IProjectEstimateStore { estimates: Record = {}; // estimate_id -> estimate error: TErrorCodes | undefined = undefined; - constructor(private store: RootStore) { + constructor(private store: CoreRootStore) { makeObservable(this, { // observables loader: observable.ref, diff --git a/web/core/store/event-tracker.store.ts b/web/core/store/event-tracker.store.ts index e9c4b0e41..075c79d66 100644 --- a/web/core/store/event-tracker.store.ts +++ b/web/core/store/event-tracker.store.ts @@ -14,8 +14,8 @@ import { getWorkspaceEventPayload, getPageEventPayload, } from "@/constants/event-tracker"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; +// store +import { CoreRootStore } from "./root.store"; export interface IEventTrackerStore { // properties @@ -39,7 +39,7 @@ export interface IEventTrackerStore { export class EventTrackerStore implements IEventTrackerStore { trackElement: string | undefined = undefined; rootStore; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // properties trackElement: observable, diff --git a/web/core/store/global-view.store.ts b/web/core/store/global-view.store.ts index bc1574f05..52d826bb6 100644 --- a/web/core/store/global-view.store.ts +++ b/web/core/store/global-view.store.ts @@ -7,10 +7,10 @@ import { computedFn } from "mobx-utils"; import { IIssueFilterOptions, IWorkspaceView } from "@plane/types"; // constants import { EIssueFilterType } from "@/constants/issue"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { WorkspaceService } from "@/services/workspace.service"; +// store +import { CoreRootStore } from "./root.store"; export interface IGlobalViewStore { // observables @@ -41,7 +41,7 @@ export class GlobalViewStore implements IGlobalViewStore { // services workspaceService; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // observables globalViewMap: observable, diff --git a/web/core/store/inbox/project-inbox.store.ts b/web/core/store/inbox/project-inbox.store.ts index 163f59dd1..73cafcb35 100644 --- a/web/core/store/inbox/project-inbox.store.ts +++ b/web/core/store/inbox/project-inbox.store.ts @@ -15,12 +15,11 @@ import { } from "@plane/types"; // helpers import { EInboxIssueCurrentTab, EInboxIssueStatus, EPastDurationFilters, getCustomDates } from "@/helpers/inbox.helper"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { InboxIssueService } from "@/services/inbox"; // root store import { IInboxIssueStore, InboxIssueStore } from "@/store/inbox/inbox-issue.store"; +import { CoreRootStore } from "../root.store"; type TLoader = | "init-loading" @@ -90,7 +89,7 @@ export class ProjectInboxStore implements IProjectInboxStore { // services inboxIssueService; - constructor(private store: RootStore) { + constructor(private store: CoreRootStore) { makeObservable(this, { currentTab: observable.ref, loader: observable.ref, diff --git a/web/core/store/issue/root.store.ts b/web/core/store/issue/root.store.ts index ae1a24154..232acbba5 100644 --- a/web/core/store/issue/root.store.ts +++ b/web/core/store/issue/root.store.ts @@ -1,10 +1,9 @@ import isEmpty from "lodash/isEmpty"; import { autorun, makeObservable, observable } from "mobx"; import { ICycle, IIssueLabel, IModule, IProject, IState, IUserLite } from "@plane/types"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // root store import { IWorkspaceMembership } from "@/store/member/workspace-member.store"; +import { CoreRootStore } from "../root.store"; import { IStateStore, StateStore } from "../state.store"; // issues data store import { IArchivedIssuesFilter, ArchivedIssuesFilter, IArchivedIssues, ArchivedIssues } from "./archived"; @@ -44,7 +43,7 @@ export interface IIssueRootStore { moduleMap: Record | undefined; cycleMap: Record | undefined; - rootStore: RootStore; + rootStore: CoreRootStore; issues: IIssueStore; @@ -99,7 +98,7 @@ export class IssueRootStore implements IIssueRootStore { moduleMap: Record | undefined = undefined; cycleMap: Record | undefined = undefined; - rootStore: RootStore; + rootStore: CoreRootStore; issues: IIssueStore; @@ -134,7 +133,7 @@ export class IssueRootStore implements IIssueRootStore { issueKanBanView: IIssueKanBanViewStore; issueCalendarView: ICalendarStore; - constructor(rootStore: RootStore) { + constructor(rootStore: CoreRootStore) { makeObservable(this, { workspaceSlug: observable.ref, projectId: observable.ref, diff --git a/web/core/store/label.store.ts b/web/core/store/label.store.ts index 0a1c71d21..ebf1cc568 100644 --- a/web/core/store/label.store.ts +++ b/web/core/store/label.store.ts @@ -6,10 +6,10 @@ import { computedFn } from "mobx-utils"; import { IIssueLabel, IIssueLabelTree } from "@plane/types"; // helpers import { buildTree } from "@/helpers/array.helper"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { IssueLabelService } from "@/services/issue"; +// store +import { CoreRootStore } from "./root.store"; export interface ILabelStore { //Loaders @@ -55,7 +55,7 @@ export class LabelStore implements ILabelStore { // services issueLabelService; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { labelMap: observable, fetchedMap: observable, diff --git a/web/core/store/member/index.ts b/web/core/store/member/index.ts index db4b80a19..9ab757b0a 100644 --- a/web/core/store/member/index.ts +++ b/web/core/store/member/index.ts @@ -1,8 +1,8 @@ import { action, makeObservable, observable } from "mobx"; // types import { IUserLite } from "@plane/types"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; +// store +import { CoreRootStore } from "../root.store"; import { IProjectMemberStore, ProjectMemberStore } from "./project-member.store"; import { IWorkspaceMemberStore, WorkspaceMemberStore } from "./workspace-member.store"; @@ -23,7 +23,7 @@ export class MemberRootStore implements IMemberRootStore { workspace: IWorkspaceMemberStore; project: IProjectMemberStore; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // observables memberMap: observable, diff --git a/web/core/store/module.store.ts b/web/core/store/module.store.ts index 81e734dbc..c966bb774 100644 --- a/web/core/store/module.store.ts +++ b/web/core/store/module.store.ts @@ -8,12 +8,12 @@ import { computedFn } from "mobx-utils"; import { IModule, ILinkDetails, TModulePlotType } from "@plane/types"; // helpers import { orderModules, shouldFilterModule } from "@/helpers/module.helper"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { ModuleService } from "@/services/module.service"; import { ModuleArchiveService } from "@/services/module_archive.service"; import { ProjectService } from "@/services/project"; +// store +import { CoreRootStore } from "./root.store"; export interface IModuleStore { //Loaders @@ -85,7 +85,7 @@ export class ModulesStore implements IModuleStore { moduleService; moduleArchiveService; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // observables loader: observable.ref, diff --git a/web/core/store/module_filter.store.ts b/web/core/store/module_filter.store.ts index 9812ef9b1..5d2b60482 100644 --- a/web/core/store/module_filter.store.ts +++ b/web/core/store/module_filter.store.ts @@ -3,8 +3,8 @@ import { action, computed, observable, makeObservable, runInAction, reaction } f import { computedFn } from "mobx-utils"; // types import { TModuleDisplayFilters, TModuleFilters, TModuleFiltersByState } from "@plane/types"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; +// store +import { CoreRootStore } from "./root.store"; export interface IModuleFilterStore { // observables @@ -35,9 +35,9 @@ export class ModuleFilterStore implements IModuleFilterStore { searchQuery: string = ""; archivedModulesSearchQuery: string = ""; // root store - rootStore: RootStore; + rootStore: CoreRootStore; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // observables displayFilters: observable, diff --git a/web/core/store/pages/project-page.store.ts b/web/core/store/pages/project-page.store.ts index fa8c16eab..b5b76091c 100644 --- a/web/core/store/pages/project-page.store.ts +++ b/web/core/store/pages/project-page.store.ts @@ -6,12 +6,11 @@ import { computedFn } from "mobx-utils"; import { TPage, TPageFilters, TPageNavigationTabs } from "@plane/types"; // helpers import { filterPagesByPageType, getPageName, orderPages, shouldFilterPage } from "@/helpers/page.helper"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { ProjectPageService } from "@/services/page"; // store import { IPage, Page } from "@/store/pages/page"; +import { CoreRootStore } from "../root.store"; type TLoader = "init-loader" | "mutation-loader" | undefined; @@ -51,7 +50,7 @@ export class ProjectPageStore implements IProjectPageStore { // service service: ProjectPageService; - constructor(private store: RootStore) { + constructor(private store: CoreRootStore) { makeObservable(this, { // observables loader: observable.ref, diff --git a/web/core/store/project-view.store.ts b/web/core/store/project-view.store.ts index 073032a97..ba7d738b7 100644 --- a/web/core/store/project-view.store.ts +++ b/web/core/store/project-view.store.ts @@ -3,10 +3,10 @@ import { observable, action, makeObservable, runInAction, computed } from "mobx" import { computedFn } from "mobx-utils"; // types import { IProjectView } from "@plane/types"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { ViewService } from "@/services/view.service"; +// store +import { CoreRootStore } from "./root.store"; export interface IProjectViewStore { //Loaders @@ -49,7 +49,7 @@ export class ProjectViewStore implements IProjectViewStore { // services viewService; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // observables loader: observable.ref, diff --git a/web/core/store/project/index.ts b/web/core/store/project/index.ts index fe5683b7d..642512761 100644 --- a/web/core/store/project/index.ts +++ b/web/core/store/project/index.ts @@ -1,5 +1,4 @@ -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; +import { CoreRootStore } from "../root.store"; import { IProjectPublishStore, ProjectPublishStore } from "./project-publish.store"; import { IProjectStore, ProjectStore } from "./project.store"; import { IProjectFilterStore, ProjectFilterStore } from "./project_filter.store"; @@ -15,7 +14,7 @@ export class ProjectRootStore { projectFilter: IProjectFilterStore; publish: IProjectPublishStore; - constructor(_root: RootStore) { + constructor(_root: CoreRootStore) { this.project = new ProjectStore(_root); this.projectFilter = new ProjectFilterStore(_root); this.publish = new ProjectPublishStore(this); diff --git a/web/core/store/root.store.ts b/web/core/store/root.store.ts index c24ed1d62..9bdf6d148 100644 --- a/web/core/store/root.store.ts +++ b/web/core/store/root.store.ts @@ -53,9 +53,12 @@ export class CoreRootStore { constructor() { this.router = new RouterStore(); + this.commandPalette = new CommandPaletteStore(); + this.instance = new InstanceStore(); + this.user = new UserStore(this); + this.theme = new ThemeStore(); this.workspaceRoot = new WorkspaceRootStore(this); this.projectRoot = new ProjectRootStore(this); - this.user = new UserStore(this); this.memberRoot = new MemberRootStore(this); this.cycle = new CycleStore(this); this.cycleFilter = new CycleFilterStore(this); @@ -67,15 +70,10 @@ export class CoreRootStore { this.state = new StateStore(this); this.label = new LabelStore(this); this.dashboard = new DashboardStore(this); - this.commandPalette = new CommandPaletteStore(); - this.theme = new ThemeStore(this); this.eventTracker = new EventTrackerStore(this); - this.instance = new InstanceStore(); this.multipleSelect = new MultipleSelectStore(); - // inbox this.projectInbox = new ProjectInboxStore(this); this.projectPages = new ProjectPageStore(this); - this.theme = new ThemeStore(this); this.projectEstimate = new ProjectEstimateStore(this); } @@ -83,6 +81,10 @@ export class CoreRootStore { // handling the system theme when user logged out from the app localStorage.setItem("theme", "system"); + this.router = new RouterStore(); + this.commandPalette = new CommandPaletteStore(); + this.instance = new InstanceStore(); + this.user = new UserStore(this); this.workspaceRoot = new WorkspaceRootStore(this); this.projectRoot = new ProjectRootStore(this); this.memberRoot = new MemberRootStore(this); @@ -96,11 +98,7 @@ export class CoreRootStore { this.state = new StateStore(this); this.label = new LabelStore(this); this.dashboard = new DashboardStore(this); - this.router = new RouterStore(); - this.commandPalette = new CommandPaletteStore(); this.eventTracker = new EventTrackerStore(this); - this.instance = new InstanceStore(); - this.user = new UserStore(this); this.projectInbox = new ProjectInboxStore(this); this.projectPages = new ProjectPageStore(this); this.multipleSelect = new MultipleSelectStore(); diff --git a/web/core/store/state.store.ts b/web/core/store/state.store.ts index 985a43fd2..90f957a4f 100644 --- a/web/core/store/state.store.ts +++ b/web/core/store/state.store.ts @@ -6,10 +6,10 @@ import { computedFn } from "mobx-utils"; import { IState } from "@plane/types"; // helpers import { sortStates } from "@/helpers/state.helper"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { ProjectStateService } from "@/services/project"; +// plane web store +import { CoreRootStore } from "./root.store"; export interface IStateStore { //Loaders @@ -52,7 +52,7 @@ export class StateStore implements IStateStore { router; stateService; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { // observables stateMap: observable, diff --git a/web/core/store/theme.store.ts b/web/core/store/theme.store.ts index 637a179f9..1d0e63eaa 100644 --- a/web/core/store/theme.store.ts +++ b/web/core/store/theme.store.ts @@ -22,7 +22,7 @@ export class ThemeStore implements IThemeStore { workspaceAnalyticsSidebarCollapsed: boolean | undefined = undefined; issueDetailSidebarCollapsed: boolean | undefined = undefined; - constructor(private store: RootStore) { + constructor() { makeObservable(this, { // observable sidebarCollapsed: observable.ref, diff --git a/web/core/store/user/index.ts b/web/core/store/user/index.ts index f973f8e64..80f80ad56 100644 --- a/web/core/store/user/index.ts +++ b/web/core/store/user/index.ts @@ -5,12 +5,11 @@ import { action, makeObservable, observable, runInAction } from "mobx"; import { IUser } from "@plane/types"; // helpers import { API_BASE_URL } from "@/helpers/common.helper"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { AuthService } from "@/services/auth.service"; import { UserService } from "@/services/user.service"; // stores +import { CoreRootStore } from "@/store/root.store"; import { IAccountStore } from "@/store/user/account.store"; import { ProfileStore, IUserProfileStore } from "@/store/user/profile.store"; import { IUserMembershipStore, UserMembershipStore } from "@/store/user/user-membership.store"; @@ -56,7 +55,7 @@ export class UserStore implements IUserStore { userService: UserService; authService: AuthService; - constructor(private store: RootStore) { + constructor(private store: CoreRootStore) { // stores this.userProfile = new ProfileStore(store); this.userSettings = new UserSettingsStore(); diff --git a/web/core/store/workspace/index.ts b/web/core/store/workspace/index.ts index 87d61baba..eba260eaa 100644 --- a/web/core/store/workspace/index.ts +++ b/web/core/store/workspace/index.ts @@ -2,10 +2,10 @@ import set from "lodash/set"; import { action, computed, observable, makeObservable, runInAction } from "mobx"; // types import { IWorkspace } from "@plane/types"; -// plane web store -import { RootStore } from "@/plane-web/store/root.store"; // services import { WorkspaceService } from "@/services/workspace.service"; +// store +import { CoreRootStore } from "@/store/root.store"; // sub-stores import { ApiTokenStore, IApiTokenStore } from "./api-token.store"; import { IWebhookStore, WebhookStore } from "./webhook.store"; @@ -44,7 +44,7 @@ export class WorkspaceRootStore implements IWorkspaceRootStore { webhook: IWebhookStore; apiToken: IApiTokenStore; - constructor(_rootStore: RootStore) { + constructor(_rootStore: CoreRootStore) { makeObservable(this, { loader: observable.ref, // observables