11import { useQuery } from '@apollo/react-hooks'
22import * as React from 'react'
33import * as CR from 'typings'
4- import * as G from 'typings/graphql '
4+ import * as TT from 'typings/tutorial '
55import ErrorView from '../../components/Error'
6- import queryTutorial from '../../services/apollo/queries/tutorial'
76import OverviewPage from './OverviewPage'
87import LoadingPage from '../Loading'
98
@@ -13,7 +12,7 @@ interface PageProps {
1312}
1413
1514interface TutorialData {
16- tutorial :G . Tutorial
15+ tutorial :TT . Tutorial
1716}
1817
1918interface TutorialDataVariables {
@@ -27,51 +26,36 @@ const Overview = (props: PageProps) => {
2726if ( ! tutorial ) {
2827throw new Error ( 'Tutorial not found in summary page' )
2928}
30- const { loading, error, data} = useQuery < TutorialData , TutorialDataVariables > ( queryTutorial , {
31- fetchPolicy :'no-cache' , // to ensure latest
32- variables :{
33- tutorialId :tutorial . id ,
34- // version: tutorial.version.version, // TODO: re-enable latest
35- } ,
36- } )
3729
38- if ( loading ) {
39- return < LoadingPage text = "Loading Summary..." context = { props . context } />
40- }
41-
42- if ( error ) {
43- return < ErrorView error = { error } />
44- }
45-
46- if ( ! data ) {
47- return null
48- }
49-
50- const onNext = ( ) =>
51- props . send ( {
52- type :'TUTORIAL_START' ,
53- payload :{
54- tutorial :data . tutorial ,
55- } ,
56- } )
57-
58- const onBack = ( ) => props . send ( { type :'BACK' } )
59-
60- const { title, description} = data . tutorial . summary
61- const { createdBy, updatedAt, data :tutorialData } = data . tutorial . version
62- const { levels} = tutorialData
63-
64- return (
65- < OverviewPage
66- title = { title }
67- description = { description }
68- createdBy = { createdBy }
69- updatedAt = { updatedAt }
70- levels = { levels }
71- onNext = { onNext }
72- onBack = { onBack }
73- />
74- )
30+ console . log ( 'todo overview load' )
31+
32+ return < div > Overview Page</ div >
33+
34+ // const onNext = () =>
35+ // props.send({
36+ // type: 'TUTORIAL_START',
37+ // payload: {
38+ // tutorial: data.tutorial,
39+ // },
40+ // })
41+
42+ // const onBack = () => props.send({ type: 'BACK' })
43+
44+ // const { title, description } = data.tutorial.summary
45+ // const { createdBy, updatedAt, data: tutorialData } = data.tutorial.version
46+ // const { levels } = tutorialData
47+
48+ // return (
49+ // <OverviewPage
50+ // title={title}
51+ // description={description}
52+ // createdBy={createdBy}
53+ // updatedAt={updatedAt}
54+ // levels={levels}
55+ // onNext={onNext}
56+ // onBack={onBack}
57+ // />
58+ // )
7559}
7660
7761export default Overview