@@ -14,21 +14,23 @@ import { join } from 'path'
14
14
import { writeFile , prepareDirectory } from '../../lib/electronOnly'
15
15
import { entries } from '../../lib/db/utils'
16
16
import { useRouter } from '../../lib/router'
17
+ import { usePreferences } from '../../lib/preferences'
17
18
18
19
interface ConvertPouchStorageProps {
19
20
storageId : string
20
21
storageName : string
21
- onCancel : ( ) => void
22
+ closeForm : ( ) => void
22
23
}
23
24
24
25
const ConvertPouchStorage = ( {
25
26
storageId,
26
27
storageName,
27
- onCancel ,
28
+ closeForm ,
28
29
} : ConvertPouchStorageProps ) => {
29
30
const [ newStorageName , setNewStorageName ] = useState (
30
31
`${ storageName } - Converted`
31
32
)
33
+ const { setClosed } = usePreferences ( )
32
34
const [ newStorageLocation , setNewStorageLocation ] = useState ( '' )
33
35
const { storageMap, createStorage } = useDb ( )
34
36
const [ errorMessage , setErrorMessage ] = useState < string | null > ( null )
@@ -93,7 +95,7 @@ const ConvertPouchStorage = ({
93
95
type : 'fs' ,
94
96
location : newStorageLocation ,
95
97
} )
96
-
98
+ setClosed ( true )
97
99
push ( `/app/storages/${ newStorage . id } ` )
98
100
} catch ( error ) {
99
101
console . error ( error )
@@ -105,9 +107,10 @@ const ConvertPouchStorage = ({
105
107
newStorageLocation ,
106
108
newStorageName ,
107
109
createStorage ,
110
+ setClosed ,
108
111
push ,
109
112
] )
110
- console . log ( errorMessage )
113
+
111
114
return (
112
115
< >
113
116
< FormBlockquote variant = { errorMessage == null ? 'primary' : 'danger' } >
@@ -131,7 +134,7 @@ const ConvertPouchStorage = ({
131
134
< FormPrimaryButton onClick = { cloneAndConvertStorage } >
132
135
Convert to File System based Storage
133
136
</ FormPrimaryButton >
134
- < FormSecondaryButton onClick = { onCancel } > Cancel</ FormSecondaryButton >
137
+ < FormSecondaryButton onClick = { closeForm } > Cancel</ FormSecondaryButton >
135
138
</ FormGroup >
136
139
</ >
137
140
)
0 commit comments