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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: iconify method item type
Brad Barbin937837b047dd
diff --git a/apps/carbon/app/components/SortableList.tsx b/apps/carbon/app/components/SortableList.tsxindex 1b476d7e14..e32b95ac39 100644--- a/apps/carbon/app/components/SortableList.tsx+++ b/apps/carbon/app/components/SortableList.tsx@@ -7,16 +7,18 @@ import {motion,useDragControls,} from "framer-motion";+import type { ReactNode } from "react";import { useState } from "react";import useMeasure from "react-use-measure";-import { Checkbox, cn } from "@carbon/react";+import { Checkbox, HStack, cn } from "@carbon/react";import { LuTrash } from "react-icons/lu";export interface Item {id: string;text: string;checked: boolean;+ details?: ReactNode;order?: "With Previous" | "After Previous";}@@ -115,10 +117,10 @@ function SortableListItem<T>({}whileDrag={{ zIndex: 9999 }}>- <div ref={ref} className={cn(isExpanded ? "" : "", "z-20 ")}>+ <div ref={ref} className={cn(isExpanded ? "w-full" : "", "z-20 ")}><motion.divlayout="position"- className="flex items-center justify-center "+ className="grid items-center justify-between grid-cols-[1fr_auto] w-full gap-2"><AnimatePresence>{!isExpanded ? (@@ -127,7 +129,7 @@ function SortableListItem<T>({animate={{ opacity: 1, filter: "blur(0px)" }}exit={{ opacity: 0, filter: "blur(4px)" }}transition={{ duration: 0.001 }}- className="flex items-center space-x-2 "+ className="flex w-full items-center gap-x-2 truncate">{/* List Remove Actions */}<Checkbox@@ -135,7 +137,7 @@ function SortableListItem<T>({id={`checkbox-${item.id}`}aria-label="Mark to delete"onCheckedChange={() => onToggleItem(item.id)}- className=" ml-3 h-5 w-5 rounded-md border-foreground/20 bg-background/30 data-[state=checked]:bg-background data-[state=checked]:text-red-200"+ className="ml-3 h-5 w-5 rounded-md border-foreground/20 bg-background/30 data-[state=checked]:bg-background data-[state=checked]:text-red-200 flex flex-shrink-0 "/>{/* List Order */}<p className="font-mono text-xs pl-1 text-foreground/50 flex flex-shrink-0">@@ -145,7 +147,7 @@ function SortableListItem<T>({{/* List Title */}<motion.divkey={`${item.checked}`}- className=" px-1 flex flex-grow truncate"+ className="px-1 flex flex-grow truncate"initial={{opacity: 0,filter: "blur(4px)",@@ -157,16 +159,23 @@ function SortableListItem<T>({type: "spring",}}>- <h4- className={cn(- "tracking-tighter text-base md:text-lg ",- item.checked- ? "text-red-400"- : "text-foreground dark:text-foreground/70"+ <HStack className="w-full justify-between">+ <h4+ className={cn(+ "flex tracking-tighter text-base md:text-lg truncate",+ item.checked+ ? "text-red-400"+ : "text-foreground dark:text-foreground/70"+ )}+ >+ {item.text}+ </h4>+ {item.details && (+ <div className="flex flex-shrink-0">+ {item.details}+ </div>)}- >- {item.text}- </h4>+ </HStack></motion.div></motion.div>) : null}diff --git a/apps/carbon/app/modules/items/ui/Consumables/ConsumableHeader.tsx b/apps/carbon/app/modules/items/ui/Consumables/ConsumableHeader.tsxindex c7fb4869d9..958cdaed77 100644--- a/apps/carbon/app/modules/items/ui/Consumables/ConsumableHeader.tsx+++ b/apps/carbon/app/modules/items/ui/Consumables/ConsumableHeader.tsx@@ -1,9 +1,9 @@-import { Enumerable, HStack, Heading, VStack } from "@carbon/react";+import { Badge, HStack, Heading, VStack } from "@carbon/react";import { useParams } from "@remix-run/react";import { DetailsTopbar } from "~/components/Layout";import { useRouteData } from "~/hooks";-import type { Consumable } from "~/modules/items";+import { MethodItemTypeIcon, type Consumable } from "~/modules/items";import { path } from "~/utils/path";import { useConsumableNavigation } from "./useConsumableNavigation";@@ -21,7 +21,9 @@ const ConsumableHeader = () => {<VStack spacing={0} className="flex-grow"><HStack><Heading size="h2">{routeData?.consumableSummary?.id}</Heading>- <Enumerable value="Consumable" />+ <Badge variant="secondary">+ <MethodItemTypeIcon type="Consumable" />+ </Badge></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/carbon/app/modules/items/ui/Fixtures/FixtureHeader.tsx b/apps/carbon/app/modules/items/ui/Fixtures/FixtureHeader.tsxindex d4d61f567c..4007174c34 100644--- a/apps/carbon/app/modules/items/ui/Fixtures/FixtureHeader.tsx+++ b/apps/carbon/app/modules/items/ui/Fixtures/FixtureHeader.tsx@@ -1,9 +1,9 @@-import { Enumerable, HStack, Heading, VStack } from "@carbon/react";+import { Badge, HStack, Heading, VStack } from "@carbon/react";import { useParams } from "@remix-run/react";import { DetailsTopbar } from "~/components/Layout";import { useRouteData } from "~/hooks";-import type { Fixture } from "~/modules/items";+import { MethodItemTypeIcon, type Fixture } from "~/modules/items";import { path } from "~/utils/path";import { useFixtureNavigation } from "./useFixtureNavigation";@@ -21,7 +21,9 @@ const FixtureHeader = () => {<VStack spacing={0} className="flex-grow"><HStack><Heading size="h2">{routeData?.fixtureSummary?.id}</Heading>- <Enumerable value="Fixture" />+ <Badge variant="secondary">+ <MethodItemTypeIcon type="Fixture" />+ </Badge></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsxindex 08c17bde64..b19b8c4ce0 100644--- a/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx+++ b/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx@@ -1,5 +1,6 @@"use client";import {+ Badge,Button,Card,CardAction,@@ -40,6 +41,7 @@ import { useSupabase } from "~/lib/supabase";import { path } from "~/utils/path";import { methodItemType, methodMaterialValidator } from "../../items.models";import type { MethodItemType, MethodType } from "../../types";+import { MethodIcon, MethodItemTypeIcon } from "./MethodIcon";type Material = z.infer<typeof methodMaterialValidator>;@@ -61,6 +63,18 @@ function makeItem(material: Material): ItemWithData {id: material.id!,text: material.description ?? "",checked: false,+ details: (+ <HStack spacing={2}>+ <Badge variant="secondary">+ <MethodIcon type={material.methodType} />+ </Badge>++ <Badge variant="secondary">{material.quantity}</Badge>+ <Badge variant="secondary">+ <MethodItemTypeIcon type={material.itemType} />+ </Badge>+ </HStack>+ ),data: material,};}@@ -204,8 +218,8 @@ const BillOfMaterial = ({ makeMethodId, materials }: BillOfMaterialProps) => {<divkey={`${isOpen}`}className={cn(- "flex h-full w-full flex-col items-center justify-center gap-2 ",- isOpen ? "py-1 px-1" : "py-3 "+ "flex h-full flex-col items-center justify-center pl-2",+ isOpen ? "py-1" : "py-3 ")}><motion.button@@ -313,7 +327,7 @@ const BillOfMaterial = ({ makeMethodId, materials }: BillOfMaterialProps) => {<Card><HStack className="justify-between"><CardHeader>- <CardTitle>Bill of Materials</CardTitle>+ <CardTitle>Bill of Material</CardTitle></CardHeader><CardAction>diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsxindex 6d42ea314c..605aa6f3ab 100644--- a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx+++ b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx@@ -1,6 +1,7 @@"use client";import type { JSONContent } from "@carbon/react";import {+ Badge,Button,Card,CardAction,@@ -69,6 +70,7 @@ function makeItem(operation: Operation): ItemWithData {text: operation.description ?? "",checked: false,order: operation.operationOrder,+ details: <Badge variant="secondary">{operation.operationOrder}</Badge>,data: operation,};}@@ -320,8 +322,8 @@ const BillOfProcess = ({ makeMethodId, operations }: BillOfProcessProps) => {<divkey={`${isOpen}`}className={cn(- "flex h-full w-full flex-col items-center justify-center gap-2 ",- isOpen ? "py-1 px-1" : "py-3 "+ "flex h-full flex-col items-center justify-center gap-2 pl-2",+ isOpen ? "py-1" : "py-3 ")}><motion.button@@ -420,7 +422,7 @@ const BillOfProcess = ({ makeMethodId, operations }: BillOfProcessProps) => {<Card><HStack className="justify-between"><CardHeader>- <CardTitle>Bill of Processes</CardTitle>+ <CardTitle>Bill of Process</CardTitle></CardHeader><CardAction>diff --git a/apps/carbon/app/modules/items/ui/Item/MethodIcon.tsx b/apps/carbon/app/modules/items/ui/Item/MethodIcon.tsxindex b066414e0e..a488600602 100644--- a/apps/carbon/app/modules/items/ui/Item/MethodIcon.tsx+++ b/apps/carbon/app/modules/items/ui/Item/MethodIcon.tsx@@ -2,7 +2,36 @@ import { cn } from "@carbon/react";import { AiOutlinePartition } from "react-icons/ai";import { FaCodePullRequest } from "react-icons/fa6";import { HiSquares2X2 } from "react-icons/hi2";-import { LuHammer, LuShoppingCart } from "react-icons/lu";+import { LuGrip, LuHammer, LuShoppingCart } from "react-icons/lu";++import { CiFries } from "react-icons/ci";+import { GiIBeam } from "react-icons/gi";+import { RiCustomerServiceLine } from "react-icons/ri";++export const MethodItemTypeIcon = ({+ type,+ className,+}: {+ type: string;+ className?: string;+}) => {+ switch (type) {+ case "Part":+ return <AiOutlinePartition className={className} />;+ case "Material":+ return <GiIBeam className={className} />;+ case "Tool":+ return <LuHammer className={className} />;+ case "Fixture":+ return <LuGrip className={className} />;+ case "Consumable":+ return <CiFries className={className} />;+ case "Service":+ return <RiCustomerServiceLine className={className} />;+ }++ return <HiSquares2X2 className={cn("text-muted-foreground", className)} />;+};export const MethodIcon = ({type,diff --git a/apps/carbon/app/modules/items/ui/Item/index.ts b/apps/carbon/app/modules/items/ui/Item/index.tsindex 96ec0d9ca6..f203fabcd9 100644--- a/apps/carbon/app/modules/items/ui/Item/index.ts+++ b/apps/carbon/app/modules/items/ui/Item/index.ts@@ -7,7 +7,7 @@ import ItemForm from "./ItemForm";import ItemPlanningForm from "./ItemPlanningForm";import ItemPurchasingForm from "./ItemPurchasingForm";import ItemSalePriceForm from "./ItemSalePriceForm";-import { MethodIcon } from "./MethodIcon";+import { MethodIcon, MethodItemTypeIcon } from "./MethodIcon";import PickMethodForm from "./PickMethodForm";export {@@ -21,5 +21,6 @@ export {ItemPurchasingForm,ItemSalePriceForm,MethodIcon,+ MethodItemTypeIcon,PickMethodForm,};diff --git a/apps/carbon/app/modules/items/ui/Materials/MaterialHeader.tsx b/apps/carbon/app/modules/items/ui/Materials/MaterialHeader.tsxindex d6af518a12..bc0bb19b6a 100644--- a/apps/carbon/app/modules/items/ui/Materials/MaterialHeader.tsx+++ b/apps/carbon/app/modules/items/ui/Materials/MaterialHeader.tsx@@ -1,9 +1,9 @@-import { Enumerable, HStack, Heading, VStack } from "@carbon/react";+import { Badge, HStack, Heading, VStack } from "@carbon/react";import { useParams } from "@remix-run/react";import { DetailsTopbar } from "~/components/Layout";import { useRouteData } from "~/hooks";-import type { Material } from "~/modules/items";+import { MethodItemTypeIcon, type Material } from "~/modules/items";import { path } from "~/utils/path";import { useMaterialNavigation } from "./useMaterialNavigation";@@ -21,7 +21,9 @@ const MaterialHeader = () => {<VStack spacing={0} className="flex-grow"><HStack><Heading size="h2">{routeData?.materialSummary?.id}</Heading>- <Enumerable value="Material" />+ <Badge variant="secondary">+ <MethodItemTypeIcon type="Material" />+ </Badge></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/carbon/app/modules/items/ui/Parts/PartHeader.tsx b/apps/carbon/app/modules/items/ui/Parts/PartHeader.tsxindex 2eb1126c2d..7cb18928de 100644--- a/apps/carbon/app/modules/items/ui/Parts/PartHeader.tsx+++ b/apps/carbon/app/modules/items/ui/Parts/PartHeader.tsx@@ -1,9 +1,9 @@-import { Enumerable, HStack, Heading, VStack } from "@carbon/react";+import { Badge, HStack, Heading, VStack } from "@carbon/react";import { useParams } from "@remix-run/react";import { DetailsTopbar } from "~/components/Layout";import { useRouteData } from "~/hooks";-import type { PartSummary } from "~/modules/items";+import { MethodItemTypeIcon, type PartSummary } from "~/modules/items";import { path } from "~/utils/path";import { usePartNavigation } from "./usePartNavigation";@@ -21,7 +21,9 @@ const PartHeader = () => {<VStack spacing={0} className="flex-grow"><HStack><Heading size="h2">{routeData?.partSummary?.id}</Heading>- <Enumerable value="Part" />+ <Badge variant="secondary">+ <MethodItemTypeIcon type="Part" />+ </Badge></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx b/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsxindex 997204816e..90b7afa040 100644--- a/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx+++ b/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx@@ -80,13 +80,12 @@ const ServiceForm = ({ initialValues }: ServiceFormProps) => {/>)}<Input name="name" label="Name" />- <TextArea name="description" label="Description" />-<Selectname="serviceType"label="Service Type"options={serviceTypeOptions}/>+ {isEditing && <TextArea name="description" label="Description" />}<Boolean name="active" label="Active" /><CustomFormFields table="service" />diff --git a/apps/carbon/app/modules/items/ui/Services/ServiceHeader.tsx b/apps/carbon/app/modules/items/ui/Services/ServiceHeader.tsxindex 0d49c34d53..80e597d2d5 100644--- a/apps/carbon/app/modules/items/ui/Services/ServiceHeader.tsx+++ b/apps/carbon/app/modules/items/ui/Services/ServiceHeader.tsx@@ -1,9 +1,9 @@-import { Enumerable, HStack, Heading, VStack } from "@carbon/react";+import { Badge, HStack, Heading, VStack } from "@carbon/react";import { useParams } from "@remix-run/react";import { DetailsTopbar } from "~/components/Layout";import { useRouteData } from "~/hooks";-import type { Service } from "~/modules/items";+import { MethodItemTypeIcon, type Service } from "~/modules/items";import { path } from "~/utils/path";import { useServiceNavigation } from "./useServiceNavigation";@@ -22,7 +22,9 @@ const ServiceHeader = () => {<VStack spacing={0} className="flex-grow"><HStack><Heading size="h2">{routeData?.service?.id}</Heading>- <Enumerable value="Service" />+ <Badge variant="secondary">+ <MethodItemTypeIcon type="Service" />+ </Badge></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/carbon/app/modules/items/ui/Tools/ToolHeader.tsx b/apps/carbon/app/modules/items/ui/Tools/ToolHeader.tsxindex 5d2a5f8968..8cd57fc3db 100644--- a/apps/carbon/app/modules/items/ui/Tools/ToolHeader.tsx+++ b/apps/carbon/app/modules/items/ui/Tools/ToolHeader.tsx@@ -1,9 +1,9 @@-import { Enumerable, HStack, Heading, VStack } from "@carbon/react";+import { Badge, HStack, Heading, VStack } from "@carbon/react";import { useParams } from "@remix-run/react";import { DetailsTopbar } from "~/components/Layout";import { useRouteData } from "~/hooks";-import type { Tool } from "~/modules/items";+import { MethodItemTypeIcon, type Tool } from "~/modules/items";import { path } from "~/utils/path";import { useToolNavigation } from "./useToolNavigation";@@ -19,7 +19,9 @@ const ToolHeader = () => {<VStack spacing={0} className="flex-grow"><HStack><Heading size="h2">{routeData?.toolSummary?.id}</Heading>- <Enumerable value="Tool" />+ <Badge variant="secondary">+ <MethodItemTypeIcon type="Tool" />+ </Badge></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">