fix: corrige cliques nao responsivos e erros silenciosos
- Remove coluna de acoes sem implementacao em data-table - Corrige loading states travados em new-ticket-dialog, close-ticket-dialog - Adiciona finally blocks em forgot-password e reset-password - Adiciona tratamento de erros em invokes do Tauri (ChatWidget, ChatHubWidget) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a285e6f252
commit
7a3791117b
7 changed files with 51 additions and 63 deletions
|
|
@ -61,22 +61,30 @@ export function ChatHubWidget() {
|
||||||
// Quando nova sessao inicia
|
// Quando nova sessao inicia
|
||||||
listen<SessionStartedEvent>("raven://chat/session-started", () => {
|
listen<SessionStartedEvent>("raven://chat/session-started", () => {
|
||||||
loadSessions()
|
loadSessions()
|
||||||
}).then((unlisten) => unlisteners.push(unlisten))
|
}).then((unlisten) => unlisteners.push(unlisten)).catch((err) => {
|
||||||
|
console.error("Erro ao registrar listener session-started:", err)
|
||||||
|
})
|
||||||
|
|
||||||
// Quando sessao encerra
|
// Quando sessao encerra
|
||||||
listen<SessionEndedEvent>("raven://chat/session-ended", () => {
|
listen<SessionEndedEvent>("raven://chat/session-ended", () => {
|
||||||
loadSessions()
|
loadSessions()
|
||||||
}).then((unlisten) => unlisteners.push(unlisten))
|
}).then((unlisten) => unlisteners.push(unlisten)).catch((err) => {
|
||||||
|
console.error("Erro ao registrar listener session-ended:", err)
|
||||||
|
})
|
||||||
|
|
||||||
// Quando contador de nao lidos muda
|
// Quando contador de nao lidos muda
|
||||||
listen<UnreadUpdateEvent>("raven://chat/unread-update", (event) => {
|
listen<UnreadUpdateEvent>("raven://chat/unread-update", (event) => {
|
||||||
setSessions(event.payload.sessions || [])
|
setSessions(event.payload.sessions || [])
|
||||||
}).then((unlisten) => unlisteners.push(unlisten))
|
}).then((unlisten) => unlisteners.push(unlisten)).catch((err) => {
|
||||||
|
console.error("Erro ao registrar listener unread-update:", err)
|
||||||
|
})
|
||||||
|
|
||||||
// Quando nova mensagem chega
|
// Quando nova mensagem chega
|
||||||
listen<NewMessageEvent>("raven://chat/new-message", (event) => {
|
listen<NewMessageEvent>("raven://chat/new-message", (event) => {
|
||||||
setSessions(event.payload.sessions || [])
|
setSessions(event.payload.sessions || [])
|
||||||
}).then((unlisten) => unlisteners.push(unlisten))
|
}).then((unlisten) => unlisteners.push(unlisten)).catch((err) => {
|
||||||
|
console.error("Erro ao registrar listener new-message:", err)
|
||||||
|
})
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
unlisteners.forEach((unlisten) => unlisten())
|
unlisteners.forEach((unlisten) => unlisten())
|
||||||
|
|
@ -129,7 +137,9 @@ export function ChatHubWidget() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
invoke("close_hub_window")
|
invoke("close_hub_window").catch((err) => {
|
||||||
|
console.error("Erro ao fechar janela do hub:", err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalUnread = sessions.reduce((sum, s) => sum + s.unreadCount, 0)
|
const totalUnread = sessions.reduce((sum, s) => sum + s.unreadCount, 0)
|
||||||
|
|
|
||||||
|
|
@ -714,7 +714,9 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
invoke("close_chat_window", { ticket_id: ticketId })
|
invoke("close_chat_window", { ticket_id: ticketId }).catch((err) => {
|
||||||
|
console.error("Erro ao fechar janela de chat:", err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ export function ForgotPasswordPageClient() {
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
toast.error(data.error ?? "Erro ao processar solicitação")
|
toast.error(data.error ?? "Erro ao processar solicitação")
|
||||||
setIsSubmitting(false)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,6 +55,7 @@ export function ForgotPasswordPageClient() {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Erro ao solicitar recuperação", error)
|
console.error("Erro ao solicitar recuperação", error)
|
||||||
toast.error("Não foi possível processar. Tente novamente")
|
toast.error("Não foi possível processar. Tente novamente")
|
||||||
|
} finally {
|
||||||
setIsSubmitting(false)
|
setIsSubmitting(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ export function ResetPasswordPageClient() {
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
toast.error(data.error ?? "Erro ao redefinir senha")
|
toast.error(data.error ?? "Erro ao redefinir senha")
|
||||||
setIsSubmitting(false)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,6 +88,7 @@ export function ResetPasswordPageClient() {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Erro ao redefinir senha", error)
|
console.error("Erro ao redefinir senha", error)
|
||||||
toast.error("Não foi possível redefinir a senha. Tente novamente")
|
toast.error("Não foi possível redefinir a senha. Tente novamente")
|
||||||
|
} finally {
|
||||||
setIsSubmitting(false)
|
setIsSubmitting(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,30 +282,7 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// Actions column removed - no functionality implemented
|
||||||
id: "actions",
|
|
||||||
cell: () => (
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger asChild>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
className="data-[state=open]:bg-muted text-muted-foreground flex size-8"
|
|
||||||
size="icon"
|
|
||||||
>
|
|
||||||
<IconDotsVertical />
|
|
||||||
<span className="sr-only">Open menu</span>
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end" className="w-32">
|
|
||||||
<DropdownMenuItem>Edit</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem>Make a copy</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem>Favorite</DropdownMenuItem>
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
<DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
function DraggableRow({ row }: { row: Row<z.infer<typeof schema>> }) {
|
function DraggableRow({ row }: { row: Row<z.infer<typeof schema>> }) {
|
||||||
|
|
|
||||||
|
|
@ -630,14 +630,12 @@ export function CloseTicketDialog({
|
||||||
if (linkedReference.trim().length > 0) {
|
if (linkedReference.trim().length > 0) {
|
||||||
if (isLinkLoading) {
|
if (isLinkLoading) {
|
||||||
toast.error("Aguarde carregar o ticket vinculado antes de encerrar.", { id: "close-ticket" })
|
toast.error("Aguarde carregar o ticket vinculado antes de encerrar.", { id: "close-ticket" })
|
||||||
setIsSubmitting(false)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (linkNotFound || !linkedTicketCandidate) {
|
if (linkNotFound || !linkedTicketCandidate) {
|
||||||
toast.error("Não encontramos o ticket informado para vincular. Verifique o número e tente novamente.", {
|
toast.error("Não encontramos o ticket informado para vincular. Verifique o número e tente novamente.", {
|
||||||
id: "close-ticket",
|
id: "close-ticket",
|
||||||
})
|
})
|
||||||
setIsSubmitting(false)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -612,6 +612,7 @@ export function NewTicketDialog({
|
||||||
const plainDescription = sanitizedDescription.replace(/<[^>]*>/g, "").trim()
|
const plainDescription = sanitizedDescription.replace(/<[^>]*>/g, "").trim()
|
||||||
if (plainDescription.length === 0) {
|
if (plainDescription.length === 0) {
|
||||||
form.setError("description", { type: "custom", message: "Descreva o contexto do chamado." })
|
form.setError("description", { type: "custom", message: "Descreva o contexto do chamado." })
|
||||||
|
setLoading(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue