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:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "siteforge",
|
"name": "siteforge",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -3366,6 +3366,7 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
|
|||||||
subscribe: sortedEntries.some(entry => entry.subscribe),
|
subscribe: sortedEntries.some(entry => entry.subscribe),
|
||||||
message: latest.message || sortedEntries.find(entry => entry.message)?.message || '',
|
message: latest.message || sortedEntries.find(entry => entry.message)?.message || '',
|
||||||
submissionCount: sortedEntries.length,
|
submissionCount: sortedEntries.length,
|
||||||
|
allIds: sortedEntries.map(e => e.id),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(contact => {
|
.filter(contact => {
|
||||||
@@ -3405,6 +3406,7 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
|
|||||||
<th>Subscriber</th>
|
<th>Subscriber</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Message</th>
|
<th>Message</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -3435,6 +3437,19 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
|
|||||||
<td style={{ textAlign: 'center' }}>{c.subscribe ? '✓' : ''}</td>
|
<td style={{ textAlign: 'center' }}>{c.subscribe ? '✓' : ''}</td>
|
||||||
<td style={{ whiteSpace: 'nowrap' }}>{formatDate(c.submittedAt)}</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 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>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user