fix: admin/fs: "add" browsing treats files as folders when double-clicking

Massimo Melina committed Feb 10, 2022 at 19:06 UTC 29f8f6f378682e360ed0416e082e8ca0396d78e0
3 files changed +13 -7
admin/package-lock.json
+7 -4
@@ -1,12 +1,12 @@
1 {
2 "name": "admin",
3 - "version": "0.9.0",
3 + "version": "0.10.0",
4 "lockfileVersion": 2,
5 "requires": true,
6 "packages": {
7 "": {
8 "name": "admin",
9 - "version": "0.9.0",
9 + "version": "0.10.0",
10 "dependencies": {
11 "@emotion/react": "^11.7.1",
12 "@emotion/styled": "^11.6.0",
@@ -23,7 +23,6 @@
23 "react-dom": "^17.0.2",
24 "react-router-dom": "^6.2.1",
25 "tssrp6a": "^3.0.0",
26 - "typescript": "^4.5.5",
26 "valtio": "^1.2.9",
27 "web-vitals": "^2.1.4"
28 },
@@ -16900,6 +16899,8 @@
16899 "version": "4.5.5",
16900 "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
16901 "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
16902 + "dev": true,
16903 + "peer": true,
16904 "bin": {
16905 "tsc": "bin/tsc",
16906 "tsserver": "bin/tsserver"
@@ -30477,7 +30478,9 @@
30478 "typescript": {
30479 "version": "4.5.5",
30480 "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
30480 - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA=="
30481 + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
30482 + "dev": true,
30483 + "peer": true
30484 },
30485 "unbox-primitive": {
30486 "version": "1.0.1",
admin/package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "admin",
3 - "version": "0.9.0",
3 + "version": "0.10.0",
4 "private": true,
5 "proxy": "http://localhost:63636",
6 "scripts": {
admin/src/FilePicker.ts
+5 -2
@@ -46,6 +46,7 @@ export default function FilePicker({ onSelect }: { onSelect:(v:string[])=>void }
46 if (loading)
47 return spinner()
48 const pathDelimiter = /[:\\]/.test(cwd) ? '\\' : '/'
49 + const cwdPostfixed = enforceFinal(pathDelimiter, cwd)
50 return h(Box, { display: 'flex', flexDirection: 'column', gap: 2 },
51 h(Box, { display:'flex', gap: 1 },
52 h(Button, {
@@ -53,7 +54,6 @@ export default function FilePicker({ onSelect }: { onSelect:(v:string[])=>void }
54 disabled: !sel.length,
55 sx: { minWidth: 'max-content' },
56 onClick() {
56 - const cwdPostfixed = enforceFinal(pathDelimiter, cwd)
57 onSelect(sel.map(x => cwdPostfixed + x))
58 }
59 }, `Select (${sel.length})`),
@@ -95,7 +95,10 @@ export default function FilePicker({ onSelect }: { onSelect:(v:string[])=>void }
95 setSel(removed.length < sel.length ? removed : [...sel, id])
96 },
97 onDoubleClick(){
98 - setCwd( enforceFinal(pathDelimiter, cwd) + it.n )
98 + if (it.k === 'd')
99 + setCwd( cwdPostfixed + it.n )
100 + else
101 + onSelect([ cwdPostfixed + it.n ])
102 }
103 },
104 h(Checkbox, { checked: sel.includes(it.n) }),