Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

refactor: better exports for treeview component

Brad Barbin977141c48306
diff --git a/apps/carbon/app/components/Gantt/Gantt.tsx b/apps/carbon/app/components/Gantt/Gantt.tsx
index 2397a457ab..1288c3aa27 100644
--- a/apps/carbon/app/components/Gantt/Gantt.tsx
+++ b/apps/carbon/app/components/Gantt/Gantt.tsx
@@ -40,9 +40,8 @@ import { GanttIcon } from "./components/GanttIcon";
import type { GanttEvent } from "~/components/Gantt/types";
import { ShortcutKey, variants } from "~/components/ShortcutKey";
import * as Timeline from "~/components/Timeline";
-import type { UseTreeStateOutput } from "~/components/TreeView/TreeView";
-import { TreeView, useTree } from "~/components/TreeView/TreeView";
-import type { NodesState } from "~/components/TreeView/reducer";
+import type { NodesState, UseTreeStateOutput } from "~/components/TreeView";
+import { TreeView, useTree } from "~/components/TreeView";
import { useShortcutKeys } from "~/hooks";
import type { Shortcut } from "~/hooks/useShortcutKeys";
import { setResizableGanttSettings } from "~/utils/resizablePanel";
diff --git a/apps/carbon/app/components/TreeView/index.ts b/apps/carbon/app/components/TreeView/index.ts
index e69de29bb2..4ecd0ce2b5 100644
--- a/apps/carbon/app/components/TreeView/index.ts
+++ b/apps/carbon/app/components/TreeView/index.ts
@@ -0,0 +1,12 @@
+import type { NodesState, NodeState } from "./reducer";
+import type { FlatTree, FlatTreeItem, UseTreeStateOutput } from "./TreeView";
+import { flattenTree, TreeView, useTree } from "./TreeView";
+
+export { flattenTree, TreeView, useTree };
+export type {
+ FlatTree,
+ FlatTreeItem,
+ NodesState,
+ NodeState,
+ UseTreeStateOutput,
+};
diff --git a/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx b/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
index 152794bff7..55e8f3e75d 100644
--- a/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
@@ -11,8 +11,8 @@ import {
import { useNavigate, useParams } from "@remix-run/react";
import { useRef, useState } from "react";
import { LuChevronDown, LuChevronUp, LuSearch } from "react-icons/lu";
-import type { FlatTreeItem } from "~/components/TreeView/TreeView";
-import { TreeView, useTree } from "~/components/TreeView/TreeView";
+import type { FlatTreeItem } from "~/components/TreeView";
+import { TreeView, useTree } from "~/components/TreeView";
import type { Method } from "~/modules/items";
import type { MethodItemType } from "~/modules/shared";
import { MethodIcon, MethodItemTypeIcon } from "~/modules/shared";
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
index b1c3ba8069..4b8f96a58a 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
@@ -1,8 +1,8 @@
import { Badge, HStack, VStack, cn } from "@carbon/react";
import { useRef } from "react";
import { LuChevronDown, LuChevronUp } from "react-icons/lu";
-import type { FlatTreeItem } from "~/components/TreeView/TreeView";
-import { TreeView, useTree } from "~/components/TreeView/TreeView";
+import type { FlatTreeItem } from "~/components/TreeView";
+import { TreeView, useTree } from "~/components/TreeView";
import type { Method } from "~/modules/items/types";
import { MethodIcon, MethodItemTypeIcon } from "~/modules/shared";
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.tsx
index 6f6e874f05..5f27c1b3de 100644
--- a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.tsx
@@ -15,8 +15,8 @@ import {
useParams,
} from "@remix-run/react";
-import type { FlatTreeItem } from "~/components/TreeView/TreeView";
-import { flattenTree } from "~/components/TreeView/TreeView";
+import type { FlatTreeItem } from "~/components/TreeView";
+import { flattenTree } from "~/components/TreeView";
import type { Method } from "~/modules/items";
import {
BoMExplorer,
diff --git a/apps/carbon/app/routes/x+/part+/$itemId.manufacturing.tsx b/apps/carbon/app/routes/x+/part+/$itemId.manufacturing.tsx
index cc6e3e8fd8..9b1a87eb74 100644
--- a/apps/carbon/app/routes/x+/part+/$itemId.manufacturing.tsx
+++ b/apps/carbon/app/routes/x+/part+/$itemId.manufacturing.tsx
@@ -15,8 +15,8 @@ import {
useParams,
} from "@remix-run/react";
-import type { FlatTreeItem } from "~/components/TreeView/TreeView";
-import { flattenTree } from "~/components/TreeView/TreeView";
+import type { FlatTreeItem } from "~/components/TreeView";
+import { flattenTree } from "~/components/TreeView";
import type { Method } from "~/modules/items";
import {
BoMExplorer,
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.tsx
index e5e0138556..71d7bdc02a 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.tsx
@@ -21,7 +21,7 @@ import { Outlet, useNavigate, useParams } from "@remix-run/react";
import { useState } from "react";
import { LuGhost, LuImage, LuPlus } from "react-icons/lu";
import { MdMoreVert } from "react-icons/md";
-import type { FlatTree } from "~/components/TreeView/TreeView";
+import type { FlatTree } from "~/components/TreeView";
import { useRouteData, useUser } from "~/hooks";
import type { QuotationLine } from "~/modules/sales";
import {