Fix lint errors and improve chat UI

Lint fixes:
- Move HIDDEN_EVENT_TYPES constant outside component to fix useMemo dependency
- Add eslint-disable comments for img elements using blob URLs

Chat widget improvements:
- Add view and download buttons with loading and success indicators
- Click image to open in new tab, download button to save file
- Show check icon after successful download

Chat history fixes:
- Fix title to "Histórico de chat" with proper accents
- Change agent icon from Headphones to MessageCircle
- Change agent icon background from primary to gray

🤖 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 03:39:14 -03:00
parent f0882c612f
commit ebeda62cfb
3 changed files with 74 additions and 23 deletions

View file

@ -16,7 +16,6 @@ import {
ChevronDown,
ChevronRight,
User,
Headphones,
Clock,
Download,
FileText,
@ -183,10 +182,10 @@ function ChatSessionCard({ session, isExpanded, onToggle }: { session: ChatSessi
<div
className={cn(
"flex size-7 shrink-0 items-center justify-center rounded-full",
isAgent ? "bg-primary/10 text-primary" : "bg-slate-200 text-slate-600"
isAgent ? "bg-slate-100 text-slate-600" : "bg-slate-200 text-slate-600"
)}
>
{isAgent ? <Headphones className="size-3.5" /> : <User className="size-3.5" />}
{isAgent ? <MessageCircle className="size-3.5" /> : <User className="size-3.5" />}
</div>
<div
className={cn(
@ -277,9 +276,9 @@ export function TicketChatHistory({ ticketId }: ChatHistoryProps) {
<CardHeader className="border-b border-slate-100 bg-slate-50/50 px-4 py-3">
<CardTitle className="flex items-center gap-2 text-base font-semibold text-slate-900">
<MessageCircle className="size-4" />
Historico de Chat
Histórico de chat
<span className="ml-auto text-xs font-normal text-slate-500">
{chatHistory.sessions.length} {chatHistory.sessions.length === 1 ? "sessao" : "sessoes"} - {chatHistory.totalMessages} mensagens
{chatHistory.sessions.length} {chatHistory.sessions.length === 1 ? "sessão" : "sessões"} - {chatHistory.totalMessages} mensagens
</span>
</CardTitle>
</CardHeader>

View file

@ -58,6 +58,9 @@ const timelineIcons: Record<string, ComponentType<{ className?: string }>> = {
const timelineLabels: Record<string, string> = TICKET_TIMELINE_LABELS
// Tipos de eventos que não devem aparecer na timeline
const HIDDEN_EVENT_TYPES = ["CHAT_MESSAGE_ADDED"]
interface TicketTimelineProps {
ticket: TicketWithDetails
}
@ -82,9 +85,6 @@ export function TicketTimeline({ ticket }: TicketTimelineProps) {
const [page, setPage] = useState(1)
// Tipos de eventos que não devem aparecer na timeline
const HIDDEN_EVENT_TYPES = ["CHAT_MESSAGE_ADDED"]
const sortedTimeline = useMemo(
() => [...ticket.timeline]
.filter((event) => !HIDDEN_EVENT_TYPES.includes(event.type))