Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Add bulk operations for multi-select recordings in sidebar

Murtaza Nasir2e889dfff4da
diff --git a/src/api/recordings.py b/src/api/recordings.py
index a21048ea..c56617e4 100644
--- a/src/api/recordings.py
+++ b/src/api/recordings.py
@@ -3418,6 +3418,298 @@ def reorder_recording_tags(recording_id):
return jsonify({'error': 'An unexpected error occurred.'}), 500
+# --- Bulk Operations ---
+
+@recordings_bp.route('/api/recordings/bulk', methods=['DELETE'])
+@login_required
+def bulk_delete_recordings():
+ """Delete multiple recordings at once."""
+ try:
+ data = request.get_json()
+ if not data or 'recording_ids' not in data:
+ return jsonify({'error': 'Missing recording_ids'}), 400
+
+ recording_ids = data.get('recording_ids', [])
+ if not isinstance(recording_ids, list) or len(recording_ids) == 0:
+ return jsonify({'error': 'recording_ids must be a non-empty list'}), 400
+
+ # Limit bulk operations to prevent abuse
+ if len(recording_ids) > 100:
+ return jsonify({'error': 'Cannot delete more than 100 recordings at once'}), 400
+
+ # Check deletion permissions
+ if not USERS_CAN_DELETE and not current_user.is_admin:
+ return jsonify({'error': 'Only administrators can delete recordings'}), 403
+
+ deleted_ids = []
+ errors = []
+
+ for recording_id in recording_ids:
+ try:
+ recording = db.session.get(Recording, recording_id)
+ if not recording:
+ errors.append(f"Recording {recording_id} not found")
+ continue
+
+ # Check ownership
+ if recording.user_id and recording.user_id != current_user.id:
+ errors.append(f"No permission for recording {recording_id}")
+ continue
+
+ # Delete audio file
+ if recording.audio_path and os.path.exists(recording.audio_path):
+ try:
+ os.remove(recording.audio_path)
+ except Exception as e:
+ current_app.logger.error(f"Error deleting audio file {recording.audio_path}: {e}")
+
+ # Delete associated processing jobs
+ from src.models import ProcessingJob
+ ProcessingJob.query.filter_by(recording_id=recording_id).delete()
+
+ # Delete the recording
+ db.session.delete(recording)
+ deleted_ids.append(recording_id)
+
+ except Exception as e:
+ current_app.logger.error(f"Error deleting recording {recording_id}: {e}")
+ errors.append(f"Error with recording {recording_id}")
+
+ db.session.commit()
+
+ return jsonify({
+ 'success': True,
+ 'deleted_ids': deleted_ids,
+ 'deleted_count': len(deleted_ids),
+ 'errors': errors if errors else None
+ })
+
+ except Exception as e:
+ db.session.rollback()
+ current_app.logger.error(f"Error in bulk delete: {e}", exc_info=True)
+ return jsonify({'error': 'An unexpected error occurred'}), 500
+
+
+@recordings_bp.route('/api/recordings/bulk-tags', methods=['POST'])
+@login_required
+def bulk_update_tags():
+ """Add or remove a tag from multiple recordings."""
+ try:
+ data = request.get_json()
+ if not data:
+ return jsonify({'error': 'Missing request body'}), 400
+
+ recording_ids = data.get('recording_ids', [])
+ tag_id = data.get('tag_id')
+ action = data.get('action', 'add') # 'add' or 'remove'
+
+ if not recording_ids or not tag_id:
+ return jsonify({'error': 'Missing recording_ids or tag_id'}), 400
+
+ if action not in ['add', 'remove']:
+ return jsonify({'error': 'Action must be "add" or "remove"'}), 400
+
+ if len(recording_ids) > 100:
+ return jsonify({'error': 'Cannot update more than 100 recordings at once'}), 400
+
+ # Verify tag exists and user has access
+ tag = db.session.get(Tag, tag_id)
+ if not tag:
+ return jsonify({'error': 'Tag not found'}), 404
+
+ if tag.user_id != current_user.id and not tag.group_id:
+ return jsonify({'error': 'No permission to use this tag'}), 403
+
+ affected_ids = []
+
+ for recording_id in recording_ids:
+ try:
+ recording = db.session.get(Recording, recording_id)
+ if not recording:
+ continue
+
+ # Check ownership or edit access
+ if not has_recording_access(recording, current_user, require_edit=True):
+ continue
+
+ if action == 'add':
+ # Check if tag already exists
+ existing = RecordingTag.query.filter_by(
+ recording_id=recording_id,
+ tag_id=tag_id
+ ).first()
+
+ if not existing:
+ # Get max order for this recording
+ max_order = db.session.query(db.func.max(RecordingTag.order)).filter_by(
+ recording_id=recording_id
+ ).scalar() or 0
+
+ new_tag = RecordingTag(
+ recording_id=recording_id,
+ tag_id=tag_id,
+ order=max_order + 1
+ )
+ db.session.add(new_tag)
+ affected_ids.append(recording_id)
+
+ else: # remove
+ recording_tag = RecordingTag.query.filter_by(
+ recording_id=recording_id,
+ tag_id=tag_id
+ ).first()
+
+ if recording_tag:
+ db.session.delete(recording_tag)
+ affected_ids.append(recording_id)
+
+ except Exception as e:
+ current_app.logger.error(f"Error updating tag for recording {recording_id}: {e}")
+
+ db.session.commit()
+
+ return jsonify({
+ 'success': True,
+ 'affected_ids': affected_ids,
+ 'affected_count': len(affected_ids)
+ })
+
+ except Exception as e:
+ db.session.rollback()
+ current_app.logger.error(f"Error in bulk tag update: {e}", exc_info=True)
+ return jsonify({'error': 'An unexpected error occurred'}), 500
+
+
+@recordings_bp.route('/api/recordings/bulk-reprocess', methods=['POST'])
+@login_required
+def bulk_reprocess():
+ """Queue multiple recordings for reprocessing."""
+ try:
+ data = request.get_json()
+ if not data:
+ return jsonify({'error': 'Missing request body'}), 400
+
+ recording_ids = data.get('recording_ids', [])
+ reprocess_type = data.get('type', 'summary') # 'transcription' or 'summary'
+
+ if not recording_ids:
+ return jsonify({'error': 'Missing recording_ids'}), 400
+
+ if reprocess_type not in ['transcription', 'summary']:
+ return jsonify({'error': 'Type must be "transcription" or "summary"'}), 400
+
+ if len(recording_ids) > 50:
+ return jsonify({'error': 'Cannot reprocess more than 50 recordings at once'}), 400
+
+ queued_ids = []
+
+ for recording_id in recording_ids:
+ try:
+ recording = db.session.get(Recording, recording_id)
+ if not recording:
+ continue
+
+ # Check ownership
+ if recording.user_id != current_user.id:
+ continue
+
+ # Only reprocess completed or failed recordings
+ if recording.status not in ['COMPLETED', 'FAILED']:
+ continue
+
+ # For transcription reprocess, need audio file
+ if reprocess_type == 'transcription':
+ if not recording.audio_path or not os.path.exists(recording.audio_path):
+ continue
+ job_type = 'reprocess_transcription'
+ else:
+ # For summary, need transcription
+ if not recording.transcription:
+ continue
+ job_type = 'reprocess_summary'
+
+ # Queue the job
+ job_queue.enqueue(
+ user_id=current_user.id,
+ recording_id=recording.id,
+ job_type=job_type,
+ params={'user_id': current_user.id}
+ )
+
+ queued_ids.append(recording_id)
+
+ except Exception as e:
+ current_app.logger.error(f"Error queueing reprocess for recording {recording_id}: {e}")
+
+ db.session.commit()
+
+ return jsonify({
+ 'success': True,
+ 'queued_ids': queued_ids,
+ 'queued_count': len(queued_ids)
+ })
+
+ except Exception as e:
+ db.session.rollback()
+ current_app.logger.error(f"Error in bulk reprocess: {e}", exc_info=True)
+ return jsonify({'error': 'An unexpected error occurred'}), 500
+
+
+@recordings_bp.route('/api/recordings/bulk-toggle', methods=['POST'])
+@login_required
+def bulk_toggle():
+ """Toggle inbox or highlight for multiple recordings."""
+ try:
+ data = request.get_json()
+ if not data:
+ return jsonify({'error': 'Missing request body'}), 400
+
+ recording_ids = data.get('recording_ids', [])
+ field = data.get('field') # 'inbox' or 'highlight'
+ value = data.get('value') # True or False
+
+ if not recording_ids or field is None or value is None:
+ return jsonify({'error': 'Missing recording_ids, field, or value'}), 400
+
+ if field not in ['inbox', 'highlight']:
+ return jsonify({'error': 'Field must be "inbox" or "highlight"'}), 400
+
+ if len(recording_ids) > 100:
+ return jsonify({'error': 'Cannot update more than 100 recordings at once'}), 400
+
+ affected_ids = []
+
+ for recording_id in recording_ids:
+ try:
+ recording = db.session.get(Recording, recording_id)
+ if not recording:
+ continue
+
+ # Use set_user_recording_status which handles both owners and shared users
+ if field == 'inbox':
+ set_user_recording_status(recording, current_user, is_inbox=value)
+ else:
+ set_user_recording_status(recording, current_user, is_highlighted=value)
+
+ affected_ids.append(recording_id)
+
+ except Exception as e:
+ current_app.logger.error(f"Error toggling {field} for recording {recording_id}: {e}")
+
+ db.session.commit()
+
+ return jsonify({
+ 'success': True,
+ 'affected_ids': affected_ids,
+ 'affected_count': len(affected_ids)
+ })
+
+ except Exception as e:
+ db.session.rollback()
+ current_app.logger.error(f"Error in bulk toggle: {e}", exc_info=True)
+ return jsonify({'error': 'An unexpected error occurred'}), 500
+
+
# --- Auto-deletion and Chunks Processing ---
@recordings_bp.route('/api/recordings/<int:recording_id>/toggle_deletion_exempt', methods=['POST'])
diff --git a/static/css/styles.css b/static/css/styles.css
index 86e55c5f..c883613e 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -1774,6 +1774,54 @@ body {
}
}
+/* Selection checkbox - used for bulk selection in sidebar */
+.selection-checkbox {
+ appearance: none;
+ -webkit-appearance: none;
+ width: 18px;
+ height: 18px;
+ border: 2px solid var(--border-secondary);
+ border-radius: 0.25rem;
+ background-color: var(--bg-input);
+ cursor: pointer;
+ position: relative;
+ transition: all 0.2s ease;
+ flex-shrink: 0;
+}
+
+.selection-checkbox:hover {
+ border-color: var(--border-accent);
+}
+
+.selection-checkbox:checked {
+ background-color: var(--bg-button);
+ border-color: var(--bg-button);
+ animation: checkboxPop 0.2s ease-out;
+}
+
+.selection-checkbox:checked::after {
+ content: '';
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ width: 4px;
+ height: 9px;
+ border: solid var(--text-button);
+ border-width: 0 2.5px 2.5px 0;
+ transform: translate(-50%, -60%) rotate(45deg);
+ animation: checkmarkDraw 0.2s ease-out;
+}
+
+/* Vue transition for slide-up (bulk action bar) */
+.slide-up-enter-active,
+.slide-up-leave-active {
+ transition: transform 0.3s ease;
+}
+.slide-up-enter-from,
+.slide-up-leave-to {
+ transform: translateY(100%);
+}
+
.follow-player-control .follow-icon {
font-size: 11px;
flex-shrink: 0;
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index eceafebc..4d8bdfea 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -14,6 +14,8 @@ import { useChat } from './modules/composables/chat.js';
import { useTags } from './modules/composables/tags.js';
import { usePWA } from './modules/composables/pwa.js';
import { useVirtualScroll, getVirtualItemKey } from './modules/composables/virtualScroll.js';
+import { useBulkSelection } from './modules/composables/bulk-selection.js';
+import { useBulkOperations } from './modules/composables/bulk-operations.js';
// Import utilities
import { showToast } from './modules/utils/toast.js';
@@ -362,6 +364,11 @@ document.addEventListener('DOMContentLoaded', async () => {
const incognitoRecording = ref(null);
const incognitoProcessing = ref(false);
+ // --- Bulk Selection State ---
+ const selectionMode = ref(false);
+ const selectedRecordingIds = ref(new Set());
+ const bulkActionInProgress = ref(false);
+
// --- Recording Size Monitoring ---
const estimatedFileSize = ref(0);
const fileSizeWarningShown = ref(false);
@@ -646,6 +653,9 @@ document.addEventListener('DOMContentLoaded', async () => {
// Incognito Mode
enableIncognitoMode, incognitoMode, incognitoRecording, incognitoProcessing,
+ // Bulk Selection
+ selectionMode, selectedRecordingIds, bulkActionInProgress,
+
// Modals
showEditModal, showDeleteModal, showEditTagsModal, selectedNewTagId, tagSearchFilter,
showReprocessModal, showResetModal, showSpeakerModal, speakerModalTab, showShareModal, showSharesListModal,
@@ -1245,6 +1255,29 @@ document.addEventListener('DOMContentLoaded', async () => {
setGlobalError
});
+ // Bulk selection composable
+ const bulkSelectionComposable = useBulkSelection({
+ selectionMode,
+ selectedRecordingIds,
+ recordings,
+ selectedRecording,
+ currentView
+ });
+
+ // Bulk operations composable (needs selection composable methods)
+ const bulkOperationsComposable = useBulkOperations({
+ selectedRecordingIds,
+ selectedRecordings: bulkSelectionComposable.selectedRecordings,
+ recordings,
+ selectedRecording,
+ bulkActionInProgress,
+ availableTags,
+ showToast,
+ setGlobalError,
+ exitSelectionMode: bulkSelectionComposable.exitSelectionMode,
+ startReprocessingPoll: reprocessComposable.startReprocessingPoll
+ });
+
// =========================================================================
// VIRTUAL SCROLL SETUP (for performance with long transcriptions)
// Must be before speakers composable since it uses scrollToSegmentIndex
@@ -2159,6 +2192,9 @@ document.addEventListener('DOMContentLoaded', async () => {
return 'You have an incognito recording that will be lost. Are you sure you want to leave?';
}
});
+
+ // Initialize bulk selection keyboard listeners
+ bulkSelectionComposable.initSelectionKeyboardListeners();
});
// =========================================================================
@@ -2340,7 +2376,9 @@ document.addEventListener('DOMContentLoaded', async () => {
...speakersComposable,
...chatComposable,
...tagsComposable,
- ...pwaComposable
+ ...pwaComposable,
+ ...bulkSelectionComposable,
+ ...bulkOperationsComposable
};
},
delimiters: ['${', '}']
diff --git a/static/js/modules/composables/bulk-operations.js b/static/js/modules/composables/bulk-operations.js
new file mode 100644
index 00000000..0dd30f68
--- /dev/null
+++ b/static/js/modules/composables/bulk-operations.js
@@ -0,0 +1,410 @@
+/**
+ * Bulk Operations Composable
+ * Handles bulk API operations for multiple recordings
+ */
+
+const { ref, computed } = Vue;
+
+export function useBulkOperations({
+ selectedRecordingIds,
+ selectedRecordings,
+ recordings,
+ selectedRecording,
+ bulkActionInProgress,
+ availableTags,
+ showToast,
+ setGlobalError,
+ exitSelectionMode,
+ startReprocessingPoll
+}) {
+ // Modal state
+ const showBulkDeleteModal = ref(false);
+ const showBulkTagModal = ref(false);
+ const showBulkReprocessModal = ref(false);
+ const bulkTagAction = ref('add'); // 'add' or 'remove'
+ const bulkTagSelectedId = ref('');
+ const bulkReprocessType = ref('summary'); // 'transcription' or 'summary'
+
+ // Get CSRF token
+ const getCsrfToken = () => {
+ return document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
+ };
+
+ // Helper to get selected IDs as array
+ const getSelectedIds = () => {
+ return Array.from(selectedRecordingIds.value);
+ };
+
+ // =========================================
+ // Bulk Delete
+ // =========================================
+
+ const openBulkDeleteModal = () => {
+ showBulkDeleteModal.value = true;
+ };
+
+ const closeBulkDeleteModal = () => {
+ showBulkDeleteModal.value = false;
+ };
+
+ const executeBulkDelete = async () => {
+ const ids = getSelectedIds();
+ if (ids.length === 0) return;
+
+ bulkActionInProgress.value = true;
+ closeBulkDeleteModal();
+
+ try {
+ const response = await fetch('/api/recordings/bulk', {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': getCsrfToken()
+ },
+ body: JSON.stringify({ recording_ids: ids })
+ });
+
+ const data = await response.json();
+
+ if (!response.ok) {
+ throw new Error(data.error || 'Failed to delete recordings');
+ }
+
+ // Remove deleted recordings from local state
+ const deletedIds = new Set(data.deleted_ids || ids);
+ recordings.value = recordings.value.filter(r => !deletedIds.has(r.id));
+
+ // Clear selected recording if it was deleted
+ if (selectedRecording.value && deletedIds.has(selectedRecording.value.id)) {
+ selectedRecording.value = null;
+ }
+
+ const count = deletedIds.size;
+ showToast(`${count} recording${count !== 1 ? 's' : ''} deleted`, 'fa-trash', 3000, 'success');
+
+ exitSelectionMode();
+ } catch (error) {
+ console.error('Bulk delete error:', error);
+ setGlobalError(`Failed to delete recordings: ${error.message}`);
+ } finally {
+ bulkActionInProgress.value = false;
+ }
+ };
+
+ // =========================================
+ // Bulk Tag Operations
+ // =========================================
+
+ const openBulkTagModal = (action = 'add') => {
+ bulkTagAction.value = action;
+ bulkTagSelectedId.value = '';
+ showBulkTagModal.value = true;
+ };
+
+ const closeBulkTagModal = () => {
+ showBulkTagModal.value = false;
+ bulkTagSelectedId.value = '';
+ };
+
+ const executeBulkTag = async () => {
+ const ids = getSelectedIds();
+ const tagId = bulkTagSelectedId.value;
+ const action = bulkTagAction.value;
+
+ // Validate before making API call
+ if (ids.length === 0) {
+ console.warn('No recordings selected for bulk tag operation');
+ return;
+ }
+ if (!tagId && tagId !== 0) {
+ console.warn('No tag selected for bulk tag operation');
+ return;
+ }
+
+ bulkActionInProgress.value = true;
+ closeBulkTagModal();
+
+ try {
+ const response = await fetch('/api/recordings/bulk-tags', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': getCsrfToken()
+ },
+ body: JSON.stringify({
+ recording_ids: ids,
+ tag_id: parseInt(tagId),
+ action: action
+ })
+ });
+
+ const data = await response.json();
+
+ if (!response.ok) {
+ throw new Error(data.error || `Failed to ${action} tag`);
+ }
+
+ // Update local state
+ const tag = availableTags.value.find(t => t.id == tagId);
+ if (tag) {
+ const affectedIds = new Set(data.affected_ids || ids);
+ recordings.value.forEach(recording => {
+ if (affectedIds.has(recording.id)) {
+ if (!recording.tags) recording.tags = [];
+
+ if (action === 'add') {
+ // Add tag if not already present
+ if (!recording.tags.find(t => t.id === tag.id)) {
+ recording.tags.push(tag);
+ }
+ } else {
+ // Remove tag
+ recording.tags = recording.tags.filter(t => t.id !== tag.id);
+ }
+ }
+ });
+
+ // Update selected recording if affected
+ if (selectedRecording.value && affectedIds.has(selectedRecording.value.id)) {
+ if (!selectedRecording.value.tags) selectedRecording.value.tags = [];
+
+ if (action === 'add') {
+ if (!selectedRecording.value.tags.find(t => t.id === tag.id)) {
+ selectedRecording.value.tags.push(tag);
+ }
+ } else {
+ selectedRecording.value.tags = selectedRecording.value.tags.filter(t => t.id !== tag.id);
+ }
+ }
+ }
+
+ const count = data.affected_ids?.length || ids.length;
+ const actionText = action === 'add' ? 'added to' : 'removed from';
+ showToast(`Tag ${actionText} ${count} recording${count !== 1 ? 's' : ''}`, 'fa-tags', 3000, 'success');
+
+ exitSelectionMode();
+ } catch (error) {
+ console.error('Bulk tag error:', error);
+ setGlobalError(`Failed to ${action} tag: ${error.message}`);
+ } finally {
+ bulkActionInProgress.value = false;
+ }
+ };
+
+ // =========================================
+ // Bulk Reprocess
+ // =========================================
+
+ const openBulkReprocessModal = () => {
+ bulkReprocessType.value = 'summary';
+ showBulkReprocessModal.value = true;
+ };
+
+ const closeBulkReprocessModal = () => {
+ showBulkReprocessModal.value = false;
+ };
+
+ const executeBulkReprocess = async () => {
+ const ids = getSelectedIds();
+ if (ids.length === 0) return;
+
+ bulkActionInProgress.value = true;
+ closeBulkReprocessModal();
+
+ try {
+ const response = await fetch('/api/recordings/bulk-reprocess', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': getCsrfToken()
+ },
+ body: JSON.stringify({
+ recording_ids: ids,
+ type: bulkReprocessType.value
+ })
+ });
+
+ const data = await response.json();
+
+ if (!response.ok) {
+ throw new Error(data.error || 'Failed to queue reprocessing');
+ }
+
+ // Update status for queued recordings
+ const queuedIds = new Set(data.queued_ids || ids);
+ const newStatus = bulkReprocessType.value === 'transcription' ? 'PROCESSING' : 'SUMMARIZING';
+
+ recordings.value.forEach(recording => {
+ if (queuedIds.has(recording.id)) {
+ recording.status = newStatus;
+ // Start polling for each
+ if (startReprocessingPoll) {
+ startReprocessingPoll(recording.id);
+ }
+ }
+ });
+
+ if (selectedRecording.value && queuedIds.has(selectedRecording.value.id)) {
+ selectedRecording.value.status = newStatus;
+ }
+
+ const count = queuedIds.size;
+ const typeText = bulkReprocessType.value === 'transcription' ? 'Transcription' : 'Summary';
+ showToast(`${typeText} reprocessing queued for ${count} recording${count !== 1 ? 's' : ''}`, 'fa-sync-alt', 3000, 'success');
+
+ exitSelectionMode();
+ } catch (error) {
+ console.error('Bulk reprocess error:', error);
+ setGlobalError(`Failed to queue reprocessing: ${error.message}`);
+ } finally {
+ bulkActionInProgress.value = false;
+ }
+ };
+
+ // =========================================
+ // Bulk Toggle (Inbox/Highlight)
+ // =========================================
+
+ const bulkToggleInbox = async (value = null) => {
+ const ids = getSelectedIds();
+ if (ids.length === 0) return;
+
+ // If no value specified, toggle based on majority
+ if (value === null) {
+ const inboxCount = selectedRecordings.value.filter(r => r.is_inbox).length;
+ value = inboxCount < ids.length / 2;
+ }
+
+ bulkActionInProgress.value = true;
+
+ try {
+ const response = await fetch('/api/recordings/bulk-toggle', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': getCsrfToken()
+ },
+ body: JSON.stringify({
+ recording_ids: ids,
+ field: 'inbox',
+ value: value
+ })
+ });
+
+ const data = await response.json();
+
+ if (!response.ok) {
+ throw new Error(data.error || 'Failed to update inbox status');
+ }
+
+ // Update local state
+ const affectedIds = new Set(data.affected_ids || ids);
+ recordings.value.forEach(recording => {
+ if (affectedIds.has(recording.id)) {
+ recording.is_inbox = value;
+ }
+ });
+
+ if (selectedRecording.value && affectedIds.has(selectedRecording.value.id)) {
+ selectedRecording.value.is_inbox = value;
+ }
+
+ const count = affectedIds.size;
+ const actionText = value ? 'added to' : 'removed from';
+ showToast(`${count} recording${count !== 1 ? 's' : ''} ${actionText} inbox`, 'fa-inbox', 3000, 'success');
+
+ exitSelectionMode();
+ } catch (error) {
+ console.error('Bulk toggle inbox error:', error);
+ setGlobalError(`Failed to update inbox status: ${error.message}`);
+ } finally {
+ bulkActionInProgress.value = false;
+ }
+ };
+
+ const bulkToggleHighlight = async (value = null) => {
+ const ids = getSelectedIds();
+ if (ids.length === 0) return;
+
+ // If no value specified, toggle based on majority
+ if (value === null) {
+ const highlightCount = selectedRecordings.value.filter(r => r.is_highlighted).length;
+ value = highlightCount < ids.length / 2;
+ }
+
+ bulkActionInProgress.value = true;
+
+ try {
+ const response = await fetch('/api/recordings/bulk-toggle', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': getCsrfToken()
+ },
+ body: JSON.stringify({
+ recording_ids: ids,
+ field: 'highlight',
+ value: value
+ })
+ });
+
+ const data = await response.json();
+
+ if (!response.ok) {
+ throw new Error(data.error || 'Failed to update highlight status');
+ }
+
+ // Update local state
+ const affectedIds = new Set(data.affected_ids || ids);
+ recordings.value.forEach(recording => {
+ if (affectedIds.has(recording.id)) {
+ recording.is_highlighted = value;
+ }
+ });
+
+ if (selectedRecording.value && affectedIds.has(selectedRecording.value.id)) {
+ selectedRecording.value.is_highlighted = value;
+ }
+
+ const count = affectedIds.size;
+ const actionText = value ? 'highlighted' : 'unhighlighted';
+ showToast(`${count} recording${count !== 1 ? 's' : ''} ${actionText}`, 'fa-star', 3000, 'success');
+
+ exitSelectionMode();
+ } catch (error) {
+ console.error('Bulk toggle highlight error:', error);
+ setGlobalError(`Failed to update highlight status: ${error.message}`);
+ } finally {
+ bulkActionInProgress.value = false;
+ }
+ };
+
+ return {
+ // Modal state
+ showBulkDeleteModal,
+ showBulkTagModal,
+ showBulkReprocessModal,
+ bulkTagAction,
+ bulkTagSelectedId,
+ bulkReprocessType,
+
+ // Bulk Delete
+ openBulkDeleteModal,
+ closeBulkDeleteModal,
+ executeBulkDelete,
+
+ // Bulk Tag
+ openBulkTagModal,
+ closeBulkTagModal,
+ executeBulkTag,
+
+ // Bulk Reprocess
+ openBulkReprocessModal,
+ closeBulkReprocessModal,
+ executeBulkReprocess,
+
+ // Bulk Toggle
+ bulkToggleInbox,
+ bulkToggleHighlight
+ };
+}
diff --git a/static/js/modules/composables/bulk-selection.js b/static/js/modules/composables/bulk-selection.js
new file mode 100644
index 00000000..1da48c55
--- /dev/null
+++ b/static/js/modules/composables/bulk-selection.js
@@ -0,0 +1,111 @@
+/**
+ * Bulk Selection Composable
+ * Handles multi-select functionality for recordings
+ */
+
+const { computed } = Vue;
+
+export function useBulkSelection({
+ selectionMode,
+ selectedRecordingIds,
+ recordings,
+ selectedRecording,
+ currentView
+}) {
+ // Computed
+ const selectedCount = computed(() => selectedRecordingIds.value.size);
+
+ const selectedRecordings = computed(() => {
+ return recordings.value.filter(r => selectedRecordingIds.value.has(r.id));
+ });
+
+ const allVisibleSelected = computed(() => {
+ if (recordings.value.length === 0) return false;
+ return recordings.value.every(r => selectedRecordingIds.value.has(r.id));
+ });
+
+ const isSelected = (id) => {
+ return selectedRecordingIds.value.has(id);
+ };
+
+ // Methods
+ const enterSelectionMode = () => {
+ selectionMode.value = true;
+ selectedRecordingIds.value = new Set();
+ };
+
+ const exitSelectionMode = () => {
+ selectionMode.value = false;
+ selectedRecordingIds.value = new Set();
+ };
+
+ const toggleSelection = (id) => {
+ const newSet = new Set(selectedRecordingIds.value);
+ if (newSet.has(id)) {
+ newSet.delete(id);
+ } else {
+ newSet.add(id);
+ }
+ selectedRecordingIds.value = newSet;
+ };
+
+ const selectAll = () => {
+ const newSet = new Set();
+ recordings.value.forEach(r => newSet.add(r.id));
+ selectedRecordingIds.value = newSet;
+ };
+
+ const clearSelection = () => {
+ selectedRecordingIds.value = new Set();
+ };
+
+ // Keyboard handler for selection mode
+ const handleSelectionKeyboard = (event) => {
+ if (!selectionMode.value) return;
+
+ // Escape to exit selection mode
+ if (event.key === 'Escape') {
+ exitSelectionMode();
+ event.preventDefault();
+ }
+
+ // Ctrl/Cmd + A to select all
+ if ((event.ctrlKey || event.metaKey) && event.key === 'a') {
+ // Only if not in an input field
+ if (document.activeElement.tagName !== 'INPUT' &&
+ document.activeElement.tagName !== 'TEXTAREA' &&
+ !document.activeElement.isContentEditable) {
+ event.preventDefault();
+ selectAll();
+ }
+ }
+ };
+
+ // Initialize keyboard listener
+ const initSelectionKeyboardListeners = () => {
+ document.addEventListener('keydown', handleSelectionKeyboard);
+ };
+
+ const cleanupSelectionKeyboardListeners = () => {
+ document.removeEventListener('keydown', handleSelectionKeyboard);
+ };
+
+ return {
+ // Computed
+ selectedCount,
+ selectedRecordings,
+ allVisibleSelected,
+
+ // Methods
+ isSelected,
+ enterSelectionMode,
+ exitSelectionMode,
+ toggleSelection,
+ selectAll,
+ clearSelection,
+
+ // Keyboard
+ initSelectionKeyboardListeners,
+ cleanupSelectionKeyboardListeners
+ };
+}
diff --git a/static/js/modules/composables/index.js b/static/js/modules/composables/index.js
index d5411a24..14a35549 100644
--- a/static/js/modules/composables/index.js
+++ b/static/js/modules/composables/index.js
@@ -28,3 +28,5 @@ export { useSpeakers } from './speakers.js';
export { useChat } from './chat.js';
export { usePWA } from './pwa.js';
export { useTokens } from './tokens.js';
+export { useBulkSelection } from './bulk-selection.js';
+export { useBulkOperations } from './bulk-operations.js';
diff --git a/templates/components/sidebar.html b/templates/components/sidebar.html
index fcb810d9..37e5e663 100644
--- a/templates/components/sidebar.html
+++ b/templates/components/sidebar.html
@@ -18,7 +18,21 @@
<i class="fas fa-search"></i>
</a>
{% endif %}
- <button @click="switchToUploadView"
+ <!-- Selection Mode Toggle -->
+ <button v-if="!selectionMode && recordings.length > 0"
+ @click="enterSelectionMode"
+ class="px-2 py-1.5 bg-[var(--bg-accent)] text-[var(--text-accent)] rounded-lg hover:opacity-80 transition-opacity text-sm"
+ title="Select multiple">
+ <i class="fas fa-list-check"></i>
+ </button>
+ <button v-if="selectionMode"
+ @click="exitSelectionMode"
+ class="px-2 py-1.5 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg hover:opacity-80 transition-opacity text-sm"
+ title="Exit selection mode">
+ <i class="fas fa-times mr-1"></i>Done
+ </button>
+ <button v-if="!selectionMode"
+ @click="switchToUploadView"
class="px-3 py-1.5 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg hover:bg-[var(--bg-button-hover)] transition-colors text-sm">
<i class="fas fa-plus mr-1"></i><span v-text="t('common.new')"></span>
</button>
@@ -303,6 +317,19 @@
</div>
<div v-if="recordings.length > 0" class="space-y-2">
+ <!-- Selection Mode Controls -->
+ <div v-if="selectionMode" class="flex items-center justify-between px-1 py-2 mb-2 border-b border-[var(--border-primary)]">
+ <div class="flex items-center gap-3">
+ <button @click="allVisibleSelected ? clearSelection() : selectAll()"
+ class="text-xs text-[var(--text-accent)] hover:underline">
+ ${ allVisibleSelected ? 'Clear all' : 'Select all' }
+ </button>
+ <span class="text-xs text-[var(--text-muted)]">
+ ${ selectedCount } selected
+ </span>
+ </div>
+ </div>
+
<div v-for="group in groupedRecordings" :key="group.title" class="mb-6">
<h3 class="text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wide mb-2">
${group.title}
@@ -310,18 +337,27 @@
<div class="space-y-1">
<div v-for="recording in group.items"
:key="recording.id"
- @click="selectRecording(recording)"
+ @click="selectionMode ? toggleSelection(recording.id) : selectRecording(recording)"
:class="[
'p-3 rounded-lg cursor-pointer transition-all duration-200 border-2',
- selectedRecording?.id === recording.id
+ selectionMode && isSelected(recording.id)
? 'bg-[var(--bg-accent)] border-[var(--border-accent)]'
- : recording.is_shared
- ? 'bg-[var(--bg-secondary)] border-[var(--bg-tertiary)] hover:bg-[var(--bg-accent-hover)]'
- : 'bg-[var(--bg-tertiary)] border-transparent hover:bg-[var(--bg-accent-hover)]'
+ : selectedRecording?.id === recording.id && !selectionMode
+ ? 'bg-[var(--bg-accent)] border-[var(--border-accent)]'
+ : recording.is_shared
+ ? 'bg-[var(--bg-secondary)] border-[var(--bg-tertiary)] hover:bg-[var(--bg-accent-hover)]'
+ : 'bg-[var(--bg-tertiary)] border-transparent hover:bg-[var(--bg-accent-hover)]'
]">
<!-- Title and Status Row -->
<div class="flex items-center justify-between mb-1">
- <h4 class="font-medium text-sm truncate flex-1 mr-2" :class="selectedRecording?.id === recording.id ? 'text-[var(--text-accent)]' : 'text-[var(--text-primary)]'">
+ <!-- Checkbox for selection mode -->
+ <div v-if="selectionMode" @click.stop="toggleSelection(recording.id)" class="flex-shrink-0 mr-2">
+ <input type="checkbox"
+ :checked="isSelected(recording.id)"
+ class="selection-checkbox"
+ @click.stop="toggleSelection(recording.id)">
+ </div>
+ <h4 class="font-medium text-sm truncate flex-1 mr-2" :class="selectedRecording?.id === recording.id && !selectionMode ? 'text-[var(--text-accent)]' : 'text-[var(--text-primary)]'">
${ recording.title || t('common.untitled') }
</h4>
<div class="flex items-center gap-0.5 flex-shrink-0">
diff --git a/templates/index.html b/templates/index.html
index 86899296..fa9ee068 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -106,6 +106,12 @@
{% include 'modals/share-delete-modal.html' %}
{% include 'modals/global-error.html' %}
{% include 'modals/toast-container.html' %}
+
+ <!-- Bulk Operations -->
+ {% include 'modals/bulk-action-bar.html' %}
+ {% include 'modals/bulk-delete-modal.html' %}
+ {% include 'modals/bulk-tag-modal.html' %}
+ {% include 'modals/bulk-reprocess-modal.html' %}
</div>
<!-- CSRF Token Management -->
diff --git a/templates/modals/bulk-action-bar.html b/templates/modals/bulk-action-bar.html
new file mode 100644
index 00000000..7252d5ff
--- /dev/null
+++ b/templates/modals/bulk-action-bar.html
@@ -0,0 +1,85 @@
+<!-- Bulk Action Bar - Fixed at bottom when in selection mode -->
+<transition name="slide-up">
+ <div v-if="selectionMode && selectedCount > 0"
+ class="fixed bottom-0 left-0 right-0 bg-[var(--bg-secondary)] border-t border-[var(--border-primary)] shadow-lg z-50 transform transition-transform duration-300"
+ :class="{ 'translate-y-full': bulkActionInProgress }">
+ <div class="max-w-4xl mx-auto px-4 py-3">
+ <div class="flex items-center justify-between gap-4">
+ <!-- Selection info -->
+ <div class="flex items-center gap-3">
+ <span class="text-sm font-medium text-[var(--text-primary)]">
+ ${ selectedCount } selected
+ </span>
+ <button @click="selectAll"
+ v-if="!allVisibleSelected"
+ class="text-xs text-[var(--text-accent)] hover:underline">
+ Select all
+ </button>
+ <button @click="clearSelection"
+ class="text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)]">
+ Clear
+ </button>
+ </div>
+
+ <!-- Action buttons -->
+ <div class="flex items-center gap-2">
+ <!-- Tags -->
+ <button @click="openBulkTagModal('add')"
+ class="px-3 py-2 text-sm bg-[var(--bg-tertiary)] hover:bg-[var(--bg-input)] rounded-lg transition-colors flex items-center gap-2"
+ title="Add or remove tags">
+ <i class="fas fa-tags text-[var(--text-muted)]"></i>
+ <span class="hidden sm:inline">Tags</span>
+ </button>
+
+ <!-- Inbox Toggle -->
+ <button @click="bulkToggleInbox()"
+ class="px-3 py-2 text-sm bg-[var(--bg-tertiary)] hover:bg-[var(--bg-input)] rounded-lg transition-colors flex items-center gap-2"
+ title="Toggle inbox status">
+ <i class="fas fa-inbox text-blue-500"></i>
+ <span class="hidden sm:inline">Inbox</span>
+ </button>
+
+ <!-- Star Toggle -->
+ <button @click="bulkToggleHighlight()"
+ class="px-3 py-2 text-sm bg-[var(--bg-tertiary)] hover:bg-[var(--bg-input)] rounded-lg transition-colors flex items-center gap-2"
+ title="Toggle highlight">
+ <i class="fas fa-star text-amber-500"></i>
+ <span class="hidden sm:inline">Star</span>
+ </button>
+
+ <!-- Reprocess -->
+ <button @click="openBulkReprocessModal"
+ class="px-3 py-2 text-sm bg-[var(--bg-tertiary)] hover:bg-[var(--bg-input)] rounded-lg transition-colors flex items-center gap-2"
+ title="Reprocess transcription or summary">
+ <i class="fas fa-redo text-[var(--text-muted)]"></i>
+ <span class="hidden sm:inline">Reprocess</span>
+ </button>
+
+ <!-- Delete -->
+ <button @click="openBulkDeleteModal"
+ class="px-3 py-2 text-sm bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors flex items-center gap-2"
+ title="Delete selected recordings">
+ <i class="fas fa-trash"></i>
+ <span class="hidden sm:inline">Delete</span>
+ </button>
+
+ <!-- Close selection mode -->
+ <button @click="exitSelectionMode"
+ class="px-2 py-2 text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] rounded-lg transition-colors ml-2"
+ title="Exit selection mode">
+ <i class="fas fa-times"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+
+ <!-- Loading overlay -->
+ <div v-if="bulkActionInProgress"
+ class="absolute inset-0 bg-[var(--bg-secondary)] bg-opacity-80 flex items-center justify-center">
+ <div class="flex items-center gap-3">
+ <i class="fas fa-spinner fa-spin text-lg text-[var(--text-accent)]"></i>
+ <span class="text-sm text-[var(--text-secondary)]">Processing...</span>
+ </div>
+ </div>
+ </div>
+</transition>
diff --git a/templates/modals/bulk-delete-modal.html b/templates/modals/bulk-delete-modal.html
new file mode 100644
index 00000000..1731f4c6
--- /dev/null
+++ b/templates/modals/bulk-delete-modal.html
@@ -0,0 +1,48 @@
+<!-- Bulk Delete Confirmation Modal -->
+<div v-if="showBulkDeleteModal" @click.self="closeBulkDeleteModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50 p-4 backdrop-blur-sm">
+ <div class="bg-[var(--bg-secondary)] rounded-lg shadow-xl w-full max-w-md">
+ <div class="p-6">
+ <div class="flex items-center justify-between mb-4">
+ <div class="flex items-center gap-4">
+ <div class="w-12 h-12 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center">
+ <i class="fas fa-exclamation-triangle text-xl text-red-600 dark:text-red-400"></i>
+ </div>
+ <div>
+ <h3 class="text-lg font-semibold text-[var(--text-primary)]">Delete ${ selectedCount } Recording${ selectedCount !== 1 ? 's' : '' }</h3>
+ <p class="text-sm text-[var(--text-muted)]">This action cannot be undone</p>
+ </div>
+ </div>
+ <button @click="closeBulkDeleteModal" class="text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors">
+ <i class="fas fa-times text-xl"></i>
+ </button>
+ </div>
+
+ <div class="bg-[var(--bg-tertiary)] rounded-lg p-4 mb-6">
+ <p class="text-sm text-[var(--text-secondary)] mb-3">
+ You are about to permanently delete:
+ </p>
+ <ul class="space-y-1 max-h-32 overflow-y-auto">
+ <li v-for="recording in selectedRecordings.slice(0, 5)" :key="recording.id" class="text-sm text-[var(--text-primary)] flex items-center gap-2">
+ <i class="fas fa-file-audio text-[var(--text-muted)] text-xs"></i>
+ <span class="truncate">${ recording.title || 'Untitled' }</span>
+ </li>
+ <li v-if="selectedRecordings.length > 5" class="text-sm text-[var(--text-muted)] italic">
+ ...and ${ selectedRecordings.length - 5 } more
+ </li>
+ </ul>
+ </div>
+
+ <div class="flex justify-end gap-3">
+ <button @click="closeBulkDeleteModal"
+ class="px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] rounded-lg transition-colors">
+ Cancel
+ </button>
+ <button @click="executeBulkDelete"
+ class="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors flex items-center gap-2">
+ <i class="fas fa-trash"></i>
+ Delete All
+ </button>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/templates/modals/bulk-reprocess-modal.html b/templates/modals/bulk-reprocess-modal.html
new file mode 100644
index 00000000..0b6b9ffe
--- /dev/null
+++ b/templates/modals/bulk-reprocess-modal.html
@@ -0,0 +1,89 @@
+<!-- Bulk Reprocess Modal -->
+<div v-if="showBulkReprocessModal" @click.self="closeBulkReprocessModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50 p-4 backdrop-blur-sm">
+ <div class="bg-[var(--bg-secondary)] rounded-xl shadow-2xl w-full max-w-md">
+ <div class="p-6 border-b border-[var(--border-primary)]">
+ <div class="flex items-center justify-between">
+ <div class="flex items-center gap-3">
+ <div class="w-10 h-10 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center">
+ <i class="fas fa-sync-alt text-white"></i>
+ </div>
+ <div>
+ <h3 class="text-lg font-semibold text-[var(--text-primary)]">Bulk Reprocess</h3>
+ <p class="text-sm text-[var(--text-muted)]">${ selectedCount } recording${ selectedCount !== 1 ? 's' : '' } selected</p>
+ </div>
+ </div>
+ <button @click="closeBulkReprocessModal" class="text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors">
+ <i class="fas fa-times text-xl"></i>
+ </button>
+ </div>
+ </div>
+
+ <div class="p-6">
+ <!-- Reprocess Type Selection -->
+ <div class="mb-6">
+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-3">What do you want to reprocess?</label>
+ <div class="space-y-2">
+ <label class="flex items-start gap-3 p-3 rounded-lg border border-[var(--border-secondary)] cursor-pointer hover:bg-[var(--bg-tertiary)] transition-colors"
+ :class="{ 'border-[var(--border-accent)] bg-[var(--bg-accent)]': bulkReprocessType === 'summary' }">
+ <input type="radio" v-model="bulkReprocessType" value="summary" class="mt-1">
+ <div>
+ <span class="font-medium text-[var(--text-primary)]">Summary Only</span>
+ <p class="text-sm text-[var(--text-muted)] mt-0.5">
+ Regenerate title and summary from existing transcription. Faster option.
+ </p>
+ </div>
+ </label>
+ <label class="flex items-start gap-3 p-3 rounded-lg border border-[var(--border-secondary)] cursor-pointer hover:bg-[var(--bg-tertiary)] transition-colors"
+ :class="{ 'border-[var(--border-accent)] bg-[var(--bg-accent)]': bulkReprocessType === 'transcription' }">
+ <input type="radio" v-model="bulkReprocessType" value="transcription" class="mt-1">
+ <div>
+ <span class="font-medium text-[var(--text-primary)]">Full Transcription</span>
+ <p class="text-sm text-[var(--text-muted)] mt-0.5">
+ Re-transcribe audio and regenerate everything. Takes longer.
+ </p>
+ </div>
+ </label>
+ </div>
+ </div>
+
+ <!-- Warning -->
+ <div class="p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg mb-6">
+ <div class="flex items-start gap-2">
+ <i class="fas fa-exclamation-triangle text-amber-600 dark:text-amber-400 mt-0.5"></i>
+ <div class="text-sm">
+ <p class="font-medium text-amber-800 dark:text-amber-200">Note</p>
+ <p class="text-amber-700 dark:text-amber-300 mt-0.5" v-if="bulkReprocessType === 'summary'">
+ This will overwrite any manual edits to titles and summaries.
+ </p>
+ <p class="text-amber-700 dark:text-amber-300 mt-0.5" v-else>
+ This will overwrite all transcriptions, titles, and summaries. Manual edits will be lost.
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <!-- Recording count info -->
+ <div class="text-sm text-[var(--text-muted)] mb-4">
+ <i class="fas fa-info-circle mr-1"></i>
+ <span v-if="bulkReprocessType === 'summary'">
+ ${ selectedCount } recording${ selectedCount !== 1 ? 's' : '' } will be queued for summary regeneration.
+ </span>
+ <span v-else>
+ ${ selectedCount } recording${ selectedCount !== 1 ? 's' : '' } will be queued for full reprocessing.
+ </span>
+ </div>
+ </div>
+
+ <div class="p-6 border-t border-[var(--border-primary)] flex justify-end gap-3">
+ <button @click="closeBulkReprocessModal"
+ class="px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] rounded-lg transition-colors">
+ Cancel
+ </button>
+ <button @click="executeBulkReprocess"
+ class="px-4 py-2 bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white rounded-lg transition-colors flex items-center gap-2">
+ <i class="fas fa-sync-alt"></i>
+ Start Reprocessing
+ </button>
+ </div>
+ </div>
+</div>
diff --git a/templates/modals/bulk-tag-modal.html b/templates/modals/bulk-tag-modal.html
new file mode 100644
index 00000000..fa73b456
--- /dev/null
+++ b/templates/modals/bulk-tag-modal.html
@@ -0,0 +1,101 @@
+<!-- Bulk Tag Modal -->
+<div v-if="showBulkTagModal" @click.self="closeBulkTagModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50 p-4 backdrop-blur-sm">
+ <div class="bg-[var(--bg-secondary)] rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col">
+ <div class="p-6 border-b border-[var(--border-primary)] flex-shrink-0">
+ <div class="flex items-center justify-between">
+ <div class="flex items-center gap-3">
+ <div class="w-10 h-10 bg-[var(--bg-accent)] rounded-full flex items-center justify-center">
+ <i class="fas fa-tags text-[var(--text-accent)]"></i>
+ </div>
+ <div>
+ <h3 class="text-lg font-semibold text-[var(--text-primary)]">Bulk Tag Update</h3>
+ <p class="text-sm text-[var(--text-muted)]">${ selectedCount } recording${ selectedCount !== 1 ? 's' : '' } selected</p>
+ </div>
+ </div>
+ <button @click="closeBulkTagModal" class="text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors">
+ <i class="fas fa-times text-xl"></i>
+ </button>
+ </div>
+ </div>
+
+ <div class="p-6 overflow-y-auto flex-1">
+ <!-- Action Toggle -->
+ <div class="flex rounded-lg bg-[var(--bg-tertiary)] p-1 mb-4">
+ <button @click="bulkTagAction = 'add'"
+ :class="[
+ 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-colors',
+ bulkTagAction === 'add'
+ ? 'bg-[var(--bg-button)] text-[var(--text-button)]'
+ : 'text-[var(--text-muted)] hover:text-[var(--text-primary)]'
+ ]">
+ <i class="fas fa-plus mr-2"></i>Add Tag
+ </button>
+ <button @click="bulkTagAction = 'remove'"
+ :class="[
+ 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-colors',
+ bulkTagAction === 'remove'
+ ? 'bg-[var(--bg-button)] text-[var(--text-button)]'
+ : 'text-[var(--text-muted)] hover:text-[var(--text-primary)]'
+ ]">
+ <i class="fas fa-minus mr-2"></i>Remove Tag
+ </button>
+ </div>
+
+ <!-- Tag Selection -->
+ <div>
+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-2">
+ Select a tag to ${ bulkTagAction }
+ </label>
+ <div class="max-h-64 overflow-y-auto space-y-2 border border-[var(--border-secondary)] rounded-lg p-3 bg-[var(--bg-input)]">
+ <button v-for="tag in availableTags" :key="tag.id"
+ @click="bulkTagSelectedId = tag.id"
+ :class="[
+ 'w-full flex items-center justify-between px-3 py-2 rounded-lg transition-colors',
+ bulkTagSelectedId == tag.id
+ ? 'bg-[var(--bg-accent)] ring-2 ring-[var(--border-accent)]'
+ : 'hover:bg-[var(--bg-tertiary)]'
+ ]">
+ <div class="flex items-center gap-2">
+ <span class="w-3 h-3 rounded-full flex-shrink-0" :style="{ backgroundColor: tag.color }"></span>
+ <span class="text-sm text-[var(--text-primary)]">${ tag.name }</span>
+ <i v-if="tag.group_id" class="fas fa-users text-xs text-[var(--text-muted)]" title="Group tag"></i>
+ </div>
+ <i v-if="bulkTagSelectedId == tag.id" class="fas fa-check text-[var(--text-accent)]"></i>
+ </button>
+ <p v-if="availableTags.length === 0" class="text-sm text-[var(--text-muted)] text-center py-4">
+ No tags available. Create tags in settings.
+ </p>
+ </div>
+ </div>
+
+ <!-- Info message -->
+ <div class="mt-4 p-3 bg-[var(--bg-tertiary)] rounded-lg text-sm text-[var(--text-muted)]">
+ <i class="fas fa-info-circle mr-2"></i>
+ <span v-if="bulkTagAction === 'add'">
+ The selected tag will be added to all ${ selectedCount } recording${ selectedCount !== 1 ? 's' : '' }.
+ </span>
+ <span v-else>
+ The selected tag will be removed from all ${ selectedCount } recording${ selectedCount !== 1 ? 's' : '' } that have it.
+ </span>
+ </div>
+ </div>
+
+ <div class="p-6 border-t border-[var(--border-primary)] flex justify-end gap-3 flex-shrink-0">
+ <button @click="closeBulkTagModal"
+ class="px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] rounded-lg transition-colors">
+ Cancel
+ </button>
+ <button @click="executeBulkTag"
+ :disabled="!bulkTagSelectedId"
+ :class="[
+ 'px-4 py-2 rounded-lg transition-colors flex items-center gap-2',
+ bulkTagSelectedId
+ ? 'bg-[var(--bg-button)] text-[var(--text-button)] hover:bg-[var(--bg-button-hover)]'
+ : 'bg-[var(--bg-tertiary)] text-[var(--text-muted)] cursor-not-allowed'
+ ]">
+ <i :class="['fas', bulkTagAction === 'add' ? 'fa-plus' : 'fa-minus']"></i>
+ ${ bulkTagAction === 'add' ? 'Add' : 'Remove' } Tag
+ </button>
+ </div>
+ </div>
+</div>