Update styling of FileTreeView

This commit is contained in:
grimsi
2025-04-05 22:06:33 +02:00
parent e45c7dca6d
commit 9babedeba4
2 changed files with 6 additions and 7 deletions
@@ -117,7 +117,7 @@ export default function FileTreeView({onPathChange}: { onPathChange: (file: stri
}
return (
<div className="flex flex-col gap-4 bg-contrast">
<div className="flex flex-col flex-1 w-full gap-4 overflow-hidden">
<TreeView
data={flattenedFileTree}
aria-label="directory tree"
@@ -133,7 +133,7 @@ export default function FileTreeView({onPathChange}: { onPathChange: (file: stri
<IconContext.Provider value={{size: 32, weight: "regular"}}>
<div {...getNodeProps()}
className={`
flex flex-row items-center gap-2
flex flex-row items-center gap-2 w-full
rounded-md cursor-pointer
${isSelected ? 'bg-primary' : 'hover:bg-primary/20'}`
}
@@ -144,7 +144,6 @@ export default function FileTreeView({onPathChange}: { onPathChange: (file: stri
</IconContext.Provider>
)}
/>
<pre>{JSON.stringify(flattenedFileTree, null, 2)}</pre>
</div>
);
}
@@ -23,7 +23,7 @@ class FilesystemService {
if (path == null || path.isEmpty()) {
val roots = FileSystems.getDefault().rootDirectories.toList()
if (roots.size > 1) return roots.map {
if (getHostOperatingSystem() == OperatingSystemType.WINDOWS) return roots.map {
FileDto(
it.root.toString(),
if (it.isDirectory()) FileType.DIRECTORY else FileType.FILE,
@@ -31,7 +31,7 @@ class FilesystemService {
)
}
// If there is only one root, return its contents
// UNIX file systems only have one root, so return its contents directly
return safeReadDirectoryContents(roots.first().toString())
}
@@ -66,8 +66,8 @@ class FilesystemService {
Path(path).toFile().listFiles()
.filter { !it.isHidden }
.map { FileDto(it.name, if (it.isDirectory) FileType.DIRECTORY else FileType.FILE, it.hashCode()) }
} catch (e: Exception) {
log.error(e) { "Error reading directory contents of $path" }
} catch (_: Exception) {
log.error { "Error reading directory contents of $path" }
emptyList()
}
}