Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
feat(dashboard): delete a template from its row in the templates list
Cares T.64503cad880a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a5c7f9ca1..7ce4119e8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Added++- The dashboard Templates list has a delete button on each row, so a template can be deleted without opening it in the editor first. Like the editor's delete button, it shows only for keys that can write templates.+### Changed- The PostgreSQL data connection is pinned to UTC: parameters bind as UTC, naive timestamps read back as UTC, every pooled connection sets its session `TimeZone`, and boot fails when the effective zone is not UTC year round.diff --git a/dashboard/src/pages/Templates.css b/dashboard/src/pages/Templates.cssindex 2823c3597..bf13e8503 100644--- a/dashboard/src/pages/Templates.css+++ b/dashboard/src/pages/Templates.css@@ -122,6 +122,25 @@padding: 0 0.5rem 1rem;}+.templates-page .template-list-row {+ position: relative;+}++.templates-page .template-list-row.deletable .template-list-item {+ padding-inline-end: 2.75rem;+}++.templates-page .icon-btn.template-list-delete {+ position: absolute;+ top: 0.625rem;+ inset-inline-end: 0.625rem;+ width: 28px;+ height: 28px;+ border-color: transparent;+ background: transparent;+ color: var(--text-muted);+}+.templates-page .template-list-item {display: flex;flex-direction: column;diff --git a/dashboard/src/pages/Templates.tsx b/dashboard/src/pages/Templates.tsxindex 1ae06cadf..851174972 100644--- a/dashboard/src/pages/Templates.tsx+++ b/dashboard/src/pages/Templates.tsx@@ -271,20 +271,36 @@ export function Templates() {const templatePlaceholders = extractPlaceholders(template);const isSelected = editingTemplate?.id === template.id;return (- <button+ <divkey={template.id}- className={`template-list-item ${isSelected ? 'selected' : ''}`}- onClick={() => openEdit(template)}- type="button"+ className={`template-list-row ${canWrite ? 'deletable' : ''}`}+ role="listitem">- <span className="template-list-title">{template.name}</span>- <span className="template-list-body">{template.body}</span>- <span className="template-list-meta">- {templatePlaceholders.length > 0- ? templatePlaceholders.map(key => `{{${key}}}`).join(' ')- : t('templates.noPlaceholders')}- </span>- </button>+ <button+ className={`template-list-item ${isSelected ? 'selected' : ''}`}+ onClick={() => openEdit(template)}+ type="button"+ >+ <span className="template-list-title">{template.name}</span>+ <span className="template-list-body">{template.body}</span>+ <span className="template-list-meta">+ {templatePlaceholders.length > 0+ ? templatePlaceholders.map(key => `{{${key}}}`).join(' ')+ : t('templates.noPlaceholders')}+ </span>+ </button>+ {canWrite && (+ <button+ className="icon-btn danger template-list-delete"+ title={t('common.delete')}+ aria-label={t('common.delete')}+ onClick={() => setDeleteTarget(template)}+ type="button"+ >+ <Trash2 size={14} />+ </button>+ )}+ </div>);})}</div>