snapshot of https://github.com/makeplane/plane.git @ d868349a55de79979eb8b98701bf1702c67ad634 (2026-09-15)
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 16s
CodeQL / Analyze (python) (push) Failing after 3s
i18n sync check / check:sync (push) Failing after 3s
React Doctor / react-doctor (push) Failing after 16s
Branch Build CE / Build-Push Admin Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Admin Manifest (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Web Manifest (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Proxy Manifest (push) Has been cancelled
Branch Build CE / Merge Space Manifest (push) Has been cancelled
Branch Build CE / Prepare AIO Assets (push) Has been cancelled
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Live Collaboration Manifest (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge API Server Manifest (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge AIO Manifest (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-15 15:14:58 +05:00
commit 23059a1de3
5252 changed files with 573834 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
export * from "./use-project-estimate";
export * from "./use-estimate";
export * from "./use-estimate-point";

View File

@@ -0,0 +1,22 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// mobx store
import type { IEstimatePoint } from "@/store/estimates/estimate-point";
export const useEstimatePoint = (
estimateId: string | undefined,
estimatePointId: string | undefined
): IEstimatePoint => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useEstimatePoint must be used within StoreProvider");
if (!estimateId || !estimatePointId) return {} as IEstimatePoint;
return context.projectEstimate.estimates?.[estimateId]?.estimatePoints?.[estimatePointId] || {};
};

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// mobx store
import type { IEstimate } from "@/store/estimates/estimate";
export const useEstimate = (estimateId: string | undefined): IEstimate => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useEstimate must be used within StoreProvider");
if (!estimateId) return {} as IEstimate;
return context.projectEstimate.estimates?.[estimateId] ?? {};
};

View File

@@ -0,0 +1,18 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// context
import { StoreContext } from "@/lib/store-context";
// mobx store
import type { IProjectEstimateStore } from "@/store/estimates/project-estimate.store";
export const useProjectEstimates = (): IProjectEstimateStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useProjectPage must be used within StoreProvider");
return context.projectEstimate;
};

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
export * from "./use-page-store";
export * from "./use-page";

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
export * from "./use-workspace-notifications";
export * from "./use-notification";

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// mobx store
import type { INotification } from "@/store/notifications/notification";
export const useNotification = (notificationId: string | undefined): INotification => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useNotification must be used within StoreProvider");
if (!notificationId) return {} as INotification;
return context.workspaceNotification.notifications?.[notificationId] ?? {};
};

View File

@@ -0,0 +1,18 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// context
import { StoreContext } from "@/lib/store-context";
// mobx store
import type { IWorkspaceNotificationStore } from "@/store/notifications/workspace-notifications.store";
export const useWorkspaceNotifications = (): IWorkspaceNotificationStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useWorkspaceNotifications must be used within StoreProvider");
return context.workspaceNotification;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IBaseAnalyticsStore as IAnalyticsStore } from "@/store/analytics.store";
export const useAnalytics = (): IAnalyticsStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useAnalytics must be used within StoreProvider");
return context.analytics;
};

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// store
import { StoreContext } from "@/lib/store-context";
import type { IThemeStore } from "@/store/theme.store";
export const useAppTheme = (): IThemeStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useAppTheme must be used within StoreProvider");
return context.theme;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { ICalendarStore } from "@/store/issue/issue_calendar_view.store";
export const useCalendarView = (): ICalendarStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useLabel must be used within StoreProvider");
return context.issue.issueCalendarView;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { ICommandPaletteStore } from "@/store/base-command-palette.store";
export const useCommandPalette = (): ICommandPaletteStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useCommandPalette must be used within StoreProvider");
return context.commandPalette;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { ICycleFilterStore } from "@/store/cycle_filter.store";
export const useCycleFilter = (): ICycleFilterStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useCycleFilter must be used within StoreProvider");
return context.cycleFilter;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { ICycleStore } from "@/store/cycle.store";
export const useCycle = (): ICycleStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useCycle must be used within StoreProvider");
return context.cycle;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IDashboardStore } from "@/store/dashboard.store";
export const useDashboard = (): IDashboardStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useDashboard must be used within StoreProvider");
return context.dashboard;
};

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// store
import { StoreContext } from "@/lib/store-context";
import type { IEditorAssetStore } from "@/store/editor/asset.store";
export const useEditorAsset = (): IEditorAssetStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useEditorAsset must be used within StoreProvider");
return context.editorAssetStore;
};

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
import type { IFavoriteStore } from "@/store/favorite.store";
export const useFavorite = (): IFavoriteStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useFavorites must be used within StoreProvider");
return context.favorite;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IGlobalViewStore } from "@/store/global-view.store";
export const useGlobalView = (): IGlobalViewStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useGlobalView must be used within StoreProvider");
return context.globalView;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IHomeStore } from "@/store/workspace/home";
export const useHome = (): IHomeStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useDashboard must be used within StoreProvider");
return context.workspaceRoot.home;
};

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
import type { IInboxIssueStore } from "@/store/inbox/inbox-issue.store";
export const useInboxIssues = (inboxIssueId: string): IInboxIssueStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useInboxIssues must be used within StoreProvider");
return context.projectInbox.getIssueInboxByIssueId(inboxIssueId);
};

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// store
import { StoreContext } from "@/lib/store-context";
import type { IInstanceStore } from "@/store/instance.store";
export const useInstance = (): IInstanceStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useInstance must be used within StoreProvider");
return context.instance;
};

