24 lines
1.1 KiB
TypeScript
24 lines
1.1 KiB
TypeScript
"use client"
|
|
|
|
import { ticketStatusSchema, type TicketStatus } from "@/lib/schemas/ticket"
|
|
import { Badge } from "@/components/ui/badge"
|
|
import { cn } from "@/lib/utils"
|
|
|
|
const statusStyles: Record<TicketStatus, { label: string; className: string }> = {
|
|
PENDING: { label: "Pendente", className: "border border-slate-200 bg-slate-100 text-slate-700" },
|
|
AWAITING_ATTENDANCE: { label: "Aguardando atendimento", className: "border border-slate-200 bg-[#dff1fb] text-[#0a4760]" },
|
|
PAUSED: { label: "Pausado", className: "border border-slate-200 bg-[#ede8ff] text-[#4f2f96]" },
|
|
RESOLVED: { label: "Resolvido", className: "border border-slate-200 bg-[#dcf4eb] text-[#1f6a45]" },
|
|
}
|
|
|
|
type TicketStatusBadgeProps = { status: TicketStatus }
|
|
|
|
export function TicketStatusBadge({ status }: TicketStatusBadgeProps) {
|
|
const parsed = ticketStatusSchema.parse(status)
|
|
const styles = statusStyles[parsed]
|
|
return (
|
|
<Badge className={cn('inline-flex items-center rounded-full px-3 py-0.5 text-xs font-semibold', styles?.className)}>
|
|
{styles?.label ?? parsed}
|
|
</Badge>
|
|
)
|
|
}
|