File tree Expand file tree Collapse file tree 4 files changed +9
-22
lines changed
containers/SelectTutorial Expand file tree Collapse file tree 4 files changed +9
-22
lines changed Original file line number Diff line number Diff line change 1- import { ApolloError } from 'apollo-boost'
21import * as React from 'react'
32import { css , jsx } from '@emotion/core'
43import onError from '../../services/sentry/onError'
@@ -14,7 +13,7 @@ const styles = {
1413}
1514
1615interface Props {
17- error ?: ApolloError
16+ error ?: Error
1817}
1918
2019const ErrorView = ( { error } : Props ) => {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as React from 'react'
22import useFetch from '../../services/hooks/useFetch'
33import * as TT from 'typings/tutorial'
44import TutorialOverview from '../../components/TutorialOverview'
5+ import Loading from '../Loading'
56
67interface Props {
78 url : string
@@ -12,13 +13,14 @@ interface Props {
1213const LoadTutorialSummary = ( props : Props ) => {
1314 const { data, error, loading } = useFetch < TT . Tutorial > ( props . url )
1415 if ( loading ) {
15- return < div > Loading...</ div >
16+ return < Loading text = "Loading tutorial summary ..." / >
1617 }
18+ // TODO: improve error handling
1719 if ( error ) {
1820 return < div > { JSON . stringify ( error ) } </ div >
1921 }
2022 if ( ! data ) {
21- return < div > No data returned</ div >
23+ return < div > No data returned for tutorial </ div >
2224 }
2325 const onNext = ( ) => {
2426 props . send ( {
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ const styles = {
1111 padding : '1rem' ,
1212 width : '100%' ,
1313 height : 'auto' ,
14- backgroundColor : 'yellow' ,
1514 } ,
1615}
1716
Original file line number Diff line number Diff line change 11import * as React from 'react'
2- import * as T from 'typings'
3- import * as TT from 'typings/tutorial'
42import SelectTutorialForm from './SelectTutorialForm'
53import LoadTutorialSummary from './LoadTutorialSummary'
64
75const styles = {
86 page : {
7+ position : 'relative' as 'relative' ,
8+ height : 'auto' ,
99 width : '100%' ,
1010 } ,
11- header : {
11+ selectPage : {
1212 padding : '1rem' ,
1313 } ,
1414}
1515
16- interface ContainerProps {
17- send ( action : T . Action ) : void
18- context : T . MachineContext
19- }
20-
21- interface TutorialsData {
22- tutorials : TT . Tutorial [ ]
23- }
24-
2516interface Props {
2617 send : any
2718 context : any
@@ -31,11 +22,7 @@ const SelectTutorialPage = (props: Props) => {
3122 const [ url , setUrl ] = React . useState < string | null > ( null )
3223 return (
3324 < div css = { styles . page } >
34- { ! url && (
35- < div css = { styles . header } >
36- < SelectTutorialForm onUrlChange = { setUrl } />
37- </ div >
38- ) }
25+ { ! url && < SelectTutorialForm onUrlChange = { setUrl } /> }
3926 { url && < LoadTutorialSummary url = { url } send = { props . send } onClear = { ( ) => setUrl ( null ) } /> }
4027 </ div >
4128 )
You can’t perform that action at this time.
0 commit comments