mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 16:20:04 +00:00
Update styling of FileTreeView
This commit is contained in:
@@ -117,7 +117,7 @@ export default function FileTreeView({onPathChange}: { onPathChange: (file: stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-4 bg-contrast">
|
<div className="flex flex-col flex-1 w-full gap-4 overflow-hidden">
|
||||||
<TreeView
|
<TreeView
|
||||||
data={flattenedFileTree}
|
data={flattenedFileTree}
|
||||||
aria-label="directory tree"
|
aria-label="directory tree"
|
||||||
@@ -133,7 +133,7 @@ export default function FileTreeView({onPathChange}: { onPathChange: (file: stri
|
|||||||
<IconContext.Provider value={{size: 32, weight: "regular"}}>
|
<IconContext.Provider value={{size: 32, weight: "regular"}}>
|
||||||
<div {...getNodeProps()}
|
<div {...getNodeProps()}
|
||||||
className={`
|
className={`
|
||||||
flex flex-row items-center gap-2
|
flex flex-row items-center gap-2 w-full
|
||||||
rounded-md cursor-pointer
|
rounded-md cursor-pointer
|
||||||
${isSelected ? 'bg-primary' : 'hover:bg-primary/20'}`
|
${isSelected ? 'bg-primary' : 'hover:bg-primary/20'}`
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,6 @@ export default function FileTreeView({onPathChange}: { onPathChange: (file: stri
|
|||||||
</IconContext.Provider>
|
</IconContext.Provider>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<pre>{JSON.stringify(flattenedFileTree, null, 2)}</pre>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class FilesystemService {
|
|||||||
if (path == null || path.isEmpty()) {
|
if (path == null || path.isEmpty()) {
|
||||||
val roots = FileSystems.getDefault().rootDirectories.toList()
|
val roots = FileSystems.getDefault().rootDirectories.toList()
|
||||||
|
|
||||||
if (roots.size > 1) return roots.map {
|
if (getHostOperatingSystem() == OperatingSystemType.WINDOWS) return roots.map {
|
||||||
FileDto(
|
FileDto(
|
||||||
it.root.toString(),
|
it.root.toString(),
|
||||||
if (it.isDirectory()) FileType.DIRECTORY else FileType.FILE,
|
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())
|
return safeReadDirectoryContents(roots.first().toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ class FilesystemService {
|
|||||||
Path(path).toFile().listFiles()
|
Path(path).toFile().listFiles()
|
||||||
.filter { !it.isHidden }
|
.filter { !it.isHidden }
|
||||||
.map { FileDto(it.name, if (it.isDirectory) FileType.DIRECTORY else FileType.FILE, it.hashCode()) }
|
.map { FileDto(it.name, if (it.isDirectory) FileType.DIRECTORY else FileType.FILE, it.hashCode()) }
|
||||||
} catch (e: Exception) {
|
} catch (_: Exception) {
|
||||||
log.error(e) { "Error reading directory contents of $path" }
|
log.error { "Error reading directory contents of $path" }
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user