File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
web-app/src/containers/SelectTutorial Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 11import * as React from 'react'
2+ import { Dialog } from '@alifd/next'
23import useFetch from '../../services/hooks/useFetch'
34import * as TT from 'typings/tutorial'
45import LoadingPage from '../Loading'
56
67interface Props {
78 url : string
89 onLoadSummary ( data : TT . Tutorial ) : void
10+ onReturnToSelection ( ) : void
911}
1012
1113const LoadTutorialSummary = ( props : Props ) => {
1214 const { data, error, loading } = useFetch < TT . Tutorial > ( props . url )
15+ if ( ! data ) {
16+ return (
17+ < Dialog
18+ title = "Tutorial Not Found"
19+ visible = { true }
20+ closeable = { false }
21+ footerActions = { [ 'ok' ] }
22+ onOk = { props . onReturnToSelection }
23+ >
24+ No data returned for tutorial
25+ </ Dialog >
26+ )
27+ }
1328 if ( loading ) {
1429 return < LoadingPage text = "Loading tutorial summary..." />
1530 }
1631 if ( error ) {
1732 console . log ( `Failed to load tutorial summary: ${ error } ` )
1833 return < div > Error loading summary</ div >
1934 }
20- if ( ! data ) {
21- return < div > No data returned for tutorial</ div >
22- }
2335 props . onLoadSummary ( data )
2436 return null
2537}
Original file line number Diff line number Diff line change @@ -58,7 +58,9 @@ const SelectTutorialPage = (props: Props) => {
5858 setTab = { setTab }
5959 />
6060 ) }
61- { page === 'loading' && url && < LoadTutorialSummary url = { url } onLoadSummary = { onLoadSummary } /> }
61+ { page === 'loading' && url && (
62+ < LoadTutorialSummary url = { url } onLoadSummary = { onLoadSummary } onReturnToSelection = { ( ) => setPage ( 'form' ) } />
63+ ) }
6264 { page === 'summary' && data && < TutorialOverview onNext = { onNext } tutorial = { data } onClear = { onClear } /> }
6365 </ div >
6466 )
You can’t perform that action at this time.
0 commit comments