refactor timeline store for code splitting (#5926)
This commit is contained in:
parent
b4bbe3a8ba
commit
538e78f135
13 changed files with 56 additions and 50 deletions
|
|
@ -10,10 +10,10 @@ import { computedFn } from "mobx-utils";
|
|||
import { TIssueActivityComment, TIssueActivity, TIssueActivityMap, TIssueActivityIdMap } from "@plane/types";
|
||||
// plane web constants
|
||||
import { EActivityFilterType } from "@/plane-web/constants/issues";
|
||||
// plane web store types
|
||||
import { RootStore } from "@/plane-web/store/root.store";
|
||||
// services
|
||||
import { IssueActivityService } from "@/services/issue";
|
||||
// store
|
||||
import { CoreRootStore } from "@/store/root.store";
|
||||
|
||||
export type TActivityLoader = "fetch" | "mutate" | undefined;
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ export class IssueActivityStore implements IIssueActivityStore {
|
|||
// services
|
||||
issueActivityService;
|
||||
|
||||
constructor(protected store: RootStore) {
|
||||
constructor(protected store: CoreRootStore) {
|
||||
makeObservable(this, {
|
||||
// observables
|
||||
loader: observable.ref,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
// store
|
||||
import { CoreRootStore } from "@/store/root.store";
|
||||
import { ITimelineStore, TimeLineStore } from "./timeline";
|
||||
|
||||
export class RootStore extends CoreRootStore {
|
||||
timelineStore: ITimelineStore;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.timelineStore = new TimeLineStore(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { RootStore } from "@/plane-web/store/root.store";
|
|||
type BlockData = {
|
||||
id: string;
|
||||
name: string;
|
||||
sort_order: number;
|
||||
sort_order: number | null;
|
||||
start_date: string | undefined | null;
|
||||
target_date: string | undefined | null;
|
||||
};
|
||||
|
|
@ -27,6 +27,7 @@ export interface IBaseTimelineStore {
|
|||
activeBlockId: string | null;
|
||||
renderView: any;
|
||||
isDragging: boolean;
|
||||
isDependencyEnabled: boolean;
|
||||
//
|
||||
setBlockIds: (ids: string[]) => void;
|
||||
getBlockById: (blockId: string) => IGanttBlock;
|
||||
|
|
@ -60,6 +61,8 @@ export class BaseTimeLineStore implements IBaseTimelineStore {
|
|||
|
||||
rootStore: RootStore;
|
||||
|
||||
isDependencyEnabled = false;
|
||||
|
||||
constructor(_rootStore: RootStore) {
|
||||
makeObservable(this, {
|
||||
// observables
|
||||
|
|
@ -179,7 +182,7 @@ export class BaseTimeLineStore implements IBaseTimelineStore {
|
|||
data: blockData,
|
||||
id: blockData?.id,
|
||||
name: blockData.name,
|
||||
sort_order: blockData?.sort_order,
|
||||
sort_order: blockData?.sort_order ?? undefined,
|
||||
start_date: blockData?.start_date ?? undefined,
|
||||
target_date: blockData?.target_date ?? undefined,
|
||||
};
|
||||
|
|
|
|||
23
web/ce/store/timeline/index.ts
Normal file
23
web/ce/store/timeline/index.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { RootStore } from "@/plane-web/store/root.store";
|
||||
import { IIssuesTimeLineStore, IssuesTimeLineStore } from "@/store/timeline/issues-timeline.store";
|
||||
import { IModulesTimeLineStore, ModulesTimeLineStore } from "@/store/timeline/modules-timeline.store";
|
||||
import { BaseTimeLineStore, IBaseTimelineStore } from "./base-timeline.store";
|
||||
|
||||
export interface ITimelineStore {
|
||||
issuesTimeLineStore: IIssuesTimeLineStore;
|
||||
modulesTimeLineStore: IModulesTimeLineStore;
|
||||
projectTimeLineStore: IBaseTimelineStore;
|
||||
}
|
||||
|
||||
export class TimeLineStore implements ITimelineStore {
|
||||
issuesTimeLineStore: IIssuesTimeLineStore;
|
||||
modulesTimeLineStore: IModulesTimeLineStore;
|
||||
projectTimeLineStore: IBaseTimelineStore;
|
||||
|
||||
constructor(rootStore: RootStore) {
|
||||
this.issuesTimeLineStore = new IssuesTimeLineStore(rootStore);
|
||||
this.modulesTimeLineStore = new ModulesTimeLineStore(rootStore);
|
||||
// Dummy store
|
||||
this.projectTimeLineStore = new BaseTimeLineStore(rootStore);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue