ux: admin/shared: don't show form on the side of the tree from the beginning, as new user may miss the connection with the home-folder – better let them click it, first

Massimo Melina committed Sep 28, 2025 at 19:50 UTC 4650a109bbc61b157bb4cce83c26ff9156e816b2
1 file changed +4 -4
admin/src/VfsPage.ts
+4 -4
@@ -39,11 +39,10 @@ export default function VfsPage({ setTitleSide }: PageProps) {
39 ret.unshift(b)
40 return ret
41 }, [status, config])
42 - const single = selectedFiles?.length < 2 && (selectedFiles[0] as VfsNode || vfs)
42 const accountsApi = useApiEx<{ list: Account[] }>('get_accounts') // load accounts once and for all, or !isSideBreakpoint will cause a call for each selection
43 const accounts = useMemo(() => _.sortBy(accountsApi?.data?.list, 'username'), [accountsApi.data])
44
46 - // this will take care of closing the dialog, for user's convenience, after "cut" button is pressed
45 + // this will take care of closing the dialog, for the user's convenience, after "cut" button is pressed
46 const closeDialogRef = useRef(_.noop)
47 useEffect(() => {
48 if (movingFile === selectedFiles[0]?.id)
@@ -68,7 +67,8 @@ export default function VfsPage({ setTitleSide }: PageProps) {
67 hintElement,
68 ), [hintElement]))
69
71 - const sideContent = accountsApi.element || !vfs ? null
70 + const single = selectedFiles?.length < 2 && selectedFiles[0] as VfsNode
71 + const sideContent = accountsApi.element || !vfs || !selectedFiles.length ? null
72 : single ? h(FileForm, {
73 key: single.id,
74 isSideBreakpoint,
@@ -76,7 +76,7 @@ export default function VfsPage({ setTitleSide }: PageProps) {
76 statusApi,
77 saved: () => closeDialogRef.current(),
78 accounts: accounts ?? [],
79 - file: single // it's actually Snapshot<VfsNode> but it's easier this way
79 + file: single
80 })
81 : h(Fragment, {},
82 h(Flex, {},