diff --git a/apps/web/messages/en.json b/apps/web/messages/en.json index 981d278..33ca668 100644 --- a/apps/web/messages/en.json +++ b/apps/web/messages/en.json @@ -170,5 +170,14 @@ "list_reorder_handle": "Reorder", "list_edit_item": "Edit item", "list_confirm": "Confirm", - "list_close": "Close" + "list_close": "Close", + "list_select": "Select", + "list_selection_count": "{n} selected", + "list_cancel_selection": "Cancel", + "list_bulk_delete": "Delete", + "list_bulk_move": "Move", + "list_bulk_mark_checked": "Mark checked", + "list_undo_bulk_delete": "Deleted {n} items", + "list_move_title": "Move to list", + "list_move_create_new": "Create new list" } diff --git a/apps/web/messages/es.json b/apps/web/messages/es.json index ad095b2..f55b254 100644 --- a/apps/web/messages/es.json +++ b/apps/web/messages/es.json @@ -170,5 +170,14 @@ "list_reorder_handle": "Reordenar", "list_edit_item": "Editar producto", "list_confirm": "Confirmar", - "list_close": "Cerrar" + "list_close": "Cerrar", + "list_select": "Seleccionar", + "list_selection_count": "{n} seleccionados", + "list_cancel_selection": "Cancelar", + "list_bulk_delete": "Eliminar", + "list_bulk_move": "Mover", + "list_bulk_mark_checked": "Marcar", + "list_undo_bulk_delete": "{n} eliminados", + "list_move_title": "Mover a lista", + "list_move_create_new": "Crear lista nueva" } diff --git a/apps/web/src/lib/stores/lists.ts b/apps/web/src/lib/stores/lists.ts index 9e1b3af..d64cac3 100644 --- a/apps/web/src/lib/stores/lists.ts +++ b/apps/web/src/lib/stores/lists.ts @@ -196,6 +196,27 @@ export async function deleteItem(id: string) { await getSupabase().from('shopping_items').delete().eq('id', id); } +// ── Bulk operations (selection mode) ────────────────────────────────────────── + +export async function bulkDeleteItems(ids: string[]): Promise { + if (!ids.length) return; + await getSupabase().from('shopping_items').delete().in('id', ids); +} + +export async function bulkMoveItems(ids: string[], newListId: string): Promise { + if (!ids.length) return; + await getSupabase().from('shopping_items').update({ list_id: newListId }).in('id', ids); +} + +export async function bulkCheckItems(ids: string[], userId: string): Promise { + if (!ids.length) return; + await getSupabase() + .from('shopping_items') + .update({ is_checked: true, checked_by: userId, checked_at: new Date().toISOString() }) + .in('id', ids) + .eq('is_checked', false); +} + export async function reorderItems(items: Pick[]) { await Promise.all( items.map((item, index) => diff --git a/apps/web/src/routes/(app)/lists/[id]/+page.svelte b/apps/web/src/routes/(app)/lists/[id]/+page.svelte index 949515c..e7c2603 100644 --- a/apps/web/src/routes/(app)/lists/[id]/+page.svelte +++ b/apps/web/src/routes/(app)/lists/[id]/+page.svelte @@ -1,5 +1,6 @@