feat(playlists): act on the selected rows from the toolbar, and undo either
While rows are selected the toolbar's second row is the band: the count, the last target as one click, Move to, Remove, Clear selection. Both write in one request and undo back to the places; a video the target held before stays there. Delete takes the selection when there is one. A failure puts the rows back ticked. A row's own move goes through the same write, so it undoes too, and the single-row move route and service function are gone. A playlist row drops its grip below a 24rem table: the row menu keeps the moves.
This commit is contained in:
@@ -59,8 +59,14 @@ export function useRowSelection(all: readonly string[], shown: readonly string[]
|
||||
return had;
|
||||
}
|
||||
|
||||
/** Tick these again: an action that took them off and failed. */
|
||||
function select(ids: readonly string[]) {
|
||||
setSelected((now) => new Set([...now, ...ids]));
|
||||
}
|
||||
|
||||
return {
|
||||
shownSelected,
|
||||
hiddenCount: selected.size - shownSelected.length,
|
||||
isSelected: (id: string) => selected.has(id),
|
||||
headerState:
|
||||
shownSelected.length === 0
|
||||
@@ -71,5 +77,6 @@ export function useRowSelection(all: readonly string[], shown: readonly string[]
|
||||
toggle,
|
||||
toggleAllShown,
|
||||
clear,
|
||||
select,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user