feat: enhance tickets portal and admin flows
This commit is contained in:
parent
9cdd8763b4
commit
c15f0a5b09
67 changed files with 1101 additions and 338 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { format } from "date-fns"
|
||||
import type { ComponentType } from "react"
|
||||
import type { ComponentType, ReactNode } from "react"
|
||||
import { ptBR } from "date-fns/locale"
|
||||
import {
|
||||
IconClockHour4,
|
||||
|
|
@ -119,9 +119,12 @@ export function TicketTimeline({ ticket }: TicketTimelineProps) {
|
|||
sessionDurationMs?: number
|
||||
categoryName?: string
|
||||
subcategoryName?: string
|
||||
pauseReason?: string
|
||||
pauseReasonLabel?: string
|
||||
pauseNote?: string
|
||||
}
|
||||
|
||||
let message: string | null = null
|
||||
let message: ReactNode = null
|
||||
if (entry.type === "STATUS_CHANGED" && (payload.toLabel || payload.to)) {
|
||||
message = "Status alterado para " + (payload.toLabel || payload.to)
|
||||
}
|
||||
|
|
@ -153,8 +156,22 @@ export function TicketTimeline({ ticket }: TicketTimelineProps) {
|
|||
if (entry.type === "ATTACHMENT_REMOVED" && payload.attachmentName) {
|
||||
message = `Anexo removido: ${payload.attachmentName}`
|
||||
}
|
||||
if (entry.type === "WORK_PAUSED" && typeof payload.sessionDurationMs === "number") {
|
||||
message = `Tempo registrado: ${formatDuration(payload.sessionDurationMs)}`
|
||||
if (entry.type === "WORK_PAUSED") {
|
||||
const parts: string[] = []
|
||||
if (payload.pauseReasonLabel || payload.pauseReason) {
|
||||
parts.push(`Motivo: ${payload.pauseReasonLabel ?? payload.pauseReason}`)
|
||||
}
|
||||
if (typeof payload.sessionDurationMs === "number") {
|
||||
parts.push(`Tempo registrado: ${formatDuration(payload.sessionDurationMs)}`)
|
||||
}
|
||||
message = (
|
||||
<div className="space-y-1">
|
||||
<span>{parts.length > 0 ? parts.join(" • ") : "Atendimento pausado"}</span>
|
||||
{payload.pauseNote ? (
|
||||
<span className="block text-xs text-neutral-500">Observação: {payload.pauseNote}</span>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
if (entry.type === "CATEGORY_CHANGED") {
|
||||
if (payload.categoryName || payload.subcategoryName) {
|
||||
|
|
@ -168,9 +185,7 @@ export function TicketTimeline({ ticket }: TicketTimelineProps) {
|
|||
if (!message) return null
|
||||
|
||||
return (
|
||||
<div className="rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-neutral-600">
|
||||
{message}
|
||||
</div>
|
||||
<div className="rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-neutral-600">{message}</div>
|
||||
)
|
||||
})()}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue