@@ -4,7 +4,6 @@ import * as T from 'typings/graphql'
44import * as CR from 'typings'
55
66import queryTutorials from './queryTutorials'
7- import { editorDispatch } from '../../services/vscode'
87import LoadingPage from '../LoadingPage'
98import ErrorView from '../../components/Error'
109import TutorialList from './TutorialList'
@@ -16,26 +15,35 @@ interface Props {
1615
1716export const NewPage = ( props : Props ) => (
1817 < div >
19- < h2 > Start a new Project </ h2 >
18+ < h2 > Start a New Tutorial </ h2 >
2019 < TutorialList tutorialList = { props . tutorialList } onNew = { props . onNew } />
2120 </ div >
2221)
2322
2423const Loading = ( ) => < LoadingPage text = "Loading tutorials" />
2524
26- const NewPageContainer = ( ) => {
25+ interface ContainerProps {
26+ send ?( action : CR . Action ) : void
27+ }
28+
29+ const NewPageContainer = ( props : ContainerProps ) => {
30+ console . log ( 'props' , props )
2731 const { data, loading, error } = useQuery ( queryTutorials )
2832 if ( loading ) {
2933 return < Loading />
3034 }
3135
3236 if ( error ) {
3337 return < ErrorView error = { error } />
34- }
38+ }
39+
40+ // TODO: cleanup React.cloneElement props issue
41+ const sendFallback = ( action : CR . Action ) => console . log ( 'Cannot send' )
42+ const send = props . send || sendFallback
3543
3644 return (
3745 < React . Suspense fallback = { Loading } >
38- < NewPage onNew = { editorDispatch } tutorialList = { data . tutorials } />
46+ < NewPage onNew = { send } tutorialList = { data . tutorials } />
3947 </ React . Suspense >
4048 )
4149}
0 commit comments