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.

style: minor style changes for MES ui

Brad Barbin61d1ab231592
diff --git a/apps/carbon/app/routes/x+/api+/$lang.intro.tsx b/apps/carbon/app/routes/x+/api+/$lang.intro.tsx
index 5bf6bec885..8d8c65d525 100644
--- a/apps/carbon/app/routes/x+/api+/$lang.intro.tsx
+++ b/apps/carbon/app/routes/x+/api+/$lang.intro.tsx
@@ -42,7 +42,7 @@ export default function Route() {
<code>PUBLIC_KEY</code> (shown below) in addition to your{" "}
<code>carbon-key</code> API Key.
</p>
- <Alert variant="success">
+ <Alert variant="destructive">
<LuAlertTriangle className="h-4 w-4 my-1" />
<AlertTitle className="!my-0 font-bold text-base">
You should never expose the <code>carbon-key</code> in the
diff --git a/apps/mes/app/components/JobOperation.tsx b/apps/mes/app/components/JobOperation.tsx
index ebba627b21..3a76035589 100644
--- a/apps/mes/app/components/JobOperation.tsx
+++ b/apps/mes/app/components/JobOperation.tsx
@@ -277,15 +277,15 @@ export const JobOperation = ({
<ScrollArea className="w-full h-[calc(100vh-var(--header-height)*2-var(--controls-height)-2rem)] overflow-y-auto">
<div className="flex items-start justify-between p-4">
<HStack>
+ {thumbnailPath && (
+ <ItemThumbnail thumbnailPath={thumbnailPath} size="xl" />
+ )}
<div className="flex flex-col flex-grow">
<Heading size="h2">{operation.itemReadableId}</Heading>
<p className="text-muted-foreground line-clamp-1">
{operation.itemDescription}
</p>
</div>
- {thumbnailPath && (
- <ItemThumbnail thumbnailPath={thumbnailPath} size="xl" />
- )}
</HStack>
<div className="flex flex-col flex-shrink items-end">
<Heading size="h2">{operation.operationQuantity}</Heading>
@@ -509,6 +509,11 @@ export const JobOperation = ({
operation.setupDuration
)}
value={(progress.setup / operation.setupDuration) * 100}
+ indicatorClassName={
+ progress.setup > operation.setupDuration
+ ? "bg-red-500"
+ : ""
+ }
/>
</HStack>
)}
@@ -526,6 +531,11 @@ export const JobOperation = ({
operation.laborDuration
)}
value={(progress.labor / operation.laborDuration) * 100}
+ indicatorClassName={
+ progress.labor > operation.laborDuration
+ ? "bg-red-500"
+ : ""
+ }
/>
</HStack>
)}
@@ -543,6 +553,11 @@ export const JobOperation = ({
operation.machineDuration
)}
value={(progress.machine / operation.machineDuration) * 100}
+ indicatorClassName={
+ progress.machine > operation.machineDuration
+ ? "bg-red-500"
+ : ""
+ }
/>
</HStack>
)}
@@ -555,7 +570,8 @@ export const JobOperation = ({
</Tooltip>
<Progress
indicatorClassName={
- operation.operationStatus === "Paused"
+ operation.operationStatus === "Paused" &&
+ operation.quantityComplete < operation.operationQuantity
? "bg-yellow-500"
: ""
}
@@ -1267,6 +1283,13 @@ function QuantityModal({
finish: path.to.finish,
};
+ const actionButtonMap = {
+ scrap: "Log Scrap",
+ rework: "Log Rework",
+ complete: "Log Completed",
+ finish: isOperationComplete ? "Close" : "Close Anyways",
+ };
+
const validatorMap = {
scrap: scrapQuantityValidator,
rework: nonScrapQuantityValidator,
@@ -1312,7 +1335,7 @@ function QuantityModal({
<Hidden name="machineProductionEventId" />
<VStack spacing={2}>
{type === "finish" && !isOperationComplete && (
- <Alert variant="warning">
+ <Alert variant="destructive">
<LuAlertTriangle className="h-4 w-4" />
<AlertTitle>Insufficient quantity</AlertTitle>
<AlertDescription>
@@ -1373,7 +1396,7 @@ function QuantityModal({
}
type="submit"
>
- Submit
+ {actionButtonMap[type]}
</Button>
</ModalFooter>
</ValidatedForm>
diff --git a/packages/react/src/Alert.tsx b/packages/react/src/Alert.tsx
index f868827ae2..440f08fa3d 100644
--- a/packages/react/src/Alert.tsx
+++ b/packages/react/src/Alert.tsx
@@ -11,11 +11,10 @@ const alertVariants = cva(
variant: {
default: "bg-background text-foreground",
success:
- "bg-gradient-to-tl via-card to-card hover:to-muted/30 hover:via-muted/30 border-emerald-600/30 from-emerald-600/10 text-emerald-600 [&>svg]:text-emerald-600 dark:text-foreground dark:[&>svg]:text-foreground",
- warning:
- "bg-gradient-to-tl via-card to-card hover:to-muted/30 hover:via-muted/30 border-yellow-500/30 from-yellow-500/10 text-yellow-800 [&>svg]:text-yellow-800 dark:text-foreground dark:[&>svg]:text-foreground",
+ "bg-gradient-to-tr via-card to-card hover:to-muted/30 hover:via-muted/30 border-emerald-600/30 from-emerald-600/10 text-emerald-600 [&>svg]:text-emerald-600 dark:text-foreground dark:[&>svg]:text-foreground",
+ warning: "",
destructive:
- "bg-gradient-to-tl via-card to-card hover:to-muted/30 hover:via-muted/30 border-red-500/30 from-red-500/10 text-destructive [&>svg]:text-destructive dark:text-foreground dark:[&>svg]:text-foreground",
+ "bg-gradient-to-tr via-card to-card hover:to-muted/30 hover:via-muted/30 border-red-500/30 from-red-500/10 text-destructive [&>svg]:text-destructive dark:text-foreground dark:[&>svg]:text-foreground",
},
},
defaultVariants: {
diff --git a/packages/react/src/Progress.tsx b/packages/react/src/Progress.tsx
index 0cf9c25162..c07c7ad7f1 100644
--- a/packages/react/src/Progress.tsx
+++ b/packages/react/src/Progress.tsx
@@ -30,8 +30,7 @@ const Progress = forwardRef<
>
<ProgressPrimitive.Indicator
className={cn(
- "h-full w-full flex-1 transition-all",
- (value || 0) > 100 ? "bg-red-500" : "bg-emerald-500",
+ "h-full w-full flex-1 bg-emerald-500 transition-all",
indicatorClassName
)}
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
diff --git a/packages/react/src/Toast.tsx b/packages/react/src/Toast.tsx
index bb3e8b726d..26a4e79990 100644
--- a/packages/react/src/Toast.tsx
+++ b/packages/react/src/Toast.tsx
@@ -18,9 +18,9 @@ const Toaster = ({ ...props }: ToasterProps) => {
cancelButton:
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
success:
- "group-[.toaster]:bg-emerald-600 group-[.toaster]:text-emerald-100 dark:group-[.toaster]:bg-emerald-900 group-[.toaster]:border-emerald-800 dark:group-[.toaster]:text-emerald-400 group-[.toaster]:text-white",
+ "group-[.toaster]:bg-emerald-600 group-[.toaster]:text-emerald-100 dark:group-[.toaster]:bg-emerald-900 group-[.toaster]:border-emerald-600 dark:group-[.toaster]:text-emerald-400 group-[.toaster]:text-white",
error:
- "group-[.toaster]:bg-red-600 group-[.toaster]:text-red-100 dark:group-[.toaster]:bg-red-900 group-[.toaster]:border-red-800 dark:group-[.toaster]:text-red-400 group-[.toaster]:text-white",
+ "group-[.toaster]:bg-red-600 group-[.toaster]:text-red-100 dark:group-[.toaster]:bg-red-900 group-[.toaster]:border-red-600 dark:group-[.toaster]:text-red-400 group-[.toaster]:text-white",
},
}}
{...props}
diff --git a/packages/react/src/Toggle.tsx b/packages/react/src/Toggle.tsx
index 4fa53fc0a5..35fc5ef100 100644
--- a/packages/react/src/Toggle.tsx
+++ b/packages/react/src/Toggle.tsx
@@ -8,13 +8,13 @@ import { forwardRef } from "react";
import { cn } from "./utils/cn";
const toggleVariants = cva(
- "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
+ "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-primary/60 hover:data-[state=on]:bg-primary hover:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
{
variants: {
variant: {
default: "bg-transparent",
outline:
- "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
+ "border border-input bg-transparent hover:bg-primary/80 hover:text-primary-foreground",
},
size: {
default: "h-10 px-3",