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

Commitbeafa32

Browse files
committed
load all tutorial
1 parent5e88996 commitbeafa32

File tree

6 files changed

+15
-61
lines changed

6 files changed

+15
-61
lines changed

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

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
import*asReactfrom'react'
2-
import{useQuery}from'@apollo/react-hooks'
32
import{Button,Card}from'@alifd/next'
43
import*asCRfrom'typings'
54
import*asTfrom'typings/graphql'
65

7-
// import { editorDispatch } from '../../services/vscode'
8-
importLoadingPagefrom'../LoadingPage'
9-
importqueryTutorialfrom'./queryTutorial'
10-
importErrorViewfrom'../../components/Error'
11-
126
interfaceProps{
137
tutorial:T.Tutorial
148
onContinue():void
@@ -27,34 +21,17 @@ export const ContinuePage = (props: Props) => (
2721
</div>
2822
)
2923

30-
constLoading=()=><LoadingPagetext="Loading tutorials"/>
31-
3224
interfaceContainerProps{
3325
context:CR.MachineContext
3426
}
3527

3628
constContinuePageContainer=({ context}:ContainerProps)=>{
3729
// TODO: load specific tutorialId
3830
const{ tutorial}=context
39-
// const { tutorialId, version } = currentTutorial.get()
40-
const{ data, loading, error}=useQuery(queryTutorial,{
41-
variables:{
42-
tutorialId:tutorial.id,
43-
version:tutorial.version.version,
44-
},
45-
})
46-
47-
if(loading){
48-
return<Loading/>
49-
}
50-
51-
if(error){
52-
return<ErrorViewerror={error}/>
53-
}
5431

5532
return(
5633
<ContinuePage
57-
tutorial={data.tutorial}
34+
tutorial={tutorial}
5835
onContinue={()=>{
5936
console.log('TUTORIAL_START')
6037
}}

‎web-app/src/containers/Continue/queryTutorial.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const StageSummaryPageContainer = (props: PageProps) => {
4545
})
4646
stage.status=progress.stages[position.stageId] ?'COMPLETE' :'ACTIVE'
4747

48+
console.log('stage.status',stage.status)
49+
4850
return<Stagestage={stage}onContinue={onContinue}onSave={onSave}/>
4951
}
5052

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react'
22
import*asCRfrom'typings'
33
import{useQuery}from'@apollo/react-hooks'
44

5-
importquerySummaryfrom'./querySummary'
5+
importqueryTutorialfrom'./queryTutorial'
66
importSummaryfrom'./Summary'
77
importErrorViewfrom'../../../components/Error'
88

@@ -13,7 +13,7 @@ interface PageProps {
1313

1414
constSummaryPage=(props:PageProps)=>{
1515
const{ tutorial}=props.context
16-
const{ loading, error, data}=useQuery(querySummary,{
16+
const{ loading, error, data}=useQuery(queryTutorial,{
1717
fetchPolicy:'network-only',// for debugging purposes
1818
variables:{
1919
tutorialId:tutorial.id,

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import{gql}from'apollo-boost'
22

33
exportdefaultgql`
4-
querygetSummary($tutorialId: ID!, $version: String) {
4+
querygetTutorial($tutorialId: ID!, $version: String) {
55
tutorial(id: $tutorialId) {
66
id
77
title
@@ -16,6 +16,8 @@ export default gql`
1616
coderoadVersion
1717
levels {
1818
id
19+
title
20+
text
1921
setup {
2022
id
2123
commands
@@ -24,6 +26,8 @@ export default gql`
2426
}
2527
stages {
2628
id
29+
title
30+
text
2731
setup {
2832
id
2933
commands
@@ -32,6 +36,8 @@ export default gql`
3236
}
3337
steps {
3438
id
39+
title
40+
text
3541
setup {
3642
id
3743
commands

‎web-app/src/services/state/guards/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ export default {
1212
.steps
1313

1414
// TODO: verify not -1
15-
consthasNextStep=!(steps.findIndex((s:G.Step)=>s.id===position.stepId)===steps.length-1)
16-
console.log(hasNextStep,steps,position.stepId)
17-
returnhasNextStep
15+
return!(steps[steps.length-1].id===position.stepId)
1816
},
1917
hasNextStage:(context:CR.MachineContext):boolean=>{
2018
const{tutorial, position}=context
@@ -24,14 +22,14 @@ export default {
2422
.stages
2523

2624
// TODO: verify not -1
27-
return!(stages.findIndex((s:G.Stage)=>s.id===position.stageId)===stages.length-1)
25+
return!(stages[stages.length-1].id===position.stageId)
2826
},
2927
hasNextLevel:(context:CR.MachineContext):boolean=>{
3028
const{tutorial, position}=context
3129
// TODO: protect against errors
3230
constlevels:G.Level[]=tutorial.version.levels
3331

3432
// TODO: verify not -1
35-
return!(levels.findIndex((l:G.Level)=>l.id===position.levelId)===levels.length-1)
33+
return!(levels[levels.length-1].id===position.levelId)
3634
},
3735
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp