feat: bulk actions for email lists

Select multiple rows (checkbox per row) in FolderView, SearchResults,
and the Senders email panel. A toolbar appears with mark read/unread,
star, archive, and trash, applied to the whole selection via
CleanupService.ExecuteAsync (already scoped to UserId).

Shared via useSelection hook and BulkToolbar component to avoid
duplicating selection state across the three list views.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
cesnimda
2026-06-30 21:53:43 +02:00
parent 8c92263cc3
commit c11d747919
7 changed files with 135 additions and 5 deletions
+30
View File
@@ -0,0 +1,30 @@
import { BulkApi } from '../api/client.js';
/// <summary>
/// Toolbar shown above an email list when one or more rows are selected.
/// `onDone` is called with the action key after a successful bulk call so the
/// caller can update local state (e.g. remove trashed/archived rows).
/// </summary>
export default function BulkToolbar({ selectedIds, onDone, onClear }) {
const count = selectedIds.length;
if (count === 0) return null;
const run = (fn, action) => async () => {
await fn(selectedIds);
onDone(action, selectedIds);
onClear();
};
return (
<div className="bulk-toolbar">
<span>{count} selected</span>
<div className="bulk-toolbar-spacer" />
<button className="bulk-btn" onClick={run(BulkApi.markRead, 'read')}>Mark read</button>
<button className="bulk-btn" onClick={run(BulkApi.markUnread, 'unread')}>Mark unread</button>
<button className="bulk-btn" onClick={run(BulkApi.star, 'star')}>Star</button>
<button className="bulk-btn" onClick={run(BulkApi.archive, 'archive')}>Archive</button>
<button className="bulk-btn bulk-btn--danger" onClick={run(BulkApi.trash, 'trash')}>Trash</button>
<button className="bulk-btn" onClick={onClear}>Cancel</button>
</div>
);
}