Implemented library rearrangement

This commit is contained in:
patben8 committed 2026-10-06 22:51:34 +02:00
1 parent 89c7dade25
commit 7ba71981c8
3 files changed
+149 -15

No files matched your search

+12
View File
@@ -8,3 +8,15 @@ export function playlistIdsUnder(node: PlaylistNode): string[] {
const here = node.kind === 'folder' ? [] : [node.id]
return [...here, ...(node.children ?? []).flatMap(playlistIdsUnder)]
}
/** The ids of a node and everything nested in it — where a dragged folder
* cannot go. */
export function nodeIdsUnder(node: PlaylistNode): Set<string> {
const ids = new Set<string>()
const walk = (n: PlaylistNode) => {
ids.add(n.id)
n.children.forEach(walk)
}
walk(node)
return ids
}