fix: admin/fs: should have same message when root is selected and nothing is selected
Massimo Melina committed
Jul 26, 2022 at 11:10 UTC
494c212d8331d55ab2f4c784639482d551a0c75d
1 file changed
+7
-3
admin/src/addFiles.ts
+7
-3
@@ -16,7 +16,8 @@ export default function addFiles() {
16
Content() {
17
const under = getUnder()
18
return h(Fragment, {},
19
- h(Box, { sx:{ typography: 'body1', px: 1, py: 2 } }, "Selected elements will be added to " + (under || '(home)')),
19
+ h(Box, { sx:{ typography: 'body1', px: 1, py: 2 } },
20
+ "Selected elements will be added to virtual path " + (under || '(home)')),
21
h(FilePicker, {
22
async onSelect(sel) {
23
let failed = await Promise.all(sel.map(source =>
@@ -49,7 +50,10 @@ export async function addVirtual() {
50
51
function getUnder() {
52
let f: VfsNode | undefined = state.selectedFiles[0]
52
- if (f && f.type !== 'folder')
53
+ if (!f)
54
+ return ''
55
+ if (f.type !== 'folder')
56
f = f.parent
54
- return f?.id
57
+ const { id } = f!
58
+ return id === '/' ? '' : id
59
}