chore: prep platform improvements

This commit is contained in:
Esdras Renan 2025-11-09 21:09:38 -03:00
parent a62f3d5283
commit c5ddd54a3e
24 changed files with 777 additions and 649 deletions

View file

@ -249,16 +249,6 @@ export function CloseTicketDialog({
}
}, [])
useEffect(() => {
if (!open) return
if (templates.length > 0 && !selectedTemplateId && !message) {
const first = templates[0]
const hydrated = hydrateTemplateBody(first.body)
setSelectedTemplateId(first.id)
setMessage(hydrated)
}
}, [open, templates, selectedTemplateId, message, hydrateTemplateBody])
useEffect(() => {
if (!open || !enableAdjustment || !shouldAdjustTime) return
const internal = splitDuration(workSummary?.internalWorkedMs ?? 0)

View file

@ -184,9 +184,17 @@ export function NewTicketDialog({ triggerClassName }: { triggerClassName?: strin
})
}, [convexUserId, ensureTicketFormDefaultsMutation])
const companyValue = form.watch("companyId") ?? NO_COMPANY_VALUE
const formsRemote = useQuery(
api.tickets.listTicketForms,
convexUserId ? { tenantId: DEFAULT_TENANT_ID, viewerId: convexUserId as Id<"users"> } : "skip"
convexUserId
? {
tenantId: DEFAULT_TENANT_ID,
viewerId: convexUserId as Id<"users">,
companyId: companyValue !== NO_COMPANY_VALUE ? (companyValue as Id<"companies">) : undefined,
}
: "skip"
) as TicketFormDefinition[] | undefined
const forms = useMemo<TicketFormDefinition[]>(() => {
@ -256,7 +264,6 @@ export function NewTicketDialog({ triggerClassName }: { triggerClassName?: strin
const queueValue = form.watch("queueName") ?? "NONE"
const assigneeValue = form.watch("assigneeId") ?? null
const assigneeSelectValue = assigneeValue ?? "NONE"
const companyValue = form.watch("companyId") ?? NO_COMPANY_VALUE
const requesterValue = form.watch("requesterId") ?? ""
const categoryIdValue = form.watch("categoryId")
const subcategoryIdValue = form.watch("subcategoryId")

View file

@ -93,7 +93,7 @@ export function RecentTicketsPanel() {
const assigned = all
.filter((t) => !!t.assignee)
.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime())
return [...unassigned, ...assigned].slice(0, 6)
return [...unassigned, ...assigned].slice(0, 3)
}, [ticketsResult])
useEffect(() => {
@ -131,7 +131,7 @@ export function RecentTicketsPanel() {
<CardTitle className="text-lg font-semibold text-neutral-900">Últimos chamados</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
{Array.from({ length: 4 }).map((_, index) => (
{Array.from({ length: 3 }).map((_, index) => (
<div key={index} className="rounded-xl border border-slate-100 bg-slate-50/60 p-4">
<Skeleton className="mb-2 h-4 w-48" />
<Skeleton className="h-3 w-64" />

View file

@ -221,6 +221,7 @@ export function TicketCustomFieldsSection({ ticket, variant = "card", className
const viewerId = convexUserId as Id<"users"> | null
const tenantId = ticket.tenantId
const ticketCompanyId = ticket.company?.id ?? null
const ensureTicketFormDefaults = useMutation(api.tickets.ensureTicketFormDefaults)
@ -247,7 +248,7 @@ export function TicketCustomFieldsSection({ ticket, variant = "card", className
const formsRemote = useQuery(
api.tickets.listTicketForms,
canEdit && viewerId
? { tenantId, viewerId }
? { tenantId, viewerId, companyId: ticketCompanyId ? (ticketCompanyId as Id<"companies">) : undefined }
: "skip"
) as TicketFormDefinition[] | undefined