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.

fix: clean up typing and remove extraneous Address component

Rob Carringtonb6a321343db1
diff --git a/apps/carbon/app/components/Address.tsx b/apps/carbon/app/components/Address.tsx
deleted file mode 100644
index 231e8828ce..0000000000
--- a/apps/carbon/app/components/Address.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import { VStack } from "@carbon/react";
-
-type AddressProps = {
- address: {
- city: string | null;
- state: string | null;
- addressLine1: string | null;
- postalCode: string | null;
- };
-};
-
-const Address = ({ address }: AddressProps) => {
- const location = `${address.city ?? ""}, ${address.state ?? ""}`;
- const addressZip = `${address.addressLine1 ?? ""} ${
- address.postalCode ?? ""
- }`;
- return (
- <div>
- <VStack spacing={0}>
- <p className="font-bold line-clamp-1">{location}</p>
- <p className="text-sm text-muted-foreground line-clamp-1">
- {addressZip}
- </p>
- </VStack>
- </div>
- );
-};
-
-export default Address;
diff --git a/apps/carbon/app/components/Form/CustomerLocation.tsx b/apps/carbon/app/components/Form/CustomerLocation.tsx
index 1617aae7ae..543aed6f52 100644
--- a/apps/carbon/app/components/Form/CustomerLocation.tsx
+++ b/apps/carbon/app/components/Form/CustomerLocation.tsx
@@ -77,7 +77,7 @@ const CustomerLocation = (props: CustomerLocationSelectProps) => {
newLocationModal.onClose();
triggerRef.current?.click();
}}
- initialValues={{ name: "" }} // Ask Brad how to avoid this janky solution
+ initialValues={{ name: "" }}
/>
)}
</>
diff --git a/apps/carbon/app/components/Location.tsx b/apps/carbon/app/components/Location.tsx
index ccb09f7085..ca28fd7252 100644
--- a/apps/carbon/app/components/Location.tsx
+++ b/apps/carbon/app/components/Location.tsx
@@ -15,12 +15,16 @@ type LocationProps = {
state: string | null;
addressLine1: string | null;
postalCode: string | null;
- };
+ } | null;
};
actions: Action[];
};
const Location = ({ location, actions }: LocationProps) => {
+ if (!location.address) {
+ return null;
+ }
+
const locationName = location.name;
const addressLine1 = location.address.addressLine1;
const cityStateZip = `${location.address.city ?? ""}, ${
diff --git a/apps/carbon/app/components/index.ts b/apps/carbon/app/components/index.ts
index 02ac61d888..9d3f1143c8 100644
--- a/apps/carbon/app/components/index.ts
+++ b/apps/carbon/app/components/index.ts
@@ -1,4 +1,3 @@
-import Address from "./Address";
import Assignee, { useOptimisticAssignment } from "./Assignee";
import Avatar from "./Avatar";
import { BreadcrumbItem, BreadcrumbLink, Breadcrumbs } from "./Breadcrumb";
@@ -20,7 +19,6 @@ import SupplierAvatar from "./SupplierAvatar";
import Table from "./Table";
export {
- Address,
Assignee,
Avatar,
BreadcrumbItem,