Reorganiza gestão de usuários e remove dados mock

This commit is contained in:
Esdras Renan 2025-10-18 01:15:15 -03:00
parent 630110bf3a
commit dded6d1927
20 changed files with 1863 additions and 1368 deletions

View file

@ -514,9 +514,9 @@ export function TicketComments({ ticket }: TicketCommentsProps) {
</Dialog>
<Dialog open={!!preview} onOpenChange={(open) => !open && setPreview(null)}>
<DialogContent className="max-w-3xl border border-slate-200 p-0">
<DialogHeader className="flex items-center justify-between gap-3 px-4 py-3">
<DialogTitle className="text-base font-semibold text-neutral-800">Visualização do anexo</DialogTitle>
<DialogClose className="inline-flex size-7 items-center justify-center rounded-full border border-slate-200 bg-white text-neutral-600 transition hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400/30">
<DialogHeader className="relative px-4 py-3">
<DialogTitle className="pr-10 text-base font-semibold text-neutral-800">Visualização do anexo</DialogTitle>
<DialogClose className="absolute right-4 top-3 inline-flex size-7 items-center justify-center rounded-full border border-slate-200 bg-white text-neutral-600 transition hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400/30">
<X className="size-4" />
</DialogClose>
</DialogHeader>
@ -614,13 +614,22 @@ function CommentAttachmentCard({
const target = url ?? (await ensureUrl())
if (!target) return
try {
const response = await fetch(target, { credentials: "include" })
if (!response.ok) {
throw new Error(`Unexpected status ${response.status}`)
}
const blob = await response.blob()
const blobUrl = window.URL.createObjectURL(blob)
const link = document.createElement("a")
link.href = target
link.href = blobUrl
link.download = attachment.name ?? "anexo"
link.rel = "noopener noreferrer"
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.setTimeout(() => {
window.URL.revokeObjectURL(blobUrl)
}, 1000)
} catch (error) {
console.error("Failed to download attachment", error)
window.open(target, "_blank", "noopener,noreferrer")