File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
web-app/src/containers/Tutorial Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import React, { useState } from 'react'
33import { Theme } from '../../../styles/theme'
44import Reset from '../components/Reset'
55
6+ import * as T from 'typings'
7+
68const styles = {
79 flexColumn : {
810 display : 'flex' as 'flex' ,
@@ -43,11 +45,21 @@ const styles = {
4345 } ,
4446}
4547
46- interface Props { }
48+ interface Props {
49+ levels : T . LevelUI [ ]
50+ onResetToPosition ( position : T . Position ) : void
51+ }
4752
4853const SettingsPage = ( props : Props ) => {
4954 const onReset = ( ) => {
50- console . log ( 'Trigger a reset event here' )
55+ const level : T . LevelUI | null = props . levels . length ? props . levels [ 0 ] : null
56+ if ( level ) {
57+ props . onResetToPosition ( {
58+ levelId : level . id ,
59+ stepId : null ,
60+ complete : false ,
61+ } )
62+ }
5163 }
5264 return (
5365 < div css = { styles . container } >
@@ -61,7 +73,9 @@ const SettingsPage = (props: Props) => {
6173 < div css = { styles . menuItemHeader } > Reset Tutorial</ div >
6274 < div css = { styles . menuItemContent } >
6375 This will reset the whole tutorial and change the source files back to the first level and first task
64- checkpoint.
76+ checkpoint. This will reset the whole tutorial and change the source files back to the first level and
77+ first task checkpoint. This will reset the whole tutorial and change the source files back to the first
78+ level and first task checkpoint.
6579 </ div >
6680 </ div >
6781 < Reset style = { styles . menuItemButton } warning onReset = { onReset } />
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ const TutorialPage = (props: PageProps) => {
134134 levels : tutorial . levels ,
135135 testStatus,
136136 } )
137-
137+ console . log ( { position } )
138138 const disableOptions = processes . length > 0 || props . state === 'Level.TestRunning'
139139
140140 return (
@@ -156,7 +156,7 @@ const TutorialPage = (props: PageProps) => {
156156 ) }
157157 { page === 'review' && < ReviewPage levels = { levels } onResetToPosition = { onResetToPosition } /> }
158158
159- { page === 'settings' && < SettingsPage /> }
159+ { page === 'settings' && < SettingsPage levels = { levels } onResetToPosition = { onResetToPosition } /> }
160160 </ div >
161161
162162 { props . state === 'Completed' ? (
You can’t perform that action at this time.
0 commit comments