ui: melhorias de UX em várias telas

- 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 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-13 22:42:37 -03:00
parent 06388b3688
commit 245d5dc15b
6 changed files with 91 additions and 28 deletions

View file

@ -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<CompanyRow[]>(
() => (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 (
<div className="space-y-6">
<Card className="border border-slate-200">
@ -366,12 +383,22 @@ export function ChecklistTemplatesManager() {
) : null}
</div>
<div className="flex items-center gap-2">
<Button type="button" variant="outline" onClick={() => handleEdit(tpl)}>
<Button type="button" variant="outline" size="sm" onClick={() => handleEdit(tpl)}>
Editar
</Button>
<Button type="button" variant="outline" onClick={() => handleToggleArchived(tpl)}>
<Button type="button" variant="outline" size="sm" onClick={() => handleToggleArchived(tpl)}>
{tpl.isArchived ? "Restaurar" : "Arquivar"}
</Button>
<Button
type="button"
variant="ghost"
size="sm"
className="text-slate-500 hover:bg-red-50 hover:text-red-700"
onClick={() => handleDelete(tpl)}
title="Excluir template"
>
<Trash2 className="size-4" />
</Button>
</div>
</div>
</div>