import * as React from 'react' ; import { connect } from 'react-redux' ; import { getChapterTo } from '../common' ; import { selectChapter } from '../coursesData' ; import { completeChapter } from '../redux' ; import { SelectedChapter } from '../types' ; import { enablePreview } from './utils' ; interface ExternalProps { readonly selected : SelectedChapter ; } interface Props extends ExternalProps { readonly onTestsPass : ( ) => void ; } const EditorBase = ( { selected , onTestsPass , ... props } ) => { const preview = enablePreview ( selected ) ; return ( < > < /> ) ; } ; export const Editor = connect ( undefined , ( dispatch , { selected } ) => ( { onTestsPass : ( ) => dispatch ( completeChapter ( selected ) ) } ) ) ( EditorBase ) ;