admin/fs: fake-selection of home

Massimo Melina committed Feb 23, 2024 at 14:59 UTC 97e860ee4f218ef7186d9118677653c5e13d4744
1 file changed +4
admin/src/VfsTree.ts
+4
@@ -51,9 +51,13 @@ export default function VfsTree({ id2node, statusApi }:{ id2node: Map<string, Vf
51 if (!id)
52 debugger
53 const folder = node.type === 'folder'
54 + const ref = useRef<HTMLLIElement | null>()
55 + if (isRoot && ref.current)
56 + ref.current.firstElementChild?.classList.toggle('Mui-selected', !(selectedFiles.length && !_.find(selectedFiles, { id: '/' })))
57 return h(TreeItem, {
58 ref(el: any) { // workaround to permit drag&drop with mui5's tree
59 el?.addEventListener('focusin', (e: any) => e.stopImmediatePropagation())
60 + ref.current = el
61 },
62 label: h(Box, {
63 draggable: !isRoot,