Skip to content

Commit

Permalink
Flat deep dir hierarchy.
Browse files Browse the repository at this point in the history
  • Loading branch information
terrakok committed Jan 7, 2022
1 parent 9a69c90 commit 182a5e5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/jsMain/kotlin/org/jetbrains/webwiz/content/WizardSection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,23 @@ private fun fileTree(
else Text(name)
}
} else {
var flattenName = name
var dir: Map<String, Any?> = content
while (dir.entries.size == 1 && dir.entries.first().value is Map<*, *>) {
flattenName += "." + dir.entries.first().key
dir = dir.entries.first().value as Map<String, Any?>
}

Li {
val id = "level-$level-$name-${Random.nextFloat()}"
val id = "level-$level-$flattenName-${Random.nextFloat()}"
Input(InputType.Checkbox) { id(id) }
Label(forId = id, attrs = {
style {
cursor("pointer")
title(flattenName)
}
}) { Text(name) }
fileTree(level + 1, content, selectedFilePath, onClick)
}) { Text(flattenName) }
fileTree(level + 1, dir, selectedFilePath, onClick)
}
}
}
Expand Down

0 comments on commit 182a5e5

Please sign in to comment.