Fix Directory error and refactor file list
Again, lots of diffs.
The list of directories (which were in fact file nodes, more on this below) were stored into a Map<number, Directory[]>
while it was used as Map<number, Directory>
as pointed out by Axel in !12 (merged).
It wasn't caught by TS because Object.entries
of a Map
object is cast to any
(Directory[]
instead of a Map
which fixes the typing and removes the need for Object.entries
.
I also refactored the file list components:
-
Directory
was renamed toFileNode
as it can represent a directory or a file. Related methods (such aslistDirectory
) were renamed as well -
data
attributes of the file node button were removed. They were used in thehandleOnClick
function to determine the file name and type but this was replaced by a functionnavigateTo
that is dynamically set as prop. -
renderPathTooltip
andiconFromType
were extracted in separate components
Edited by Loic Huder