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

Commit74e20ee

Browse files
committed
fix loading of levels/stages/steps
1 parentac42ad7 commit74e20ee

File tree

6 files changed

+73
-23
lines changed

6 files changed

+73
-23
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const ErrorView = ({ error }: Props) => {
2121
<h1>Error</h1>
2222
{error.graphQLErrors&&(
2323
<div>
24-
{error.graphQLErrors.map(({ message, locations, path}:GraphQLError)=>(
25-
<h5>
24+
{error.graphQLErrors.map(({ message, locations, path}:GraphQLError,index:number)=>(
25+
<h5key={index}>
2626
<b>[GraphQL error]:</b> Message:{message}, Location:{locations}, Path:{path}
2727
</h5>
2828
))}

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useQuery } from '@apollo/react-hooks'
33
import*asCRfrom'typings'
44
import*asGfrom'typings/graphql'
55

6-
importcurrentTutorialfrom'../../../services/current'
76
importErrorViewfrom'../../../components/Error'
87
importLevelfrom'./Level'
98
importqueryLevelfrom'./queryLevel'
@@ -29,7 +28,6 @@ interface ContainerProps {
2928
}
3029

3130
constLevelSummaryPageContainer=(props:ContainerProps)=>{
32-
console.log('load level summary')
3331
const{ tutorial, position, progress}=props.context
3432

3533
const{ loading, error, data}=useQuery(queryLevel,{
@@ -39,9 +37,6 @@ const LevelSummaryPageContainer = (props: ContainerProps) => {
3937
levelId:position.levelId,
4038
},
4139
})
42-
43-
console.log('load level data')
44-
console.log(JSON.stringify(data))
4540

4641
if(loading){
4742
return<div>Loading Levels...</div>
@@ -63,9 +58,6 @@ const LevelSummaryPageContainer = (props: ContainerProps) => {
6358
}
6459
})
6560

66-
console.log('check level')
67-
console.log(JSON.stringify(level))
68-
6961
return<LevelSummaryPagelevel={level}send={props.send}/>
7062
}
7163

‎web-app/src/containers/Tutorial/LevelPage/queryLevel.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,22 @@ export default gql`
1111
id
1212
title
1313
text
14-
status @client
14+
setup {
15+
id
16+
commits
17+
commands
18+
files
19+
}
1520
stages {
1621
id
1722
title
1823
text
19-
status @client
24+
setup {
25+
id
26+
commits
27+
commands
28+
files
29+
}
2030
}
2131
}
2232
}

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import*asReactfrom'react'
22
import*asCRfrom'typings'
3+
import*asGfrom'typings/graphql'
34
import{useQuery}from'@apollo/react-hooks'
45

5-
importcurrentTutorialfrom'../../../services/current'
66
importErrorViewfrom'../../../components/Error'
77
importStagefrom'./Stage'
88
importqueryStagefrom'./queryStage'
@@ -13,12 +13,12 @@ interface PageProps {
1313
}
1414

1515
constStageSummaryPageContainer=(props:PageProps)=>{
16-
const{tutorialId, version,position:{ stageId}}=currentTutorial.get()
16+
const{tutorial, position, progress}=props.context
1717
const{ loading, error, data}=useQuery(queryStage,{
1818
variables:{
19-
tutorialId,
20-
version,
21-
stageId,
19+
tutorialId:tutorial.id,
20+
version:tutorial.version.version,
21+
stageId:position.stageId,
2222
},
2323
})
2424
if(loading){
@@ -29,9 +29,17 @@ const StageSummaryPageContainer = (props: PageProps) => {
2929
return<ErrorViewerror={error}/>
3030
}
3131

32-
console.log('data',data)
33-
34-
const{ stage}=data.tutorial.version
32+
const{ stage}=data.tutorial.version
33+
34+
stage.steps.forEach((step:G.Step)=>{
35+
if(step.id===position.stepId){
36+
step.status='ACTIVE'
37+
}elseif(progress.steps[step.id]){
38+
step.status='COMPLETE'
39+
}else{
40+
step.status='INCOMPLETE'
41+
}
42+
})
3543

3644
constonContinue=():void=>{
3745
props.send('STAGE_NEXT')

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{gql}from'apollo-boost'
1+
import{gql}from'apollo-boost'
22

33
exportdefaultgql`
44
query getStage($tutorialId: ID!, $version: String, $stageId: ID!) {
@@ -11,12 +11,28 @@ export default gql`
1111
id
1212
title
1313
text
14-
status @client
14+
setup {
15+
id
16+
commits
17+
commands
18+
files
19+
}
1520
steps {
1621
id
1722
title
1823
text
19-
status @client
24+
setup {
25+
id
26+
commits
27+
commands
28+
files
29+
}
30+
solution {
31+
id
32+
commits
33+
commands
34+
files
35+
}
2036
}
2137
}
2238
}

‎web-app/src/containers/Tutorial/SummaryPage/querySummary.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,34 @@ export default gql`
1111
coderoadVersion
1212
levels {
1313
id
14+
setup {
15+
id
16+
commands
17+
commits
18+
files
19+
}
1420
stages {
1521
id
22+
setup {
23+
id
24+
commands
25+
commits
26+
files
27+
}
1628
steps {
1729
id
30+
setup {
31+
id
32+
commands
33+
commits
34+
files
35+
}
36+
solution {
37+
id
38+
commands
39+
commits
40+
files
41+
}
1842
}
1943
}
2044
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp