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.

feat(items): color the supersession mode options and align alert icon

Brad Barbin750932c7f5f2
diff --git a/apps/erp/app/modules/items/ui/Item/ItemSupersessionForm.tsx b/apps/erp/app/modules/items/ui/Item/ItemSupersessionForm.tsx
index c8e5921b7f..ffe86e9c04 100644
--- a/apps/erp/app/modules/items/ui/Item/ItemSupersessionForm.tsx
+++ b/apps/erp/app/modules/items/ui/Item/ItemSupersessionForm.tsx
@@ -8,13 +8,13 @@ import {
CardFooter,
CardHeader,
CardTitle,
+ Status,
VStack
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useState } from "react";
import { LuTriangleAlert } from "react-icons/lu";
import type { z } from "zod";
-import { Enumerable } from "~/components/Enumerable";
import {
DatePicker,
Hidden,
@@ -38,6 +38,16 @@ const modeDescriptions: Record<SupersessionMode, string> = {
"No Stock": "Fully obsolete — do not plan or stock"
};
+const modeStatusColor: Record<
+ SupersessionMode,
+ "green" | "blue" | "orange" | "red"
+> = {
+ "Consume First": "green",
+ "Prefer New": "blue",
+ "Stock Only": "orange",
+ "No Stock": "red"
+};
+
// Derived lifecycle status shown on the item header (PRD: Active has no badge).
export function getItemLifecycleStatus(
mode: SupersessionMode | null | undefined
@@ -123,7 +133,7 @@ const ItemSupersessionForm = ({
<VStack spacing={4}>
{hasChain && chainLabel && (
<Alert variant="destructive">
- <LuTriangleAlert className="h-4 w-4" />
+ <LuTriangleAlert className="h-4 w-4 !top-3.5" />
<AlertTitle>
<Trans>Supersession chain detected</Trans>
</AlertTitle>
@@ -137,7 +147,7 @@ const ItemSupersessionForm = ({
)}
{mode === "No Stock" && quantityOnHand > 0 && (
<Alert>
- <LuTriangleAlert className="h-4 w-4" />
+ <LuTriangleAlert className="h-4 w-4 !top-3.5" />
<AlertTitle>
<Trans>On-hand inventory remains</Trans>
</AlertTitle>
@@ -157,7 +167,9 @@ const ItemSupersessionForm = ({
placeholder={t`None`}
helperText={mode ? modeDescriptions[mode] : undefined}
options={supersessionModes.map((value) => ({
- label: <Enumerable value={value} />,
+ label: (
+ <Status color={modeStatusColor[value]}>{value}</Status>
+ ),
value
}))}
onChange={(selected) => {