View File

@@ -0,0 +1,20 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
import type { TIssueServiceType } from "@plane/types";
import { EIssueServiceType } from "@plane/types";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IIssueDetail } from "@/store/issue/issue-details/root.store";
export const useIssueDetail = (serviceType: TIssueServiceType = EIssueServiceType.ISSUES): IIssueDetail => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useIssueDetail must be used within StoreProvider");
if (serviceType === EIssueServiceType.EPICS) return context.issue.epicDetail;
else return context.issue.issueDetail;
};

View File

@@ -0,0 +1,157 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
import { merge } from "lodash-es";
import type { TIssueMap } from "@plane/types";
import { EIssuesStoreType } from "@plane/types";
import { StoreContext } from "@/lib/store-context";
import type { IArchivedIssues, IArchivedIssuesFilter } from "@/store/issue/archived";
import type { IWorkspaceIssues } from "@/store/issue/workspace/issue.store";
import type { ICycleIssues, ICycleIssuesFilter } from "@/store/issue/cycle";
import type { IModuleIssues, IModuleIssuesFilter } from "@/store/issue/module";
import type { IProfileIssues, IProfileIssuesFilter } from "@/store/issue/profile";
import type { IProjectIssues, IProjectIssuesFilter } from "@/store/issue/project";
import type { IProjectViewIssues, IProjectViewIssuesFilter } from "@/store/issue/project-views";
import type { IWorkspaceIssuesFilter } from "@/store/issue/workspace";
import type { IWorkspaceDraftIssues, IWorkspaceDraftIssuesFilter } from "@/store/issue/workspace-draft";
// constants
type defaultIssueStore = {
issueMap: TIssueMap;
};
export type TStoreIssues = {
[EIssuesStoreType.GLOBAL]: defaultIssueStore & {
issues: IWorkspaceIssues;
issuesFilter: IWorkspaceIssuesFilter;
};
[EIssuesStoreType.WORKSPACE_DRAFT]: defaultIssueStore & {
issues: IWorkspaceDraftIssues;
issuesFilter: IWorkspaceDraftIssuesFilter;
};
[EIssuesStoreType.PROFILE]: defaultIssueStore & {
issues: IProfileIssues;
issuesFilter: IProfileIssuesFilter;
};
[EIssuesStoreType.TEAM]: defaultIssueStore & {
issues: IProjectIssues;
issuesFilter: IProjectIssuesFilter;
};
[EIssuesStoreType.PROJECT]: defaultIssueStore & {
issues: IProjectIssues;
issuesFilter: IProjectIssuesFilter;
};
[EIssuesStoreType.CYCLE]: defaultIssueStore & {
issues: ICycleIssues;
issuesFilter: ICycleIssuesFilter;
};
[EIssuesStoreType.MODULE]: defaultIssueStore & {
issues: IModuleIssues;
issuesFilter: IModuleIssuesFilter;
};
[EIssuesStoreType.TEAM_VIEW]: defaultIssueStore & {
issues: IProjectViewIssues;
issuesFilter: IProjectViewIssuesFilter;
};
[EIssuesStoreType.PROJECT_VIEW]: defaultIssueStore & {
issues: IProjectViewIssues;
issuesFilter: IProjectViewIssuesFilter;
};
[EIssuesStoreType.ARCHIVED]: defaultIssueStore & {
issues: IArchivedIssues;
issuesFilter: IArchivedIssuesFilter;
};
[EIssuesStoreType.DEFAULT]: defaultIssueStore & {
issues: IProjectIssues;
issuesFilter: IProjectIssuesFilter;
};
[EIssuesStoreType.EPIC]: defaultIssueStore & {
issues: IProjectIssues;
issuesFilter: IProjectIssuesFilter;
};
[EIssuesStoreType.TEAM_PROJECT_WORK_ITEMS]: defaultIssueStore & {
issues: IProjectIssues;
issuesFilter: IProjectIssuesFilter;
};
};
export const useIssues = <T extends EIssuesStoreType>(storeType?: T): TStoreIssues[T] => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useIssues must be used within StoreProvider");
const defaultStore: defaultIssueStore = {
issueMap: context.issue.issues.issuesMap,
};
switch (storeType) {
case EIssuesStoreType.GLOBAL:
return merge(defaultStore, {
issues: context.issue.workspaceIssues,
issuesFilter: context.issue.workspaceIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.WORKSPACE_DRAFT:
return merge(defaultStore, {
issues: context.issue.workspaceDraftIssues,
issuesFilter: context.issue.workspaceDraftIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.PROFILE:
return merge(defaultStore, {
issues: context.issue.profileIssues,
issuesFilter: context.issue.profileIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.TEAM:
return merge(defaultStore, {
issues: context.issue.teamIssues,
issuesFilter: context.issue.teamIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.PROJECT:
return merge(defaultStore, {
issues: context.issue.projectIssues,
issuesFilter: context.issue.projectIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.CYCLE:
return merge(defaultStore, {
issues: context.issue.cycleIssues,
issuesFilter: context.issue.cycleIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.MODULE:
return merge(defaultStore, {
issues: context.issue.moduleIssues,
issuesFilter: context.issue.moduleIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.TEAM_VIEW:
return merge(defaultStore, {
issues: context.issue.teamViewIssues,
issuesFilter: context.issue.teamViewIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.PROJECT_VIEW:
return merge(defaultStore, {
issues: context.issue.projectViewIssues,
issuesFilter: context.issue.projectViewIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.ARCHIVED:
return merge(defaultStore, {
issues: context.issue.archivedIssues,
issuesFilter: context.issue.archivedIssuesFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.EPIC:
return merge(defaultStore, {
issues: context.issue.projectEpics,
issuesFilter: context.issue.projectEpicsFilter,
}) as TStoreIssues[T];
case EIssuesStoreType.TEAM_PROJECT_WORK_ITEMS:
return merge(defaultStore, {
issues: context.issue.teamProjectWorkItems,
issuesFilter: context.issue.teamProjectWorkItemsFilter,
}) as TStoreIssues[T];
default:
return merge(defaultStore, {
issues: context.issue.projectIssues,
issuesFilter: context.issue.projectIssuesFilter,
}) as TStoreIssues[T];
}
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IIssueKanBanViewStore } from "@/store/issue/issue_kanban_view.store";
export const useKanbanView = (): IIssueKanBanViewStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useLabel must be used within StoreProvider");
return context.issue.issueKanBanView;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { ILabelStore } from "@/store/label.store";
export const useLabel = (): ILabelStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useLabel must be used within StoreProvider");
return context.label;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types;
import type { IMemberRootStore } from "@/store/member";
export const useMember = (): IMemberRootStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useMember must be used within StoreProvider");
return context.memberRoot;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IModuleFilterStore } from "@/store/module_filter.store";
export const useModuleFilter = (): IModuleFilterStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useModuleFilter must be used within StoreProvider");
return context.moduleFilter;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IModuleStore } from "@/store/module.store";
export const useModule = (): IModuleStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useModule must be used within StoreProvider");
return context.module;
};

View File

@@ -0,0 +1,15 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// store
import { StoreContext } from "@/lib/store-context";
export const useMultipleSelectStore = () => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useMultipleSelectStore must be used within StoreProvider");
return context.multipleSelect;
};

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// context
import { StoreContext } from "@/lib/store-context";
// mobx store
import type { IProjectPageStore } from "@/store/pages/project-page.store";
export enum EPageStoreType {
PROJECT = "PROJECT_PAGE",
}
export type TReturnType = {
[EPageStoreType.PROJECT]: IProjectPageStore;
};
export const usePageStore = <T extends EPageStoreType>(storeType: T): TReturnType[T] => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("usePageStore must be used within StoreProvider");
if (storeType === EPageStoreType.PROJECT) {
return context.projectPages;
}
throw new Error(`Invalid store type: ${storeType}`);
};

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// plane web hooks
import type { EPageStoreType } from "./use-page-store";
import { usePageStore } from "./use-page-store";
export type TArgs = {
pageId: string;
storeType: EPageStoreType;
};
export const usePage = (args: TArgs) => {
const { pageId, storeType } = args;
// context
const context = useContext(StoreContext);
// store hooks
const pageStore = usePageStore(storeType);
if (context === undefined) throw new Error("usePage must be used within StoreProvider");
if (!pageId) throw new Error("pageId is required");
return pageStore.getPageById(pageId);
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IBasePowerKStore as IPowerKStore } from "@/store/base-power-k.store";
export const usePowerK = (): IPowerKStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("usePowerK must be used within StoreProvider");
return context.powerK;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IProjectFilterStore } from "@/store/project/project_filter.store";
export const useProjectFilter = (): IProjectFilterStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useProjectFilter must be used within StoreProvider");
return context.projectRoot.projectFilter;
};

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
import type { IProjectInboxStore } from "@/store/inbox/project-inbox.store";
export const useProjectInbox = (): IProjectInboxStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useProjectInbox must be used within StoreProvider");
return context.projectInbox;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IProjectPublishStore } from "@/store/project/project-publish.store";
export const useProjectPublish = (): IProjectPublishStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useProjectPublish must be used within StoreProvider");
return context.projectRoot.publish;
};

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
import type { IStateStore } from "@/store/state.store";
export const useProjectState = (): IStateStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useProjectState must be used within StoreProvider");
return context.state;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IProjectViewStore } from "@/store/project-view.store";
export const useProjectView = (): IProjectViewStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useProjectView must be used within StoreProvider");
return context.projectView;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IProjectStore } from "@/store/project/project.store";
export const useProject = (): IProjectStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useProject must be used within StoreProvider");
return context.projectRoot.project;
};

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// store
import { StoreContext } from "@/lib/store-context";
import type { IRouterStore } from "@/store/router.store";
export const useRouterParams = (): IRouterStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useRouterParams must be used within StoreProvider");
return context.router;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IWebhookStore } from "@/store/workspace/webhook.store";
export const useWebhook = (): IWebhookStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useWebhook must be used within StoreProvider");
return context.workspaceRoot.webhook;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IWorkspaceRootStore } from "@/store/workspace";
export const useWorkspace = (): IWorkspaceRootStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useWorkspace must be used within StoreProvider");
return context.workspaceRoot;
};

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
export * from "./user-user";
export * from "./user-user-profile";
export * from "./user-user-settings";
export * from "./user-permissions";

View File

@@ -0,0 +1,18 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// plane web imports
import type { IUserPermissionStore } from "@/store/user/base-permissions.store";
export const useUserPermissions = (): IUserPermissionStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useUserPermissions must be used within StoreProvider");
return context.user.permission;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IUserProfileStore } from "@/store/user/profile.store";
export const useUserProfile = (): IUserProfileStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useUserProfile must be used within StoreProvider");
return context.user.userProfile;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IUserSettingsStore } from "@/store/user/settings.store";
export const useUserSettings = (): IUserSettingsStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useUserSettings must be used within StoreProvider");
return context.user.userSettings;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IUserStore } from "@/store/user";
export const useUser = (): IUserStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useUser must be used within StoreProvider");
return context.user;
};

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
// plane imports
import type { IWorkItemFilterInstance } from "@plane/shared-state";
import type { EIssuesStoreType } from "@plane/types";
// local imports
import { useWorkItemFilters } from "./use-work-item-filters";
export const useWorkItemFilterInstance = (
entityType: EIssuesStoreType,
entityId: string | undefined
): IWorkItemFilterInstance | undefined => {
const { getFilter } = useWorkItemFilters();
return entityId ? getFilter(entityType, entityId) : undefined;
};

View File

@@ -0,0 +1,17 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// plane imports
import type { IWorkItemFilterStore } from "@plane/shared-state";
// context
import { StoreContext } from "@/lib/store-context";
export const useWorkItemFilters = (): IWorkItemFilterStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useWorkItemFilters must be used within StoreProvider");
return context.workItemFilters;
};

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
export * from "./use-workspace-draft-issue";
export * from "./use-workspace-draft-issue-filters";

View File

@@ -0,0 +1,18 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IWorkspaceDraftIssues } from "@/store/issue/workspace-draft";
export const useWorkspaceDraftIssueFilters = (): IWorkspaceDraftIssues => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useWorkspaceDraftIssueFilters must be used within StoreProvider");
return context.issue.workspaceDraftIssues;
};

View File

@@ -0,0 +1,18 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useContext } from "react";
// mobx store
import { StoreContext } from "@/lib/store-context";
// types
import type { IWorkspaceDraftIssues } from "@/store/issue/workspace-draft";
export const useWorkspaceDraftIssues = (): IWorkspaceDraftIssues => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useWorkspaceDraftIssues must be used within StoreProvider");
return context.issue.workspaceDraftIssues;
};