Add SLA tone to queue cards
This commit is contained in:
parent
7401ee366d
commit
54343f61d5
1 changed files with 16 additions and 2 deletions
|
|
@ -14,6 +14,19 @@ interface TicketQueueSummaryProps {
|
|||
layout?: "default" | "compact"
|
||||
}
|
||||
|
||||
function resolveSlaTone(percent: number) {
|
||||
if (percent < 25) {
|
||||
return { indicator: "bg-[#00e8ff]", text: "text-sky-600" }
|
||||
}
|
||||
if (percent < 50) {
|
||||
return { indicator: "bg-emerald-400", text: "text-emerald-600" }
|
||||
}
|
||||
if (percent < 75) {
|
||||
return { indicator: "bg-amber-400", text: "text-amber-600" }
|
||||
}
|
||||
return { indicator: "bg-rose-500", text: "text-rose-600" }
|
||||
}
|
||||
|
||||
export function TicketQueueSummaryCards({ queues, layout = "default" }: TicketQueueSummaryProps) {
|
||||
const { convexUserId, isStaff } = useAuth()
|
||||
const enabled = Boolean(isStaff && convexUserId)
|
||||
|
|
@ -52,6 +65,7 @@ export function TicketQueueSummaryCards({ queues, layout = "default" }: TicketQu
|
|||
{data.map((queue, index) => {
|
||||
const totalOpen = queue.pending + queue.inProgress + queue.paused
|
||||
const breachPercent = totalOpen === 0 ? 0 : Math.round((queue.breached / totalOpen) * 100)
|
||||
const slaTone = resolveSlaTone(breachPercent)
|
||||
return (
|
||||
<Card
|
||||
key={queue.id ?? `${queue.name ?? "queue"}-${index}`}
|
||||
|
|
@ -92,8 +106,8 @@ export function TicketQueueSummaryCards({ queues, layout = "default" }: TicketQu
|
|||
</div>
|
||||
</div>
|
||||
<div className="pt-1">
|
||||
<Progress value={breachPercent} className="h-1.5 bg-slate-100" indicatorClassName="bg-[#00e8ff]" />
|
||||
<span className="mt-2 block text-xs text-neutral-500">
|
||||
<Progress value={breachPercent} className="h-1.5 bg-slate-100" indicatorClassName={slaTone.indicator} />
|
||||
<span className={`mt-2 block text-xs font-medium ${slaTone.text}`}>
|
||||
{breachPercent}% dos chamados da fila estão fora do SLA
|
||||
</span>
|
||||
<span className="mt-1 block text-xs text-neutral-400">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue