1
1
import * as React from 'react'
2
2
import { useQuery } from '@apollo/react-hooks'
3
- import * as T from 'typings/graphql'
4
3
5
4
import Stage from 'components/Stage'
6
5
import ErrorView from 'components/Error'
7
6
import queryStage from './queryStage'
8
7
9
8
interface PageProps {
10
- stage : T . Stage
11
9
send ( action : string ) : void
12
10
}
13
11
14
- export const StageSummaryPage = ( { stage, send } : PageProps ) => {
15
- if ( ! stage ) {
16
- // may throw if no stage is supplied on restart
17
- throw new Error ( 'No stage provided' )
18
- }
19
-
20
- const stageComplete = stage . status === 'COMPLETE'
21
-
22
- const onContinue = ( ) : void => {
23
- send ( 'STAGE_NEXT' )
24
- }
25
-
26
- return < Stage stage = { stage } onContinue = { onContinue } complete = { stageComplete } />
27
- }
28
-
29
- const StageSummaryPageContainer = props => {
12
+ const StageSummaryPageContainer = ( props : PageProps ) => {
30
13
const { loading, error, data } = useQuery ( queryStage , {
31
14
variables : {
32
15
tutorialId : '1' ,
33
- version : '1.0 .0' ,
16
+ version : '0.1 .0' ,
34
17
stageId : '1' ,
35
18
} ,
36
19
} )
@@ -42,9 +25,15 @@ const StageSummaryPageContainer = props => {
42
25
return < ErrorView error = { error } />
43
26
}
44
27
28
+ console . log ( 'data' , data )
29
+
45
30
const { stage } = data . tutorial . version
46
31
47
- return < StageSummaryPage stage = { stage } send = { props . send } />
32
+ const onContinue = ( ) : void => {
33
+ props . send ( 'STAGE_NEXT' )
34
+ }
35
+
36
+ return < Stage stage = { stage } onContinue = { onContinue } />
48
37
}
49
38
50
39
export default StageSummaryPageContainer
0 commit comments