Atualiza portal e admin com bloqueio de máquinas desativadas

This commit is contained in:
Esdras Renan 2025-10-18 00:02:15 -03:00
parent e5085962e9
commit 630110bf3a
31 changed files with 1756 additions and 244 deletions

View file

@ -41,6 +41,10 @@ export function TicketComments({ ticket }: TicketCommentsProps) {
const updateComment = useMutation(api.tickets.updateComment)
const [body, setBody] = useState("")
const [attachmentsToSend, setAttachmentsToSend] = useState<Array<{ storageId: string; name: string; size?: number; type?: string; previewUrl?: string }>>([])
const attachmentsToSendTotalBytes = useMemo(
() => attachmentsToSend.reduce((acc, item) => acc + (item.size ?? 0), 0),
[attachmentsToSend]
)
const [preview, setPreview] = useState<string | null>(null)
const [pending, setPending] = useState<Pick<TicketWithDetails["comments"][number], "id" | "author" | "visibility" | "body" | "attachments" | "createdAt" | "updatedAt">[]>([])
const [visibility, setVisibility] = useState<"PUBLIC" | "INTERNAL">("INTERNAL")
@ -358,7 +362,11 @@ export function TicketComments({ ticket }: TicketCommentsProps) {
)}
<form onSubmit={handleSubmit} className="mt-4 space-y-3">
<RichTextEditor value={body} onChange={setBody} placeholder="Escreva um comentário..." />
<Dropzone onUploaded={(files) => setAttachmentsToSend((prev) => [...prev, ...files])} />
<Dropzone
onUploaded={(files) => setAttachmentsToSend((prev) => [...prev, ...files])}
currentFileCount={attachmentsToSend.length}
currentTotalBytes={attachmentsToSendTotalBytes}
/>
{attachmentsToSend.length > 0 ? (
<div className="grid max-w-xl grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-3">
{attachmentsToSend.map((attachment, index) => {