Skip to content

Refactor #289

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

Merged
merged 2 commits into from
Apr 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor web-app
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Apr 19, 2020
commit 84adae8c650ca2925ea1b83b5fe3794554812587
4 changes: 2 additions & 2 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export interface MachineStateSchema {
Setup: {
states: {
Startup: {}
Start: {}
ValidateSetup: {}
Start: {}
SelectTutorial: {}
SetupNewTutorial: {}
StartNewTutorial: {}
StartTutorial: {}
}
}
Tutorial: {
Expand Down
9 changes: 3 additions & 6 deletions web-app/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ 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 TutorialPage from './containers/Tutorial'

const Routes = () => {
const { context, send, Router, Route } = useRouter()
Expand All @@ -30,21 +30,18 @@ const Routes = () => {
<Route path="Setup.Start">
<StartPage send={send} context={context} />
</Route>
<Route path={['Setup.LoadTutorialSummary', 'Setup.LoadTutorialData', 'Setup.SetupNewTutorial']}>
<LoadingPage text="Loading Tutorial..." processes={context.processes} />]
</Route>
<Route path="Setup.SelectTutorial">
<SelectTutorialPage send={send} context={context} />
</Route>
<Route path={['Setup.SetupNewTutorial', 'Setup.StartNewTutorial']}>
<Route path={['Setup.SetupNewTutorial', 'Setup.StartTutorial']}>
<LoadingPage text="Configuring tutorial..." />
</Route>
{/* Tutorial */}
<Route path={['Tutorial.LoadNext', 'Tutorial.Level.Load']}>
<LoadingPage text="Loading Level..." processes={context.processes} />
</Route>
<Route path="Tutorial.Level">
<LevelSummaryPage send={send} context={context} />
<TutorialPage send={send} context={context} />
</Route>
{/* Completed */}
<Route path="Tutorial.Completed">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as React from 'react'
import * as T from 'typings'
import * as TT from 'typings/tutorial'
import * as selectors from '../../../services/selectors'
import Level from './Level'
import * as selectors from '../../services/selectors'
import Level from './components/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)
Expand Down Expand Up @@ -59,4 +59,4 @@ const LevelSummaryPageContainer = (props: PageProps) => {
)
}

export default LevelSummaryPageContainer
export default TutorialPage
4 changes: 2 additions & 2 deletions web-app/src/services/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ export const createMachine = (options: any) => {
actions: ['setError'],
},
TRY_AGAIN: 'SetupNewTutorial',
TUTORIAL_CONFIGURED: 'StartNewTutorial',
TUTORIAL_CONFIGURED: 'StartTutorial',
},
},
StartNewTutorial: {
StartTutorial: {
onEntry: ['startNewTutorial'],
after: {
0: '#tutorial',
Expand Down
2 changes: 1 addition & 1 deletion web-app/stories/Completed.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import SideBarDecorator from './utils/SideBarDecorator'

storiesOf('Completed', module)
.addDecorator(SideBarDecorator)
.add('Page', () => <CompletedPage context={{}} send={action('send')} />)
.add('Page', () => <CompletedPage context={{}} />)
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/components/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/components/Step'
import SideBarDecorator from './utils/SideBarDecorator'

const stepText =
Expand Down