Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc69b868

Browse files
committed
working stage container
1 parent7bab14b commitc69b868

File tree

7 files changed

+22
-23
lines changed

7 files changed

+22
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
11
import * as React from 'react'
22
import { useQuery } from '@apollo/react-hooks'
3-
import * as T from 'typings/graphql'
43

54
import Stage from 'components/Stage'
65
import ErrorView from 'components/Error'
76
import queryStage from './queryStage'
87

98
interface PageProps {
10-
stage: T.Stage
119
send(action: string): void
1210
}
1311

14-
export const StageSummaryPage = ({ stage, send }: PageProps) => {
15-
if (!stage) {
16-
// may throw if no stage is supplied on restart
17-
throw new Error('No stage provided')
18-
}
19-
20-
const stageComplete = stage.status === 'COMPLETE'
21-
22-
const onContinue = (): void => {
23-
send('STAGE_NEXT')
24-
}
25-
26-
return <Stage stage={stage} onContinue={onContinue} complete={stageComplete} />
27-
}
28-
29-
const StageSummaryPageContainer = props => {
12+
const StageSummaryPageContainer = (props: PageProps) => {
3013
const { loading, error, data } = useQuery(queryStage, {
3114
variables: {
3215
tutorialId: '1',
33-
version: '1.0.0',
16+
version: '0.1.0',
3417
stageId: '1',
3518
},
3619
})
@@ -42,9 +25,15 @@ const StageSummaryPageContainer = props => {
4225
return <ErrorView error={error} />
4326
}
4427

28+
console.log('data', data)
29+
4530
const { stage } = data.tutorial.version
4631

47-
return <StageSummaryPage stage={stage} send={props.send} />
32+
const onContinue = (): void => {
33+
props.send('STAGE_NEXT')
34+
}
35+
36+
return <Stage stage={stage} onContinue={onContinue} />
4837
}
4938

5039
export default StageSummaryPageContainer

‎web-app/src/containers/Tutorial/StageSummaryPage/queryStage.tsrenamed to‎web-app/src/containers/Tutorial/StagePage/queryStage.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export default gql`
1212
title
1313
text
1414
status @client
15+
steps {
16+
id
17+
title
18+
text
19+
status @client
20+
}
1521
}
1622
}
1723
}

‎web-app/src/containers/Tutorial/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { send } from 'utils/vscode'
44
import Router from 'components/Router'
55
import LoadingPage from '../LoadingPage'
66
import SummaryPage from './SummaryPage'
7-
import LevelSummaryPage from './LevelSummaryPage'
8-
import StageSummaryPage from './StageSummaryPage'
7+
import LevelSummaryPage from './LevelPage'
8+
import StageSummaryPage from './StagePage'
99
import CompletedPage from './CompletedPage'
1010

1111
const { Route } = Router

‎web-app/stories/Level.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import SideBarDecorator from './utils/SideBarDecorator'
88

99
import apolloProvider from './utils/ApolloDecorator'
1010
import Level from '../src/components/Level'
11-
import LevelSummaryPageContainer, { LevelSummaryPage } from '../src/containers/Tutorial/LevelSummaryPage'
11+
import LevelSummaryPageContainer, { LevelSummaryPage } from '../src/containers/Tutorial/LevelPage'
1212

1313
storiesOf('Tutorial SideBar', module)
1414
.addDecorator(SideBarDecorator)

‎web-app/stories/Stage.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { storiesOf } from '@storybook/react'
66
import SideBarDecorator from './utils/SideBarDecorator'
77

88
import Stage from '../src/components/Stage'
9+
import StageContainer from '../src/containers/Tutorial/StagePage'
10+
import ApolloDecorator from './utils/ApolloDecorator'
911

1012
storiesOf('Tutorial SideBar', module)
1113
.addDecorator(SideBarDecorator)
@@ -47,3 +49,5 @@ storiesOf('Tutorial SideBar', module)
4749
onContinue={action('onContinue')}
4850
/>
4951
))
52+
.addDecorator(ApolloDecorator)
53+
.add('Stage Summary Container', () => <StageContainer send={action('send')} />)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp