refactor(web): folder view (#11967)

refactor(web): tree view
This commit is contained in:
Jason Rasmussen 2024-08-22 11:38:19 -04:00 committed by GitHub
parent 296bbeb2fc
commit f69ce6ad8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 135 additions and 159 deletions

View file

@ -2,7 +2,9 @@ export interface RecursiveObject {
[key: string]: RecursiveObject;
}
export function buildFolderTree(paths: string[]) {
export const normalizeTreePath = (path: string) => path.replace(/^\//, '').replace(/\/$/, '');
export function buildTree(paths: string[]) {
const root: RecursiveObject = {};
for (const path of paths) {
const parts = path.split('/');