mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 11:06:29 +00:00
390d03204a
Show assignment history on a date-based milestone timeline and refine milestone date positioning. Update activity log submission and description limits, refresh progress editing controls, and adjust the system log badge color.
166 lines
7.5 KiB
TypeScript
166 lines
7.5 KiB
TypeScript
import * as React from "react"
|
|
import { Slot } from "@radix-ui/react-slot"
|
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
export const STATUS_LIST = [
|
|
"Not Started", "On Progress", "On Going", "Halted", "Issue",
|
|
"SIT", "UAT", "PTR", "BAST", "Warranty", "End Of Support",
|
|
"Canceled", "Active"
|
|
] as const;
|
|
|
|
const badgeVariants = cva(
|
|
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default:
|
|
"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
secondary:
|
|
"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
destructive:
|
|
"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
outline:
|
|
"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
his: "border-orange-500 dark:border-orange-500 text-orange-500 dark:text-orange-500 hover:opacity-80",
|
|
warn: "border-transparent bg-yellow-500 text-zinc-50 dark:bg-yellow-500 dark:text-yellow-50 hover:opacity-80",
|
|
info: "border-transparent bg-cyan-500 text-zinc-50 dark:bg-cyan-500 dark:text-cyan-50 hover:opacity-80",
|
|
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-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 text-white bg-rose-400 dark:bg-rose-600 hover:opacity-85", // HIS Orange
|
|
techSIT: "border-transparent text-white bg-orange-400 dark:bg-orange-700 hover:opacity-85", // Blue
|
|
techUAT: "border-transparent text-white bg-yellow-400 dark:bg-yellow-500 hover:opacity-85", // Purple/Violet
|
|
techPTR: "border-transparent text-white bg-emerald-400 dark:bg-emerald-600 hover:opacity-85", // Mint / Aqua (Teal)
|
|
techGoLive: "border-transparent text-white bg-cyan-400 dark:bg-cyan-600 hover:opacity-85", // Green
|
|
techBAST: "border-transparent text-white bg-violet-400 dark:bg-violet-600 hover:opacity-85", // Yellow / Amber (BAST)
|
|
techWarranty: "border-transparent text-white bg-fuchsia-400 dark:bg-fuchsia-600 hover:opacity-85", // Sky Blue
|
|
|
|
// --- ACTIVITY LOG TYPE VARIANTS ---
|
|
logUpdate: "border-transparent bg-sky-500 text-white dark:bg-sky-600 hover:opacity-85",
|
|
logAction: "border-transparent bg-emerald-500 text-white dark:bg-emerald-600 hover:opacity-85",
|
|
logIssue: "border-transparent bg-red-500 text-white dark:bg-red-600 hover:opacity-85",
|
|
logSystem: "border-transparent text-white bg-zinc-400 dark:bg-zinc-600 hover:opacity-85",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
},
|
|
}
|
|
)
|
|
|
|
export const STATUS_BADGE_MAP: Record<string, VariantProps<typeof badgeVariants>["variant"]> = {
|
|
// Master Administration Statuses:
|
|
// 1. Not Started -> Slate Gray
|
|
"not started": "adminNotStarted",
|
|
"not-started": "adminNotStarted",
|
|
|
|
// 2. Active -> Blue
|
|
"active": "adminActive",
|
|
"on progress": "adminActive",
|
|
"on going": "adminActive",
|
|
"in progress": "adminActive",
|
|
|
|
// 3. On Hold -> Amber
|
|
"on hold": "adminOnHold",
|
|
"on-hold": "adminOnHold",
|
|
"hold": "adminOnHold",
|
|
"halted": "adminOnHold",
|
|
|
|
// 4. Cancelled -> Rose / Red
|
|
"cancelled": "adminCancelled",
|
|
"canceled": "adminCancelled",
|
|
"cancel": "adminCancelled",
|
|
"issue": "logIssue",
|
|
|
|
// 5. Completed -> Emerald Green
|
|
"completed": "adminCompleted",
|
|
"complete": "adminCompleted",
|
|
"done": "adminCompleted",
|
|
"success": "adminCompleted",
|
|
|
|
// 6. Activity Log Types
|
|
"update": "logUpdate",
|
|
"action": "logAction",
|
|
"system": "logSystem",
|
|
|
|
// Technical progression stages based on color reference:
|
|
// 1. Development -> Orange
|
|
"development": "techDevelopment",
|
|
"dev": "techDevelopment",
|
|
|
|
// 2. System Integration Testing (SIT) -> Blue
|
|
"sit": "techSIT",
|
|
"(sit)": "techSIT",
|
|
"system integration testing (sit)": "techSIT",
|
|
"system integration testing": "techSIT",
|
|
|
|
// 3. User Acceptance Testing (UAT) -> Purple/Violet
|
|
"uat": "techUAT",
|
|
"(uat)": "techUAT",
|
|
"user acceptance testing (uat)": "techUAT",
|
|
"user acceptance testing": "techUAT",
|
|
|
|
// 4. Production Trial Run (PTR) -> Mint / Aqua Green
|
|
"ptr": "techPTR",
|
|
"(ptr)": "techPTR",
|
|
"production trial run (ptr)": "techPTR",
|
|
"production trial run": "techPTR",
|
|
|
|
// 5. Go-live -> Lime Green
|
|
"go-live": "techGoLive",
|
|
"go live": "techGoLive",
|
|
"golive": "techGoLive",
|
|
|
|
// 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",
|
|
|
|
// 7. Warranty -> Light Sky Blue
|
|
"warranty": "techWarranty",
|
|
|
|
"end of support": "statusEnded",
|
|
}
|
|
|
|
function Badge({
|
|
className,
|
|
variant,
|
|
asChild = false,
|
|
...props
|
|
}: React.ComponentProps<"span"> &
|
|
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
const Comp = asChild ? Slot : "span"
|
|
|
|
return (
|
|
<Comp
|
|
data-slot="badge"
|
|
className={cn(badgeVariants({ variant }), className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { Badge, badgeVariants }
|