mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 13:29:56 +02:00
refactor: remove legacy navigation components and update import paths for navigation items in core
This commit is contained in:
@@ -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";
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user