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: optimistic ui for start/stop

Brad Barbinb5991dcdad07
diff --git a/apps/mes/app/components/JobOperation.tsx b/apps/mes/app/components/JobOperation.tsx
index 3559b38754..9d6e09ad63 100644
--- a/apps/mes/app/components/JobOperation.tsx
+++ b/apps/mes/app/components/JobOperation.tsx
@@ -885,7 +885,7 @@ function WorkTypeToggle({
<LuTimer className="h-4 w-4 mr-2 flex-shrink-0" />
Setup
{active.setup && (
- <span className="absolute -top-1 -right-1 h-3 w-3 bg-red-500 rounded-full" />
+ <span className="absolute -top-1 -right-1 h-3 w-3 bg-emerald-500 rounded-full" />
)}
</ToggleGroupItem>
)}
@@ -899,7 +899,7 @@ function WorkTypeToggle({
<LuHardHat className="h-4 w-4 mr-2 flex-shrink-0" />
Labor
{active.labor && (
- <span className="absolute -top-1 -right-1 h-3 w-3 bg-red-500 rounded-full" />
+ <span className="absolute -top-1 -right-1 h-3 w-3 bg-emerald-500 rounded-full" />
)}
</ToggleGroupItem>
)}
@@ -913,7 +913,7 @@ function WorkTypeToggle({
<LuHammer className="h-4 w-4 mr-2 flex-shrink-0" />
Machine
{active.machine && (
- <span className="absolute -top-1 -right-1 h-3 w-3 bg-red-500 rounded-full" />
+ <span className="absolute -top-1 -right-1 h-3 w-3 bg-emerald-500 rounded-full" />
)}
</ToggleGroupItem>
)}
@@ -939,22 +939,25 @@ function StartStopButton({
}) {
const fetcher = useFetcher<ProductionEvent>();
const isActive = useMemo(() => {
+ if (fetcher.formData?.get("action") === "End") {
+ return false;
+ }
if (eventType === "Setup") {
return (
- (fetcher.formData?.get("id") &&
+ (fetcher.formData?.get("action") === "Start" &&
fetcher.formData.get("type") === "Setup") ||
!!setupProductionEvent
);
}
if (eventType === "Labor") {
return (
- (fetcher.formData?.get("id") &&
+ (fetcher.formData?.get("action") === "Start" &&
fetcher.formData.get("type") === "Labor") ||
!!laborProductionEvent
);
}
return (
- (fetcher.formData?.get("id") &&
+ (fetcher.formData?.get("action") === "Start" &&
fetcher.formData.get("type") === "Machine") ||
!!machineProductionEvent
);
@@ -1026,12 +1029,13 @@ function PauseButton({ className, ...props }: ComponentProps<"button">) {
function PlayButton({ className, ...props }: ComponentProps<"button">) {
return (
- <button
+ <ButtonWithTooltip
{...props}
+ tooltip="Start"
className="group w-20 h-20 flex flex-row items-center gap-2 justify-center bg-emerald-500 rounded-full shadow-lg hover:cursor-pointer hover:drop-shadow-xl hover:bg-emerald-600 hover:scale-105 transition-all disabled:opacity-75 text-xl"
>
<FaPlay className="text-accent group-hover:scale-125" />
- </button>
+ </ButtonWithTooltip>
);
}
diff --git a/apps/mes/app/components/Nav.tsx b/apps/mes/app/components/Nav.tsx
index 59a1c734cc..a28bd1706a 100644
--- a/apps/mes/app/components/Nav.tsx
+++ b/apps/mes/app/components/Nav.tsx
@@ -40,7 +40,7 @@ export function Nav({ links, isCollapsed }: NavProps) {
link.label &&
Number.isInteger(parseInt(link.label)) &&
parseInt(link.label) > 0 &&
- "text-red-500"
+ "text-emerald-500"
)}
size="lg"
icon={<link.icon className="h-4 w-4" />}