From 973ef5e9d4fa0dafca66afecc89e7f245883e9fb Mon Sep 17 00:00:00 2001 From: Rahulcheryala Date: Fri, 5 Jun 2026 16:48:14 +0530 Subject: [PATCH] refactor: migrate hooks (use-timeline-chart) from web/app/ce to web/app/core --- apps/web/ce/hooks/use-timeline-chart.ts | 32 ----------------------- apps/web/core/hooks/use-timeline-chart.ts | 25 ++++++++++++++++-- 2 files changed, 23 insertions(+), 34 deletions(-) delete mode 100644 apps/web/ce/hooks/use-timeline-chart.ts diff --git a/apps/web/ce/hooks/use-timeline-chart.ts b/apps/web/ce/hooks/use-timeline-chart.ts deleted file mode 100644 index 2deaae2542..0000000000 --- a/apps/web/ce/hooks/use-timeline-chart.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -// types -import type { TTimelineTypeCore } from "@plane/types"; -import { GANTT_TIMELINE_TYPE } from "@plane/types"; -// Plane-web - -import type { IBaseTimelineStore } from "@/plane-web/store/timeline/base-timeline.store"; -import type { ITimelineStore } from "../store/timeline"; - -export const getTimelineStore = ( - timelineStore: ITimelineStore, - timelineType: TTimelineTypeCore -): IBaseTimelineStore => { - if (timelineType === GANTT_TIMELINE_TYPE.ISSUE) { - return timelineStore.issuesTimeLineStore as IBaseTimelineStore; - } - if (timelineType === GANTT_TIMELINE_TYPE.MODULE) { - return timelineStore.modulesTimeLineStore as IBaseTimelineStore; - } - if (timelineType === GANTT_TIMELINE_TYPE.PROJECT) { - return timelineStore.projectTimeLineStore; - } - if (timelineType === GANTT_TIMELINE_TYPE.GROUPED) { - return timelineStore.groupedTimeLineStore; - } - throw new Error(`Unknown timeline type: ${timelineType}`); -}; diff --git a/apps/web/core/hooks/use-timeline-chart.ts b/apps/web/core/hooks/use-timeline-chart.ts index ec8b4f1a0b..ea81a1c03f 100644 --- a/apps/web/core/hooks/use-timeline-chart.ts +++ b/apps/web/core/hooks/use-timeline-chart.ts @@ -6,14 +6,35 @@ import { useContext } from "react"; // types +import type { TTimelineTypeCore } from "@plane/types"; import type { TTimelineType } from "@plane/types"; +import { GANTT_TIMELINE_TYPE } from "@plane/types"; // lib import { StoreContext } from "@/lib/store-context"; -// Plane-web -import { getTimelineStore } from "@/plane-web/hooks/use-timeline-chart"; +// plane-web store types import type { IBaseTimelineStore } from "@/plane-web/store/timeline/base-timeline.store"; +import type { ITimelineStore } from "@/plane-web/store/timeline"; import { useTimeLineType } from "../components/gantt-chart/contexts"; +export const getTimelineStore = ( + timelineStore: ITimelineStore, + timelineType: TTimelineTypeCore +): IBaseTimelineStore => { + if (timelineType === GANTT_TIMELINE_TYPE.ISSUE) { + return timelineStore.issuesTimeLineStore as IBaseTimelineStore; + } + if (timelineType === GANTT_TIMELINE_TYPE.MODULE) { + return timelineStore.modulesTimeLineStore as IBaseTimelineStore; + } + if (timelineType === GANTT_TIMELINE_TYPE.PROJECT) { + return timelineStore.projectTimeLineStore; + } + if (timelineType === GANTT_TIMELINE_TYPE.GROUPED) { + return timelineStore.groupedTimeLineStore; + } + throw new Error(`Unknown timeline type: ${timelineType}`); +}; + export const useTimeLineChart = (timelineType: TTimelineType): IBaseTimelineStore => { const context = useContext(StoreContext); if (!context) throw new Error("useTimeLineChart must be used within StoreProvider");