refactor: Simplify getStepIndex and getStatusCategory logic for clarity
This commit is contained in:
parent
dd8259e06f
commit
f3b41ca6f4
@ -53,7 +53,7 @@ function getStepIndex(state: OrderStatusState, serviceCategory: OrderServiceCate
|
||||
case "active":
|
||||
return steps.length - 1; // Always the last step
|
||||
case "review":
|
||||
return serviceCategory === "internet" ? 1 : 1; // "Under Review" for internet
|
||||
return 1; // "Under Review" step is always index 1
|
||||
case "scheduled":
|
||||
return serviceCategory === "internet" ? 2 : 1;
|
||||
case "activating":
|
||||
@ -122,9 +122,9 @@ export function OrderProgressTimeline({
|
||||
{!isLast && (
|
||||
<div
|
||||
className={cn(
|
||||
"absolute top-4 left-1/2 w-full h-0.5 -translate-y-1/2",
|
||||
index < currentStepIndex && "bg-success",
|
||||
index === currentStepIndex && "bg-gradient-to-r from-primary to-muted",
|
||||
"absolute top-4 w-full -translate-y-1/2",
|
||||
index < currentStepIndex && "h-0.5 bg-success",
|
||||
index === currentStepIndex && "h-0.5 bg-gradient-to-r from-primary to-muted",
|
||||
index > currentStepIndex &&
|
||||
"border-t-2 border-dashed border-muted-foreground/30"
|
||||
)}
|
||||
|
||||
@ -60,15 +60,9 @@ function getStatusCategory(
|
||||
return "cancelled";
|
||||
}
|
||||
|
||||
// Processing: Everything else in progress
|
||||
if (
|
||||
activationStatus === "Scheduled" ||
|
||||
activationStatus === "Activating" ||
|
||||
status === "Activated"
|
||||
) {
|
||||
return "processing";
|
||||
}
|
||||
|
||||
// Processing: Scheduled, Activating, or any other in-progress state
|
||||
// Note: status === "Activated" without activationStatus === "Activated" means
|
||||
// the order is approved but service activation isn't complete yet
|
||||
return "processing";
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user