37 lines
1.7 KiB
TypeScript
37 lines
1.7 KiB
TypeScript
import { cn } from "@/lib/utils"
|
|||
|
|
|
||
|
|
type MaintenanceStatus = "open" | "in_progress" | "resolved" | "closed"
|
||
|
|
type Priority = "low" | "medium" | "high" | "emergency"
|
||
|
|
|
||
|
|
const statusConfig: Record<MaintenanceStatus, { label: string; className: string }> = {
|
||
|
|
open: { label: "Open", className: "text-amber-400 bg-amber-500/10 border-amber-500/20" },
|
||
|
|
in_progress: { label: "In Progress", className: "text-blue-400 bg-blue-500/10 border-blue-500/20" },
|
||
|
|
resolved: { label: "Resolved", className: "text-emerald-400 bg-emerald-500/10 border-emerald-500/20" },
|
||
|
|
closed: { label: "Closed", className: "text-white/40 bg-white/5 border-white/10" },
|
||
|
|
}
|
||
|
|
|
||
|
|
const priorityConfig: Record<Priority, { label: string; className: string }> = {
|
||
|
|
low: { label: "Low", className: "text-white/40 bg-white/5 border-white/10" },
|
||
|
|
medium: { label: "Medium", className: "text-amber-400 bg-amber-500/10 border-amber-500/20" },
|
||
|
|
high: { label: "High", className: "text-orange-400 bg-orange-500/10 border-orange-500/20" },
|
||
|
|
emergency: { label: "Emergency", className: "text-red-400 bg-red-500/10 border-red-500/20" },
|
||
|
|
}
|
||
|
|
|
||
|
|
export function MaintenanceStatusBadge({ status }: { status: MaintenanceStatus }) {
|
||
|
|
const { label, className } = statusConfig[status] ?? statusConfig.open
|
||
|
|
return (
|
||
|
|
<span className={cn("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium", className)}>
|
||
|
|
{label}
|
||
|
|
</span>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|
||
|
|
export function PriorityBadge({ priority }: { priority: Priority }) {
|
||
|
|
const { label, className } = priorityConfig[priority] ?? priorityConfig.medium
|
||
|
|
return (
|
||
|
|
<span className={cn("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium", className)}>
|
||
|
|
{label}
|
||
|
|
</span>
|
||
|
|
)
|
||
|
|
}
|