import React , { useContext } from 'react' ; import AnnotationOperation from '@labelbee/lb-components' ; import '@labelbee/lb-components/dist/index.css' ; import { EIpcEvent } from '../constant/event' ; import { AnnotationContext } from '../store' ; import i18n from '@/i18n' ; const electron = window . require && window . require ( 'electron' ) ; const Annotation = ( props ) => { const { dispatch , state : { currentProjectInfo } , } = useContext ( AnnotationContext ) ; const { fileList , step , stepList } = props ; const onSubmit = ( data , submitType , i ) => { console . log ( 'submitData1' , data , submitType , i ) ; if ( electron ) { electron . ipcRenderer . send ( EIpcEvent . SaveResult , data , currentProjectInfo ?. path , currentProjectInfo ?. resultPath ) ; } } ; const goBack = ( imgList ) => { dispatch ( { type : 'UPDATE_CURRENT_PROJECTINFO' , payload : { projectInfo : undefined , } , } ) ; dispatch ( { type : 'UPDATE_FILE_LIST' , payload : { fileList : [ ] , } , } ) ; } ; return ( < div > < AnnotationOperation headerName = { currentProjectInfo ?. name } onSubmit = { onSubmit } imgList = { fileList . map ( ( file ) => ( { ... file , url : 'file:///' + file . url , } ) ) } goBack = { goBack } stepList = { stepList } step = { step } defaultLang = { i18n . language } / > < /div>); } ; export default Annotation ;