Add technical badges and delete confirmation

This update adds dedicated badge variants for technical progression states (Development, SIT, UAT, PTR, Go-live, BAST, Warranty) and improves status text matching for those stages. It also adds a confirmation dialog when deleting a schedule interval, including cleanup for the final remaining interval so the status description is cleared when appropriate and users are told when notes are being removed.
This commit is contained in:
Ichsan Kurniawan
2026-10-12 10:51:08 +07:00
parent f07990a3fb
commit 8b82372100
4 changed files with 175 additions and 35 deletions
+17 -1
View File
@@ -40,16 +40,32 @@ export function formatStatusText(status?: any): string {
.join(" ");
}
function getTechnicalBadgeVariant(rawText: string) {
const key = rawText.toLowerCase().trim();
if (STATUS_BADGE_MAP[key]) return STATUS_BADGE_MAP[key];
if (key.includes("development") || key === "dev") return "techDevelopment";
if (key.includes("sit") || key.includes("system integration")) return "techSIT";
if (key.includes("uat") || key.includes("user acceptance")) return "techUAT";
if (key.includes("ptr") || key.includes("production trial")) return "techPTR";
if (key.includes("go-live") || key.includes("go live") || key.includes("golive")) return "techGoLive";
if (key.includes("bast") || key.includes("handover")) return "techBAST";
if (key.includes("warranty")) return "techWarranty";
return undefined;
}
export default function BadgeStatus({ status, className }: { status: any, className?: string }) { // e.g. status = "UAT"
const raw = extractStatusString(status);
const formatted = formatStatusText(raw);
if (!formatted) return null;
const lookupKey = raw.toLowerCase().trim();
const variant = getTechnicalBadgeVariant(raw) || STATUS_BADGE_MAP[lookupKey] || "default";
return (
<Badge
variant={STATUS_BADGE_MAP[lookupKey] || "default"}
variant={variant}
className={cn("text-[10px] font-semibold tracking-wide px-2 py-0.5", className)}
>
{formatted}
+45 -22
View File
@@ -30,13 +30,22 @@ const badgeVariants = cva(
// --- CUSTOM STATUS VARIANTS ---
statusNotStarted: "border-transparent bg-slate-500 text-zinc-50 hover:opacity-80", // Gray
statusActive: "border-transparent bg-teal-500 text-zinc-50 hover:opacity-80", // Blue
statusActive: "border-transparent bg-teal-500 text-zinc-50 hover:opacity-80", // Teal
statusWarning: "border-transparent bg-amber-500 text-zinc-50 hover:opacity-80", // Yellow/Orange
statusDanger: "border-transparent bg-red-500 text-zinc-50 hover:opacity-80", // Red
statusTesting: "border-transparent bg-indigo-500 text-zinc-50 hover:opacity-80", // Indigo/Purple
statusTesting: "border-transparent bg-indigo-500 text-zinc-50 hover:opacity-80", // Indigo
statusSuccess: "border-transparent bg-emerald-500 text-zinc-50 hover:opacity-80", // Green
statusMaintenance: "border-transparent bg-blue-500 text-zinc-50 hover:opacity-80", // Teal
statusEnded: "border-transparent bg-stone-500 text-zinc-50 hover:opacity-80", // Dark Gray/Brown
statusMaintenance: "border-transparent bg-blue-500 text-zinc-50 hover:opacity-80", // Blue
statusEnded: "border-transparent bg-stone-500 text-zinc-50 hover:opacity-80", // Dark Gray
// --- TECHNICAL PROGRESSION STATUS VARIANTS ---
techDevelopment: "border-transparent bg-orange-500 text-white dark:bg-orange-600 hover:opacity-85", // Orange
techSIT: "border-transparent bg-blue-500 text-white dark:bg-blue-600 hover:opacity-85", // Blue
techUAT: "border-transparent bg-purple-500 text-white dark:bg-purple-600 hover:opacity-85", // Purple/Violet
techPTR: "border-transparent bg-teal-500 text-white dark:bg-teal-600 hover:opacity-85", // Mint / Aqua (Teal)
techGoLive: "border-transparent bg-lime-600 text-white dark:bg-lime-700 hover:opacity-85", // Lime Green
techBAST: "border-transparent bg-yellow-500 text-white dark:bg-yellow-600 hover:opacity-85", // Yellow / Amber (BAST)
techWarranty: "border-transparent bg-sky-500 text-white dark:bg-sky-600 hover:opacity-85", // Sky Blue
},
},
defaultVariants: {
@@ -57,30 +66,44 @@ export const STATUS_BADGE_MAP: Record<string, VariantProps<typeof badgeVariants>
"issue": "statusDanger",
"canceled": "statusDanger",
// Technical progression stages
"development": "info",
// Technical progression stages based on color reference:
// 1. Development -> Orange
"development": "techDevelopment",
"dev": "techDevelopment",
"sit": "statusTesting",
"system integration testing (sit)": "statusTesting",
"system integration testing": "statusTesting",
// 2. System Integration Testing (SIT) -> Blue
"sit": "techSIT",
"(sit)": "techSIT",
"system integration testing (sit)": "techSIT",
"system integration testing": "techSIT",
"uat": "violet",
"user acceptance testing (uat)": "violet",
"user acceptance testing": "violet",
// 3. User Acceptance Testing (UAT) -> Purple/Violet
"uat": "techUAT",
"(uat)": "techUAT",
"user acceptance testing (uat)": "techUAT",
"user acceptance testing": "techUAT",
"ptr": "statusWarning",
"production trial run (ptr)": "statusWarning",
"production trial run": "statusWarning",
// 4. Production Trial Run (PTR) -> Mint / Aqua Green
"ptr": "techPTR",
"(ptr)": "techPTR",
"production trial run (ptr)": "techPTR",
"production trial run": "techPTR",
"go-live": "statusSuccess",
"go live": "statusSuccess",
"golive": "statusSuccess",
// 5. Go-live -> Lime Green
"go-live": "techGoLive",
"go live": "techGoLive",
"golive": "techGoLive",
"bast": "statusActive",
"project handover & bast": "statusActive",
"project handover and bast": "statusActive",
// 6. Project Handover & BAST -> Yellow
"bast": "techBAST",
"(bast)": "techBAST",
"project handover & bast": "techBAST",
"project handover and bast": "techBAST",
"project handover & bast (bast)": "techBAST",
"project handover": "techBAST",
"warranty": "statusMaintenance",
// 7. Warranty -> Light Sky Blue
"warranty": "techWarranty",
"end of support": "statusEnded",
}