@@ -15,6 +15,7 @@ import formatLevels from './formatLevels'
1515import Reset from './components/Reset'
1616import Continue from './components/Continue'
1717import ScrollContent from './components/ScrollContent'
18+ import CompletedBanner from './components/CompletedBanner'
1819
1920const styles = {
2021 page : {
@@ -54,6 +55,13 @@ const styles = {
5455 color : 'white' ,
5556 zIndex : 1000 ,
5657 } ,
58+ completeFooter : {
59+ position : 'fixed' as 'fixed' ,
60+ bottom : 0 ,
61+ left : 0 ,
62+ right : 0 ,
63+ zIndex : 1000 ,
64+ } ,
5765 processes : {
5866 padding : '0 1rem' ,
5967 position : 'fixed' as 'fixed' ,
@@ -74,7 +82,7 @@ const styles = {
7482interface PageProps {
7583 context : T . MachineContext
7684 send ( action : T . Action ) : void
77- state : string // 'Normal' | 'TestRunning' | 'TestFail' | 'TestPass' | 'LevelComplete'
85+ state : string // 'Normal' | 'TestRunning' | 'TestFail' | 'TestPass' | 'Level. LevelComplete'
7886}
7987
8088/**
@@ -114,7 +122,9 @@ const TutorialPage = (props: PageProps) => {
114122 testStatus,
115123 } )
116124
117- const disableOptions = processes . length > 0 || props . state === 'TestRunning'
125+ const disableOptions = processes . length > 0 || props . state === 'Level.TestRunning'
126+
127+ console . log ( `STATE: ${ props . state } ` )
118128
119129 return (
120130 < div >
@@ -134,62 +144,70 @@ const TutorialPage = (props: PageProps) => {
134144 </ ScrollContent >
135145 ) }
136146 { page === 'review' && < ReviewPage levels = { levels } /> }
147+
137148 { /* {page === 'settings' && <SettingsPage />} */ }
138149 </ div >
139- < div css = { styles . footer } >
140- { /* Process Modal */ }
141- { processes . length > 0 && (
142- < div css = { styles . processes } >
143- < ProcessMessages processes = { processes } />
144- </ div >
145- ) }
146- { /* Test Fail Modal */ }
147- { testStatus && testStatus . type === 'warning' && (
148- < div css = { styles . testMessage } >
149- < TestMessage message = { testStatus . title } />
150- </ div >
151- ) }
152- { /* Left */ }
153- < div css = { { flex : 1 } } >
154- { DISPLAY_RUN_TEST_BUTTON && level . status !== 'COMPLETE' ? (
155- < Button style = { { marginLeft : '1rem' } } type = "primary" onClick = { onRunTest } disabled = { disableOptions } >
156- Run
157- </ Button >
158- ) : null }
159- </ div >
160150
161- { /* Center */ }
162- < div css = { { flex : 1 , display : 'flex' , justifyContent : 'center' } } >
163- < Reset onReset = { onReset } disabled = { disableOptions || props . state === 'LevelComplete '} />
151+ { props . state === 'Completed' ? (
152+ < div css = { styles . completeFooter } >
153+ < CompletedBanner title = { tutorial . summary . title || 'Unknown '} />
164154 </ div >
165-
166- { /* Right */ }
167- < div css = { { flex : 1 , display : 'flex' , justifyContent : 'flex-end' } } >
168- { ! level . steps . length ? (
169- < div css = { { marginRight : '0.5rem' } } >
170- < Continue
171- onContinue = { onContinue }
172- current = { levelIndex + 1 }
173- max = { levels . length }
174- title = { tutorial . summary . title }
175- defaultOpen = { false }
176- />
155+ ) : (
156+ < div css = { styles . footer } >
157+ { /* Process Modal */ }
158+ { processes . length > 0 && (
159+ < div css = { styles . processes } >
160+ < ProcessMessages processes = { processes } />
177161 </ div >
178- ) : props . state === 'LevelComplete' ? (
179- < div css = { { marginRight : '0.5rem' } } >
180- < Continue
181- onContinue = { onContinue }
182- current = { levelIndex + 1 }
183- max = { levels . length }
184- title = { tutorial . summary . title }
185- defaultOpen = { true }
186- />
162+ ) }
163+ { /* Test Fail Modal */ }
164+ { testStatus && testStatus . type === 'warning' && (
165+ < div css = { styles . testMessage } >
166+ < TestMessage message = { testStatus . title } />
187167 </ div >
188- ) : level . steps . length > 1 ? (
189- < StepProgress current = { stepIndex + 1 } max = { level . steps . length } />
190- ) : null }
168+ ) }
169+ { /* Left */ }
170+ < div css = { { flex : 1 } } >
171+ { DISPLAY_RUN_TEST_BUTTON && level . status !== 'COMPLETE' ? (
172+ < Button style = { { marginLeft : '1rem' } } type = "primary" onClick = { onRunTest } disabled = { disableOptions } >
173+ Run
174+ </ Button >
175+ ) : null }
176+ </ div >
177+
178+ { /* Center */ }
179+ < div css = { { flex : 1 , display : 'flex' , justifyContent : 'center' } } >
180+ < Reset onReset = { onReset } disabled = { disableOptions || props . state === 'Level.LevelComplete' } />
181+ </ div >
182+
183+ { /* Right */ }
184+ < div css = { { flex : 1 , display : 'flex' , justifyContent : 'flex-end' } } >
185+ { ! level . steps . length ? (
186+ < div css = { { marginRight : '0.5rem' } } >
187+ < Continue
188+ onContinue = { onContinue }
189+ current = { levelIndex + 1 }
190+ max = { levels . length }
191+ title = { tutorial . summary . title }
192+ defaultOpen = { false }
193+ />
194+ </ div >
195+ ) : props . state === 'Level.LevelComplete' ? (
196+ < div css = { { marginRight : '0.5rem' } } >
197+ < Continue
198+ onContinue = { onContinue }
199+ current = { levelIndex + 1 }
200+ max = { levels . length }
201+ title = { tutorial . summary . title }
202+ defaultOpen = { true }
203+ />
204+ </ div >
205+ ) : level . steps . length > 1 ? (
206+ < StepProgress current = { stepIndex + 1 } max = { level . steps . length } />
207+ ) : null }
208+ </ div >
191209 </ div >
192- </ div >
210+ ) }
193211 < SideMenu visible = { menuVisible } toggleVisible = { setMenuVisible } page = { page } setPage = { setPage } />
194212 </ div >
195213 )
0 commit comments