From 245d5dc15bda2475e90d817366aa74f4d0f5cc33 Mon Sep 17 00:00:00 2001 From: esdrasrenan Date: Sat, 13 Dec 2025 22:42:37 -0300 Subject: [PATCH] =?UTF-8?q?ui:=20melhorias=20de=20UX=20em=20v=C3=A1rias=20?= =?UTF-8?q?telas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Truncate com ellipsis na coluna Empresa (tickets-table) - Botão excluir em templates de checklist + mutation remove no backend - Botões Editar/Arquivar com size="sm" em checklist templates - Hover com borda no botão "Tornar opcional" do checklist - Botão Resetar em devices com estilo padrão (remove amarelo) - Botão "Encerrar" no modo apresentação do dashboard - Sidebar abre automaticamente ao sair do fullscreen 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- convex/checklistTemplates.ts | 20 +++++++ .../admin/devices/admin-devices-overview.tsx | 2 +- .../dashboards/dashboard-builder.tsx | 58 ++++++++++++------- .../settings/checklist-templates-manager.tsx | 31 +++++++++- .../tickets/ticket-checklist-card.tsx | 2 +- src/components/tickets/tickets-table.tsx | 6 +- 6 files changed, 91 insertions(+), 28 deletions(-) diff --git a/convex/checklistTemplates.ts b/convex/checklistTemplates.ts index c9c410a..34c75cc 100644 --- a/convex/checklistTemplates.ts +++ b/convex/checklistTemplates.ts @@ -259,3 +259,23 @@ export const update = mutation({ return { ok: true } }, }) + +export const remove = mutation({ + args: { + tenantId: v.string(), + actorId: v.id("users"), + templateId: v.id("ticketChecklistTemplates"), + }, + handler: async (ctx, { tenantId, actorId, templateId }) => { + await requireAdmin(ctx, actorId, tenantId) + + const existing = await ctx.db.get(templateId) + if (!existing || existing.tenantId !== tenantId) { + throw new ConvexError("Template de checklist não encontrado.") + } + + await ctx.db.delete(templateId) + + return { ok: true } + }, +}) diff --git a/src/components/admin/devices/admin-devices-overview.tsx b/src/components/admin/devices/admin-devices-overview.tsx index cdd5d90..70e4916 100644 --- a/src/components/admin/devices/admin-devices-overview.tsx +++ b/src/components/admin/devices/admin-devices-overview.tsx @@ -4000,7 +4000,7 @@ export function DeviceDetails({ device }: DeviceDetailsProps) { + ) : null} ) diff --git a/src/components/settings/checklist-templates-manager.tsx b/src/components/settings/checklist-templates-manager.tsx index f6f5dea..7ae3c07 100644 --- a/src/components/settings/checklist-templates-manager.tsx +++ b/src/components/settings/checklist-templates-manager.tsx @@ -266,6 +266,7 @@ export function ChecklistTemplatesManager() { ) as Array<{ id: Id<"companies">; name: string }> | undefined const updateTemplate = useMutation(api.checklistTemplates.update) + const removeTemplate = useMutation(api.checklistTemplates.remove) const companyOptions = useMemo( () => (companies ?? []).map((c) => ({ id: c.id, name: c.name })).sort((a, b) => a.name.localeCompare(b.name, "pt-BR")), @@ -303,6 +304,22 @@ export function ChecklistTemplatesManager() { } } + const handleDelete = async (tpl: ChecklistTemplateRow) => { + if (!viewerId) return + const ok = confirm(`Excluir o template "${tpl.name}"? Esta ação não pode ser desfeita.`) + if (!ok) return + try { + await removeTemplate({ + tenantId, + actorId: viewerId, + templateId: tpl.id, + }) + toast.success("Template excluído.") + } catch (error) { + toast.error(error instanceof Error ? error.message : "Falha ao excluir template.") + } + } + return (
@@ -366,12 +383,22 @@ export function ChecklistTemplatesManager() { ) : null}
- - +
diff --git a/src/components/tickets/ticket-checklist-card.tsx b/src/components/tickets/ticket-checklist-card.tsx index 7cf23a4..469ac80 100644 --- a/src/components/tickets/ticket-checklist-card.tsx +++ b/src/components/tickets/ticket-checklist-card.tsx @@ -376,7 +376,7 @@ export function TicketChecklistCard({