@@ -2,7 +2,7 @@ import { getFilenameFriendlyFormattedDateTime } from 'common/fmt';
22import { shell } from 'electron' ;
33import { observer } from 'mobx-react-lite' ;
44import SysPath from 'path' ;
5- import React , { useEffect , useState } from 'react' ;
5+ import React , { useState } from 'react' ;
66import { AppToaster } from 'src/frontend/components/Toaster' ;
77import { RendererMessenger } from 'src/ipc/renderer' ;
88import { Button , ButtonGroup , IconSet } from 'widgets' ;
@@ -14,23 +14,20 @@ import FileInput from 'src/frontend/components/FileInput';
1414
1515export const ImportExport = observer ( ( ) => {
1616 const rootStore = useStore ( ) ;
17- const { fileStore, tagStore, exifTool } = rootStore ;
17+ const backupDir = rootStore . backupDirectory ;
18+
1819 const [ isConfirmingMetadataExport , setConfirmingMetadataExport ] = useState ( false ) ;
1920 const [ isConfirmingFileImport , setConfirmingFileImport ] = useState < {
2021 path : string ;
2122 info : string ;
2223 } > ( ) ;
23- const [ backupDir , setBackupDir ] = useState ( '' ) ;
24- useEffect ( ( ) => {
25- RendererMessenger . getDefaultBackupDirectory ( ) . then ( setBackupDir ) ;
26- } , [ ] ) ;
2724
2825 const handleChooseImportDir = async ( [ path ] : [ string , ...string [ ] ] ) => {
2926 try {
3027 const [ numTags , numFiles ] = await rootStore . peekDatabaseFile ( path ) ;
3128 setConfirmingFileImport ( {
3229 path,
33- info : `Backup contains ${ numTags } tags (currently ${ tagStore . count } ) and ${ numFiles } images (currently ${ fileStore . numTotalFiles } ).` ,
30+ info : `Backup contains ${ numTags } tags (currently ${ rootStore . tagStore . count } ) and ${ numFiles } images (currently ${ rootStore . fileStore . numTotalFiles } ).` ,
3431 } ) ;
3532 } catch ( e ) {
3633 console . log ( e ) ;
@@ -72,31 +69,28 @@ export const ImportExport = observer(() => {
7269 The separator is used to format the tags metadata. For example a file with the assigned tags
7370 Food, Fruit and Apple will be formatted with the currently selected separator as{ ' ' }
7471 < pre style = { { display : 'inline' } } >
75- { [ 'Food' , 'Fruit' , 'Apple' ] . join ( exifTool . hierarchicalSeparator ) }
72+ { [ 'Food' , 'Fruit' , 'Apple' ] . join ( rootStore . exifTool . hierarchicalSeparator ) }
7673 </ pre >
7774 .
7875 </ Callout >
7976 < div className = "vstack" >
8077 < label >
8178 Hierarchical separator
8279 < select
83- value = { exifTool . hierarchicalSeparator }
84- onChange = { ( e ) => exifTool . setHierarchicalSeparator ( e . target . value ) }
80+ value = { rootStore . exifTool . hierarchicalSeparator }
81+ onChange = { ( e ) => rootStore . exifTool . setHierarchicalSeparator ( e . target . value ) }
8582 >
8683 < option value = "|" > |</ option >
8784 < option value = "/" > /</ option >
8885 < option value = "\" > \</ option >
8986 < option value = ":" > :</ option >
9087 </ select >
9188 </ label >
92- { /* TODO: adobe bridge has option to read with multiple separators */ }
93-
9489 < ButtonGroup >
9590 < Button
9691 text = "Import tags from file metadata"
9792 onClick = { ( ) => {
98- fileStore . readTagsFromFiles ( ) ;
99- // fileStore.readFacesAnnotationsFromFiles();
93+ rootStore . fileStore . readTagsFromFiles ( ) ;
10094 } }
10195 styling = "outlined"
10296 />
@@ -111,7 +105,7 @@ export const ImportExport = observer(() => {
111105 primaryButtonText = "Export"
112106 onClick = { ( button ) => {
113107 if ( button === DialogButton . PrimaryButton ) {
114- fileStore . writeTagsToFiles ( ) ;
108+ rootStore . fileStore . writeTagsToFiles ( ) ;
115109 }
116110 setConfirmingMetadataExport ( false ) ;
117111 } }
0 commit comments