mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Implemented library rearrangement
This commit is contained in:
1 parent
89c7dade25
commit
7ba71981c8
3 files changed
+149
-15
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user