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

Commit0c9b0b9

Browse files
committed
clenaup level summary progress
1 parentb2fcd7a commit0c9b0b9

File tree

6 files changed

+105
-42
lines changed

6 files changed

+105
-42
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Button, Card } from '@alifd/next'
55
import{send}from'../../utils/vscode'
66
importLoadingPagefrom'../LoadingPage'
77
importqueryTutorialfrom'./queryTutorial'
8+
importErrorViewfrom'../../components/Error'
89
import*asTfrom'../../../../typings/graphql'
910

1011
interfaceProps{
@@ -41,12 +42,7 @@ const ContinuePageContainer = () => {
4142
}
4243

4344
if(error){
44-
return(
45-
<div>
46-
<h5>{error.message}</h5>
47-
<p>{JSON.stringify(error,null,2)}</p>
48-
</div>
49-
)
45+
return<ErrorViewerror={error}/>
5046
}
5147

5248
return(

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

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import*asReactfrom'react'
2+
import{useQuery}from'@apollo/react-hooks'
3+
4+
importErrorViewfrom'../../../components/Error'
5+
// import Level from '../../../components/Level'
6+
import*asTfrom'../../../../../typings/graphql'
7+
importqueryLevelsfrom'./queryLevels'
8+
9+
interfaceLevelProps{
10+
levels:T.Level[]
11+
send(action:string):void
12+
}
13+
14+
exportconstLevelSummaryPage=(props:LevelProps)=>{
15+
// const { levelId } = position
16+
// const level = data.levels[levelId]
17+
// const onNext = (): void => {
18+
// props.send('NEXT')
19+
// }
20+
// const onBack = (): void => {
21+
// props.send('BACK')
22+
// }
23+
24+
// const stages: { [stageId: string]: any } = {}
25+
// for (const stageId of level.stageList) {
26+
// stages[stageId] = {
27+
// ...data.stages[stageId],
28+
// status: {
29+
// complete: progress.stages[stageId] || false,
30+
// active: position.stageId === stageId,
31+
// },
32+
// }
33+
// }
34+
35+
return<div>LevelSummaryPage</div>
36+
37+
// return <Level level={level} stages={stages} onNext={onNext} onBack={onBack} />
38+
}
39+
40+
interfaceContainerProps{
41+
send(action:string):void
42+
}
43+
44+
constLevelSummaryPageContainer=(props:ContainerProps)=>{
45+
const{ loading, error, data}=useQuery(queryLevels,{
46+
variables:{
47+
tutorialId:'1',
48+
version:'0.1.0',
49+
levelId:'1',
50+
},
51+
})
52+
53+
if(loading){
54+
return<div>Loading Levels...</div>
55+
}
56+
57+
if(error){
58+
return<ErrorViewerror={error}/>
59+
}
60+
61+
const{ levels}=data.tutorial.version
62+
63+
return<LevelSummaryPagelevels={levels}send={props.send}/>
64+
}
65+
66+
exportdefaultLevelSummaryPageContainer
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import{gql}from'apollo-boost'
2+
3+
exportdefaultgql`
4+
query getLevel($tutorialId: ID!, $version: String, $levelId: ID!) {
5+
tutorial(id: $tutorialId) {
6+
id
7+
version(version: $version) {
8+
version
9+
coderoadVersion
10+
level(levelId: $levelId) {
11+
id
12+
title
13+
text
14+
15+
stages {
16+
id
17+
title
18+
text
19+
20+
}
21+
}
22+
}
23+
}
24+
}
25+
`

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

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

@@ -24,7 +24,7 @@ const Tutorial = (props: Props) => {
2424
<SummaryPagesend={send}/>
2525
</Route>
2626
<Routepath="Tutorial.Level">
27-
<LevelPagesend={send}/>
27+
<LevelSummaryPagesend={send}/>
2828
</Route>
2929
<Routepath="Tutorial.Stage">
3030
<StagePagesend={send}/>

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
importReactfrom'react'
22

33
import{object,withKnobs}from'@storybook/addon-knobs'
4+
import{action}from'@storybook/addon-actions'
45
import{linkTo}from'@storybook/addon-links'
56
import{storiesOf}from'@storybook/react'
67
importSideBarDecoratorfrom'./utils/SideBarDecorator'
78

9+
importapolloProviderfrom'./utils/ApolloDecorator'
810
importLevelfrom'../src/components/Level'
11+
importLevelSummaryPageContainer,{LevelSummaryPage}from'../src/containers/Tutorial/LevelSummaryPage'
912

1013
storiesOf('Tutorial SideBar',module)
1114
.addDecorator(SideBarDecorator)
@@ -58,3 +61,10 @@ storiesOf('Tutorial SideBar', module)
5861
onBack={linkTo('TUtorial SideBar','Summary')}
5962
/>
6063
))
64+
.add('Level Summary',()=>{
65+
return<LevelSummaryPagesend={action('send')}levels={[]}/>
66+
})
67+
.addDecorator(apolloProvider)
68+
.add('Level Summary Container',()=>{
69+
return<LevelSummaryPageContainersend={action('send')}/>
70+
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp