fix(chat): ajustes de texto, layout e icone do menu
- Mudar texto 'Chat #' para 'Ticket #' no desktop - Passar ticketRef via URL para exibir numero correto - Ajustar tamanho da janela minimizada (240px) - Incluir ticketRef no checkMachineUpdates (Convex) - Ajustar padding dos botoes no chat web - Mudar icone 'Todos os tickets' para ClipboardList 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3c2d1824fb
commit
d20ebf7416
8 changed files with 35 additions and 25 deletions
|
|
@ -38,9 +38,10 @@ function getFileIcon(fileName: string) {
|
|||
|
||||
interface ChatWidgetProps {
|
||||
ticketId: string
|
||||
ticketRef?: number
|
||||
}
|
||||
|
||||
export function ChatWidget({ ticketId }: ChatWidgetProps) {
|
||||
export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
|
||||
const [messages, setMessages] = useState<ChatMessage[]>([])
|
||||
const [inputValue, setInputValue] = useState("")
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
|
|
@ -267,7 +268,7 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) {
|
|||
<div className="pointer-events-auto flex items-center gap-2 rounded-full bg-slate-200 px-4 py-2 text-slate-600 shadow-lg">
|
||||
<MessageCircle className="size-4" />
|
||||
<span className="text-sm font-medium">
|
||||
{ticketInfo ? `Chat #${ticketInfo.ref}` : "Chat"}
|
||||
{ticketRef ? `Ticket #${ticketRef}` : ticketInfo?.ref ? `Ticket #${ticketInfo.ref}` : "Chat"}
|
||||
</span>
|
||||
<span className="size-2 rounded-full bg-slate-400" />
|
||||
<span className="text-xs text-slate-500">Offline</span>
|
||||
|
|
@ -287,7 +288,7 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) {
|
|||
>
|
||||
<MessageCircle className="size-4" />
|
||||
<span className="text-sm font-medium">
|
||||
Chat #{ticketInfo?.ref}
|
||||
Ticket #{ticketRef ?? ticketInfo?.ref}
|
||||
</span>
|
||||
<span className="size-2 rounded-full bg-emerald-400" />
|
||||
<ChevronUp className="size-4" />
|
||||
|
|
@ -321,9 +322,9 @@ export function ChatWidget({ ticketId }: ChatWidgetProps) {
|
|||
Online
|
||||
</span>
|
||||
</div>
|
||||
{ticketInfo && (
|
||||
{(ticketRef || ticketInfo) && (
|
||||
<p className="text-xs text-slate-500">
|
||||
#{ticketInfo.ref} - {ticketInfo.agentName ?? "Suporte"}
|
||||
Ticket #{ticketRef ?? ticketInfo?.ref} - {ticketInfo?.agentName ?? "Suporte"}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ let cached: ClientCache | null = null
|
|||
|
||||
type MachineUpdatePayload = {
|
||||
hasActiveSessions: boolean
|
||||
sessions: Array<{ ticketId: string; unreadCount: number; lastActivityAt: number }>
|
||||
sessions: Array<{ ticketId: string; ticketRef: number; unreadCount: number; lastActivityAt: number }>
|
||||
totalUnread: number
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { ChatWidget } from "./ChatWidget"
|
||||
|
||||
export function ChatApp() {
|
||||
// Obter ticketId da URL
|
||||
// Obter ticketId e ticketRef da URL
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
const ticketId = params.get("ticketId")
|
||||
const ticketRef = params.get("ticketRef")
|
||||
|
||||
if (!ticketId) {
|
||||
return (
|
||||
|
|
@ -13,7 +14,7 @@ export function ChatApp() {
|
|||
)
|
||||
}
|
||||
|
||||
return <ChatWidget ticketId={ticketId} />
|
||||
return <ChatWidget ticketId={ticketId} ticketRef={ticketRef ? Number(ticketRef) : undefined} />
|
||||
}
|
||||
|
||||
export { ChatWidget }
|
||||
|
|
|
|||
|
|
@ -1098,10 +1098,10 @@ const resolvedAppUrl = useMemo(() => {
|
|||
|
||||
// Abre/minimiza chat quando aparecem novas não lidas
|
||||
if (hasSessions && totalUnread > prevUnread) {
|
||||
const ticketId = payload.sessions[0].ticketId
|
||||
invoke("open_chat_window", { ticketId }).catch(console.error)
|
||||
const session = payload.sessions[0]
|
||||
invoke("open_chat_window", { ticketId: session.ticketId, ticketRef: session.ticketRef }).catch(console.error)
|
||||
// Minimiza para não ser intrusivo
|
||||
invoke("set_chat_minimized", { ticketId, minimized: true }).catch(console.error)
|
||||
invoke("set_chat_minimized", { ticketId: session.ticketId, minimized: true }).catch(console.error)
|
||||
}
|
||||
|
||||
prevUnread = totalUnread
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue