Skip to content

Fix/continue #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
refactor tutorial pages
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Apr 18, 2020
commit 125945131e640cb14c5d9eb81b1474232df9bbef
6 changes: 3 additions & 3 deletions web-app/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import ErrorView from './components/Error'
import LoadingPage from './containers/Loading'
import StartPage from './containers/Start'
import SelectTutorialPage from './containers/SelectTutorial'
import CompletedPage from './containers/Tutorial/CompletedPage'
import LevelSummaryPage from './containers/Tutorial/LevelPage'
import CompletedPage from './containers/Tutorial/Completed'
import TutorialPage from './containers/Tutorial'

const Routes = () => {
const { context, send, Router, Route } = useRouter()
Expand Down Expand Up @@ -44,7 +44,7 @@ const Routes = () => {
<LoadingPage text="Loading Level..." />
</Route>
<Route path="Tutorial.Level">
<LevelSummaryPage send={send} context={context} />
<TutorialPage send={send} context={context} />
</Route>
{/* Completed */}
<Route path="Tutorial.Completed">
Expand Down
7 changes: 0 additions & 7 deletions web-app/src/components/Error/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ interface Props {
}

const ErrorMarkdown = ({ error, send }: Props) => {
React.useEffect(() => {
if (error) {
// log error
console.log(`ERROR in markdown: ${error.message}`)
}
}, [error])

if (!error) {
return null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import * as T from 'typings'
import { css, jsx } from '@emotion/core'
import Button from '../../components/Button'
import Button from '../../../components/Button'

const styles = {
page: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Pro
currentStep = level.steps.length
}

console.log(`currentStep: ${currentStep}`)

const pageBottomRef = React.useRef(null)

const scrollToBottom = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import * as React from 'react'
import * as T from 'typings'
import * as TT from 'typings/tutorial'
import * as selectors from '../../../services/selectors'
import * as selectors from '../../services/selectors'
import Level from './Level'

interface PageProps {
context: T.MachineContext
send(action: T.Action): void
}

const LevelSummaryPageContainer = (props: PageProps) => {
const TutorialPage = (props: PageProps) => {
const { position, progress, processes, testStatus } = props.context

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

const onContinue = (): void => {
console.log('onContinue triggered')
props.send({
type: 'LEVEL_NEXT',
payload: {
Expand Down Expand Up @@ -59,4 +60,4 @@ const LevelSummaryPageContainer = (props: PageProps) => {
)
}

export default LevelSummaryPageContainer
export default TutorialPage
2 changes: 1 addition & 1 deletion web-app/stories/Completed.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { action } from '@storybook/addon-actions'
import { storiesOf } from '@storybook/react'
import React from 'react'
import CompletedPage from '../src/containers/Tutorial/CompletedPage'
import CompletedPage from '../src/containers/Tutorial/Completed'
import SideBarDecorator from './utils/SideBarDecorator'

storiesOf('Completed', module)
Expand Down
2 changes: 1 addition & 1 deletion web-app/stories/Level.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { storiesOf } from '@storybook/react'
import React from 'react'
import * as T from '../../typings'
import * as TT from '../../typings/tutorial'
import Level from '../src/containers/Tutorial/LevelPage/Level'
import Level from '../src/containers/Tutorial/Level'
import SideBarDecorator from './utils/SideBarDecorator'

type ModifiedLevel = TT.Level & {
Expand Down
2 changes: 1 addition & 1 deletion web-app/stories/Step.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { action } from '@storybook/addon-actions'
import { select, text, withKnobs } from '@storybook/addon-knobs'
import { storiesOf } from '@storybook/react'
import React from 'react'
import Step from '../src/containers/Tutorial/LevelPage/Step'
import Step from '../src/containers/Tutorial/Level/Step'
import SideBarDecorator from './utils/SideBarDecorator'

const stepText =
Expand Down