From be637fc7fec5ed5932ab09896a2cadd326eff727 Mon Sep 17 00:00:00 2001 From: Atul Tameshwari Date: Tue, 16 Jun 2026 21:20:02 +0530 Subject: [PATCH] refactor: remove legacy navigation components and update import paths for navigation items in core --- apps/web/ce/components/navigations/index.ts | 8 -------- apps/web/ce/components/workspace/content-wrapper.tsx | 3 +-- apps/web/core/components/navigation/project-header.tsx | 3 +-- .../core/components/navigation/tab-navigation-root.tsx | 5 ++--- .../components/navigation}/top-navigation-root.tsx | 0 .../components/navigation}/use-navigation-items.ts | 2 ++ .../components/workspace/sidebar/projects-list-item.tsx | 3 +-- 7 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 apps/web/ce/components/navigations/index.ts rename apps/web/{ce/components/navigations => core/components/navigation}/top-navigation-root.tsx (100%) rename apps/web/{ce/components/navigations => core/components/navigation}/use-navigation-items.ts (97%) diff --git a/apps/web/ce/components/navigations/index.ts b/apps/web/ce/components/navigations/index.ts deleted file mode 100644 index b4131e9325..0000000000 --- a/apps/web/ce/components/navigations/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * 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-navigation-items"; -export * from "./top-navigation-root"; diff --git a/apps/web/ce/components/workspace/content-wrapper.tsx b/apps/web/ce/components/workspace/content-wrapper.tsx index 46d1d609b9..3d605d65d6 100644 --- a/apps/web/ce/components/workspace/content-wrapper.tsx +++ b/apps/web/ce/components/workspace/content-wrapper.tsx @@ -10,8 +10,7 @@ import { observer } from "mobx-react"; import { cn } from "@plane/utils"; import { AppRailRoot } from "@/components/navigation"; import { useAppRailVisibility } from "@/lib/app-rail"; -// local imports -import { TopNavigationRoot } from "../navigations"; +import { TopNavigationRoot } from "@/components/navigation/top-navigation-root"; export const WorkspaceContentWrapper = observer(function WorkspaceContentWrapper({ children, diff --git a/apps/web/core/components/navigation/project-header.tsx b/apps/web/core/components/navigation/project-header.tsx index 134c8d3031..172c10f1e6 100644 --- a/apps/web/core/components/navigation/project-header.tsx +++ b/apps/web/core/components/navigation/project-header.tsx @@ -14,13 +14,12 @@ import { CustomSearchSelect } from "@plane/ui"; import { useProject } from "@/hooks/store/use-project"; import { useUserPermissions } from "@/hooks/store/user"; import { useAppRouter } from "@/hooks/use-app-router"; -// plane web imports -import { useNavigationItems } from "@/plane-web/components/navigations"; // local imports import { SwitcherLabel } from "../common/switcher-label"; import { ProjectHeaderButton } from "./project-header-button"; import { getTabUrl } from "./tab-navigation-utils"; import { useTabPreferences } from "./use-tab-preferences"; +import { useNavigationItems } from "./use-navigation-items"; type TProjectHeaderProps = { workspaceSlug: string; diff --git a/apps/web/core/components/navigation/tab-navigation-root.tsx b/apps/web/core/components/navigation/tab-navigation-root.tsx index f3bd16c60d..db754ee38e 100644 --- a/apps/web/core/components/navigation/tab-navigation-root.tsx +++ b/apps/web/core/components/navigation/tab-navigation-root.tsx @@ -15,8 +15,6 @@ import type { EUserProjectRoles } from "@plane/types"; import { useIssueDetail } from "@/hooks/store/use-issue-detail"; import { useProject } from "@/hooks/store/use-project"; import { useUserPermissions } from "@/hooks/store/user"; -// plane web imports -import { useNavigationItems } from "@/plane-web/components/navigations"; // local imports import { LeaveProjectModal } from "../project/leave-project-modal"; import { PublishProjectModal } from "../project/publish-project/modal"; @@ -29,6 +27,7 @@ import { useActiveTab } from "./use-active-tab"; import { useProjectActions } from "./use-project-actions"; import { useResponsiveTabLayout } from "./use-responsive-tab-layout"; import { useTabPreferences } from "./use-tab-preferences"; +import { useNavigationItems } from "./use-navigation-items"; // Local type definition for navigation items with app-specific fields export type TNavigationItem = { @@ -109,7 +108,7 @@ export const TabNavigationRoot = observer(function TabNavigationRoot(props: TTab // Filter and sort navigation items const allNavigationItems = navigationItems .filter((item) => item.shouldRender) - .sort((a, b) => a.sortOrder - b.sortOrder); + .toSorted((a, b) => a.sortOrder - b.sortOrder); // Split items into two categories: // 1. visibleNavigationItems: Items NOT user-hidden (may still overflow due to space) diff --git a/apps/web/ce/components/navigations/top-navigation-root.tsx b/apps/web/core/components/navigation/top-navigation-root.tsx similarity index 100% rename from apps/web/ce/components/navigations/top-navigation-root.tsx rename to apps/web/core/components/navigation/top-navigation-root.tsx diff --git a/apps/web/ce/components/navigations/use-navigation-items.ts b/apps/web/core/components/navigation/use-navigation-items.ts similarity index 97% rename from apps/web/ce/components/navigations/use-navigation-items.ts rename to apps/web/core/components/navigation/use-navigation-items.ts index 7e085a1d24..621d9e3a54 100644 --- a/apps/web/ce/components/navigations/use-navigation-items.ts +++ b/apps/web/core/components/navigation/use-navigation-items.ts @@ -31,6 +31,7 @@ export const useNavigationItems = ({ }: UseNavigationItemsProps): TNavigationItem[] => { // Base navigation items const baseNavigation = useCallback( + // oxlint-disable-next-line no-shadow (workspaceSlug: string, projectId: string): TNavigationItem[] => [ { i18n_key: "sidebar.work_items", @@ -108,6 +109,7 @@ export const useNavigationItems = ({ }); // Sort by sortOrder + // oxlint-disable-next-line unicorn/no-array-sort return filteredItems.sort((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0)); }, [workspaceSlug, projectId, baseNavigation, allowPermissions, project?.id]); diff --git a/apps/web/core/components/workspace/sidebar/projects-list-item.tsx b/apps/web/core/components/workspace/sidebar/projects-list-item.tsx index cff27b5469..b0b5a1afec 100644 --- a/apps/web/core/components/workspace/sidebar/projects-list-item.tsx +++ b/apps/web/core/components/workspace/sidebar/projects-list-item.tsx @@ -38,11 +38,10 @@ import { useProject } from "@/hooks/store/use-project"; import { useUserPermissions } from "@/hooks/store/user"; import { useProjectNavigationPreferences } from "@/hooks/use-navigation-preferences"; import { usePlatformOS } from "@/hooks/use-platform-os"; -// plane web imports -import { useNavigationItems } from "@/plane-web/components/navigations"; // local imports import { HIGHLIGHT_CLASS, highlightIssueOnDrop } from "../../issues/issue-layouts/utils"; import { ProjectNavigation } from "./project-navigation"; +import { useNavigationItems } from "@/components/navigation/use-navigation-items"; type Props = { projectId: string;