Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ee5d29

Browse files
committed
refactor tutorial pages
Signed-off-by: shmck <[email protected]>
1 parent 63103b6 commit 0ee5d29

File tree

9 files changed

+13
-17
lines changed

9 files changed

+13
-17
lines changed

web-app/src/Routes.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import ErrorView from './components/Error'
55
import LoadingPage from './containers/Loading'
66
import StartPage from './containers/Start'
77
import SelectTutorialPage from './containers/SelectTutorial'
8-
import CompletedPage from './containers/Tutorial/CompletedPage'
9-
import LevelSummaryPage from './containers/Tutorial/LevelPage'
8+
import CompletedPage from './containers/Tutorial/Completed'
9+
import TutorialPage from './containers/Tutorial'
1010

1111
const Routes = () => {
1212
const { context, send, Router, Route } = useRouter()
@@ -44,7 +44,7 @@ const Routes = () => {
4444
<LoadingPage text="Loading Level..." />
4545
</Route>
4646
<Route path="Tutorial.Level">
47-
<LevelSummaryPage send={send} context={context} />
47+
<TutorialPage send={send} context={context} />
4848
</Route>
4949
{/* Completed */}
5050
<Route path="Tutorial.Completed">

web-app/src/components/Error/index.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ interface Props {
3737
}
3838

3939
const ErrorMarkdown = ({ error, send }: Props) => {
40-
React.useEffect(() => {
41-
if (error) {
42-
// log error
43-
console.log(`ERROR in markdown: ${error.message}`)
44-
}
45-
}, [error])
46-
4740
if (!error) {
4841
return null
4942
}

web-app/src/containers/Tutorial/CompletedPage.tsx renamed to web-app/src/containers/Tutorial/Completed/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react'
22
import * as T from 'typings'
33
import { css, jsx } from '@emotion/core'
4-
import Button from '../../components/Button'
4+
import Button from '../../../components/Button'
55

66
const styles = {
77
page: {

web-app/src/containers/Tutorial/LevelPage/Level.tsx renamed to web-app/src/containers/Tutorial/Level/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Pro
9191
currentStep = level.steps.length
9292
}
9393

94+
console.log(`currentStep: ${currentStep}`)
95+
9496
const pageBottomRef = React.useRef(null)
9597

9698
const scrollToBottom = () => {

web-app/src/containers/Tutorial/LevelPage/index.tsx renamed to web-app/src/containers/Tutorial/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import * as React from 'react'
22
import * as T from 'typings'
33
import * as TT from 'typings/tutorial'
4-
import * as selectors from '../../../services/selectors'
4+
import * as selectors from '../../services/selectors'
55
import Level from './Level'
66

77
interface PageProps {
88
context: T.MachineContext
99
send(action: T.Action): void
1010
}
1111

12-
const LevelSummaryPageContainer = (props: PageProps) => {
12+
const TutorialPage = (props: PageProps) => {
1313
const { position, progress, processes, testStatus } = props.context
1414

1515
const tutorial = selectors.currentTutorial(props.context)
1616
const levelData: TT.Level = selectors.currentLevel(props.context)
1717

1818
const onContinue = (): void => {
19+
console.log('onContinue triggered')
1920
props.send({
2021
type: 'LEVEL_NEXT',
2122
payload: {
@@ -59,4 +60,4 @@ const LevelSummaryPageContainer = (props: PageProps) => {
5960
)
6061
}
6162

62-
export default LevelSummaryPageContainer
63+
export default TutorialPage

web-app/stories/Completed.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { action } from '@storybook/addon-actions'
22
import { storiesOf } from '@storybook/react'
33
import React from 'react'
4-
import CompletedPage from '../src/containers/Tutorial/CompletedPage'
4+
import CompletedPage from '../src/containers/Tutorial/Completed'
55
import SideBarDecorator from './utils/SideBarDecorator'
66

77
storiesOf('Completed', module)

web-app/stories/Level.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { storiesOf } from '@storybook/react'
44
import React from 'react'
55
import * as T from '../../typings'
66
import * as TT from '../../typings/tutorial'
7-
import Level from '../src/containers/Tutorial/LevelPage/Level'
7+
import Level from '../src/containers/Tutorial/Level'
88
import SideBarDecorator from './utils/SideBarDecorator'
99

1010
type ModifiedLevel = TT.Level & {

web-app/stories/Step.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { action } from '@storybook/addon-actions'
22
import { select, text, withKnobs } from '@storybook/addon-knobs'
33
import { storiesOf } from '@storybook/react'
44
import React from 'react'
5-
import Step from '../src/containers/Tutorial/LevelPage/Step'
5+
import Step from '../src/containers/Tutorial/Level/Step'
66
import SideBarDecorator from './utils/SideBarDecorator'
77

88
const stepText =

0 commit comments

Comments
 (0)