Portal/rsconcept/frontend/src/features/library/backend/useFolders.tsx

17 lines
504 B
TypeScript
Raw Normal View History

2025-02-12 15:12:59 +03:00
import { FolderTree } from '../models/FolderTree';
import { LocationHead } from '../models/library';
2025-01-23 19:41:31 +03:00
import { useLibrary } from './useLibrary';
export function useFolders() {
const { items } = useLibrary();
const result = new FolderTree();
result.addPath(LocationHead.USER, 0);
result.addPath(LocationHead.COMMON, 0);
result.addPath(LocationHead.LIBRARY, 0);
result.addPath(LocationHead.PROJECTS, 0);
items.forEach(item => result.addPath(item.location));
return { folders: result };
}