Add Remove button to Contacts panel; v1.1.2

Grouped contacts now have a Remove button that deletes all submissions
for that email address in one click (with confirmation).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-07-22 13:58:48 -04:00
parent bc025b5dab
commit 8d767b131c
2 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "siteforge",
"private": true,
"version": "1.1.1",
"version": "1.1.2",
"type": "module",
"scripts": {
"dev": "vite",
+15
View File
@@ -3366,6 +3366,7 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
subscribe: sortedEntries.some(entry => entry.subscribe),
message: latest.message || sortedEntries.find(entry => entry.message)?.message || '',
submissionCount: sortedEntries.length,
allIds: sortedEntries.map(e => e.id),
}
})
.filter(contact => {
@@ -3405,6 +3406,7 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
<th>Subscriber</th>
<th>Date</th>
<th>Message</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -3435,6 +3437,19 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
<td style={{ textAlign: 'center' }}>{c.subscribe ? '✓' : ''}</td>
<td style={{ whiteSpace: 'nowrap' }}>{formatDate(c.submittedAt)}</td>
<td style={{ maxWidth: '280px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }} title={c.message}>{c.message ?? '—'}</td>
<td>
<button
type="button"
className="btn-admin-remove"
style={{ fontSize: '0.75rem', padding: '0.2rem 0.55rem', whiteSpace: 'nowrap' }}
onClick={async () => {
const label = c.name || c.email || 'this contact'
if (!confirm(`Delete ${c.submissionCount > 1 ? `all ${c.submissionCount} submissions` : 'submission'} from ${label}?`)) return
await Promise.all(c.allIds.map(id => fetch(`/api/admin-contact-submissions/${encodeURIComponent(id)}`, { method: 'DELETE' })))
await reloadContactSubmissions()
}}
>Remove</button>
</td>
</tr>
))}
</tbody>