Corrige verificacao de machineId para botao de chat

Usa ticket.machine?.id ao inves de ticket.machineId inexistente
para determinar se o botao de chat deve aparecer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-07 02:42:22 -03:00
parent c9c08f8e38
commit 0bd9e993d5

View file

@ -315,9 +315,10 @@ export function TicketSummaryHeader({ ticket }: TicketHeaderProps) {
| undefined
// Live Chat
const ticketMachineId = ticket.machine?.id ?? null
const liveChatSession = useQuery(
api.liveChat.getTicketSession,
convexUserId && ticket.machineId
convexUserId && ticketMachineId
? { ticketId: ticket.id as Id<"tickets">, viewerId: convexUserId as Id<"users"> }
: "skip"
) as {
@ -334,7 +335,7 @@ export function TicketSummaryHeader({ ticket }: TicketHeaderProps) {
const [isStartingChat, setIsStartingChat] = useState(false)
// Verificar se máquina está online (para tickets com machineId)
const hasMachine = Boolean(ticket.machineId)
const hasMachine = Boolean(ticketMachineId)
const machineOnline = liveChatSession?.machineOnline ?? false
const hasActiveSession = Boolean(liveChatSession?.sessionId)
const ticketHasAssignee = Boolean(ticket.assignee)