feat(items): delete an item with a swipe right, undoable for 3 seconds

A long swipe right on an item (or "Eliminar" in the desktop context menu)
hides it and shows a toast with "Deshacer". The DELETE is only sent once
the 3 seconds are over, so undoing just cancels it; pending deletions are
flushed with keepalive if the page is closed in the meantime.

The API gets DELETE /api/lists/:listId/items/:itemId, members only, which
publishes item.removed so other members see the item disappear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-10-20 20:40:56 -03:00
parent feb8df14c0
commit eb1f6cb2a9
10 changed files with 412 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ type BoughtItemListProps = {
/** The editing state of each row, owned by the parent so only one row edits at a time. */
editingProps: (itemId: string) => Pick<ItemRowProps, 'editing' | 'onEditingChange'>
onMove: (item: ListItem) => void
onDelete: (item: ListItem) => void
}
/**
@@ -27,6 +28,7 @@ export function BoughtItemList({
savingIds,
editingProps,
onMove,
onDelete,
}: BoughtItemListProps) {
return (
<Collapsible defaultOpen asChild>
@@ -45,6 +47,7 @@ export function BoughtItemList({
isSaving={savingIds.includes(item.id)}
{...editingProps(item.id)}
onMove={() => onMove(item)}
onDelete={() => onDelete(item)}
/>
))}
</ul>