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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user