mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 11:06:29 +00:00
Add project detail UI and unified status badges
Introduce project detail screens and reusable status UI. Adds ProjectDetailComponent, WorkOrderCard, StatusTimeline, AssignedPeople, and a new BadgeStatus component with STATUS_BADGE_MAP and STATUS_LIST in badge.tsx to centralize status styling. Adds IProject type (type.project.ts) and project detail page routing. Update existing client/assignment views to use BadgeStatus, improve UI copy and link behavior (ExternalLink icon), handle nullable end dates in forms, include client_id in payload, and improve empty-state handling and descriptions. Misc: rename assignment page export, tweak form labels/placeholders, and small layout/UX refinements.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { Badge, STATUS_BADGE_MAP } from "@/components/ui/badge"
|
||||
|
||||
export default function BadgeStatus({ status, className }: { status: string, className?: string }) { // e.g. status = "UAT"
|
||||
return (
|
||||
<Badge variant={STATUS_BADGE_MAP[status?.toLowerCase()] || "default"} className={className}>
|
||||
{status?.toLowerCase()
|
||||
.split(' ')
|
||||
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join(' ')}
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
@@ -4,6 +4,12 @@ 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",
|
||||
{
|
||||
@@ -21,6 +27,16 @@ const badgeVariants = cva(
|
||||
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-zinc-50 hover:opacity-80", // Gray
|
||||
statusActive: "border-transparent bg-teal-500 text-zinc-50 hover:opacity-80", // Blue
|
||||
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
|
||||
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
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
@@ -29,6 +45,29 @@ const badgeVariants = cva(
|
||||
}
|
||||
)
|
||||
|
||||
export const STATUS_BADGE_MAP: Record<string, VariantProps<typeof badgeVariants>["variant"]> = {
|
||||
"not started": "statusNotStarted",
|
||||
|
||||
"on progress": "statusActive",
|
||||
"on going": "statusActive",
|
||||
"active": "statusActive",
|
||||
|
||||
"halted": "statusWarning",
|
||||
|
||||
"issue": "statusDanger",
|
||||
"canceled": "statusDanger",
|
||||
|
||||
"sit": "statusTesting",
|
||||
"uat": "statusTesting",
|
||||
"ptr": "statusTesting",
|
||||
|
||||
"bast": "statusSuccess", // Handover/Sign-off
|
||||
|
||||
"warranty": "statusMaintenance",
|
||||
|
||||
"end of support": "statusEnded",
|
||||
}
|
||||
|
||||
function Badge({
|
||||
className,
|
||||
variant,
|
||||
|
||||
Reference in New Issue
Block a user