mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:56:28 +00:00
Add admin status updates and modal polish
Adds a dedicated administration-status workflow across client, assignment, and project views, including a new UpdateAdministrationStatus modal and action entries in assignment menus. It also improves modal layout consistency, prioritizes project-assignment status badges in list/grid views, and expands badge variants for administration and technical lifecycle states.
This commit is contained in:
@@ -40,6 +40,17 @@ export function formatStatusText(status?: any): string {
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
function getAdministrationBadgeVariant(rawText: string) {
|
||||
const key = rawText.toLowerCase().trim();
|
||||
if (key.includes("not started") || key.includes("not-started")) return "adminNotStarted";
|
||||
if (key === "active" || key.includes("on progress") || key.includes("on going") || key.includes("in progress")) return "adminActive";
|
||||
if (key.includes("on hold") || key.includes("hold") || key.includes("halted")) return "adminOnHold";
|
||||
if (key.includes("cancel")) return "adminCancelled";
|
||||
if (key.includes("complete") || key.includes("done")) return "adminCompleted";
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getTechnicalBadgeVariant(rawText: string) {
|
||||
const key = rawText.toLowerCase().trim();
|
||||
if (STATUS_BADGE_MAP[key]) return STATUS_BADGE_MAP[key];
|
||||
@@ -61,7 +72,11 @@ export default function BadgeStatus({ status, className }: { status: any, classN
|
||||
if (!formatted) return null;
|
||||
|
||||
const lookupKey = raw.toLowerCase().trim();
|
||||
const variant = getTechnicalBadgeVariant(raw) || STATUS_BADGE_MAP[lookupKey] || "default";
|
||||
const variant =
|
||||
STATUS_BADGE_MAP[lookupKey] ||
|
||||
getAdministrationBadgeVariant(raw) ||
|
||||
getTechnicalBadgeVariant(raw) ||
|
||||
"default";
|
||||
|
||||
return (
|
||||
<Badge
|
||||
|
||||
+42
-17
@@ -29,21 +29,28 @@ const badgeVariants = cva(
|
||||
violet: "border-transparent bg-violet-500 text-zinc-50 dark:bg-violet-500 dark:text-violet-50 hover:opacity-80",
|
||||
|
||||
// --- 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", // 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
|
||||
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", // Blue
|
||||
statusEnded: "border-transparent bg-stone-500 text-zinc-50 hover:opacity-80", // Dark Gray
|
||||
statusNotStarted: "border-transparent bg-slate-500 text-white dark:bg-slate-600 hover:opacity-85", // Slate Gray
|
||||
statusActive: "border-transparent bg-teal-500 text-white dark:bg-teal-600 hover:opacity-85", // Sky Blue
|
||||
statusWarning: "border-transparent bg-amber-500 text-white dark:bg-amber-600 hover:opacity-85", // Yellow/Orange
|
||||
statusDanger: "border-transparent bg-rose-500 text-white dark:bg-rose-600 hover:opacity-85", // Red
|
||||
statusTesting: "border-transparent bg-indigo-500 text-white dark:bg-indigo-600 hover:opacity-85", // Indigo
|
||||
statusSuccess: "border-transparent bg-emerald-500 text-white dark:bg-emerald-600 hover:opacity-85", // Green
|
||||
statusMaintenance: "border-transparent bg-violet-500 text-white dark:bg-violet-600 hover:opacity-85", // Violet
|
||||
statusEnded: "border-transparent bg-stone-500 text-white dark:bg-stone-600 hover:opacity-85", // Dark Gray
|
||||
|
||||
// --- ADMINISTRATION MASTER STATUS VARIANTS ---
|
||||
adminNotStarted: "border-transparent bg-slate-500 text-white dark:bg-slate-600 hover:opacity-85", // Slate Gray
|
||||
adminActive: "border-transparent bg-teal-500 text-white dark:bg-teal-600 hover:opacity-85", // Sky Blue
|
||||
adminOnHold: "border-transparent bg-amber-500 text-white dark:bg-amber-600 hover:opacity-85", // Amber / Orange
|
||||
adminCancelled: "border-transparent bg-rose-500 text-white dark:bg-rose-600 hover:opacity-85", // Rose / Red
|
||||
adminCompleted: "border-transparent bg-sky-500 text-white dark:bg-sky-600 hover:opacity-85", // Emerald Green
|
||||
|
||||
// --- TECHNICAL PROGRESSION STATUS VARIANTS ---
|
||||
techDevelopment: "border-transparent bg-orange-500 text-white dark:bg-orange-600 hover:opacity-85", // Orange
|
||||
techDevelopment: "border-transparent bg-his text-white dark:bg-his hover:opacity-85", // HIS 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
|
||||
techGoLive: "border-transparent bg-green-500 text-white dark:bg-green-700 hover:opacity-85", // 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
|
||||
},
|
||||
@@ -55,16 +62,34 @@ const badgeVariants = cva(
|
||||
)
|
||||
|
||||
export const STATUS_BADGE_MAP: Record<string, VariantProps<typeof badgeVariants>["variant"]> = {
|
||||
"not started": "statusNotStarted",
|
||||
// Master Administration Statuses:
|
||||
// 1. Not Started -> Slate Gray
|
||||
"not started": "adminNotStarted",
|
||||
"not-started": "adminNotStarted",
|
||||
|
||||
"on progress": "statusActive",
|
||||
"on going": "statusActive",
|
||||
"active": "statusActive",
|
||||
// 2. Active -> Blue
|
||||
"active": "adminActive",
|
||||
"on progress": "adminActive",
|
||||
"on going": "adminActive",
|
||||
"in progress": "adminActive",
|
||||
|
||||
"halted": "statusWarning",
|
||||
// 3. On Hold -> Amber
|
||||
"on hold": "adminOnHold",
|
||||
"on-hold": "adminOnHold",
|
||||
"hold": "adminOnHold",
|
||||
"halted": "adminOnHold",
|
||||
|
||||
"issue": "statusDanger",
|
||||
"canceled": "statusDanger",
|
||||
// 4. Cancelled -> Rose / Red
|
||||
"cancelled": "adminCancelled",
|
||||
"canceled": "adminCancelled",
|
||||
"cancel": "adminCancelled",
|
||||
"issue": "adminCancelled",
|
||||
|
||||
// 5. Completed -> Emerald Green
|
||||
"completed": "adminCompleted",
|
||||
"complete": "adminCompleted",
|
||||
"done": "adminCompleted",
|
||||
"success": "adminCompleted",
|
||||
|
||||
// Technical progression stages based on color reference:
|
||||
// 1. Development -> Orange
|
||||
|
||||
Reference in New Issue
Block a user