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

Commit44613b6

Browse files
committed
migrate stage page
1 parent372658d commit44613b6

File tree

5 files changed

+75
-49
lines changed

5 files changed

+75
-49
lines changed

‎web-app/src/components/Level/LevelStageSummary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import{Icon}from'@alifd/next'
22
import*asReactfrom'react'
3-
import*asTfrom'../../../../typings/graphql'
3+
import*asTfrom'typings/graphql'
44

55
importMarkdownfrom'../Markdown'
66

‎web-app/src/components/Stage/StepDescription/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import*asReactfrom'react'
2-
importCRfrom'typings'
32
importMarkdownfrom'../../Markdown'
43

54
conststyles={
@@ -12,18 +11,17 @@ const styles = {
1211
}
1312

1413
interfaceProps{
15-
content:CR.TutorialStepContent
16-
status:any// CC.StageStepStatus
14+
text?:string|null
15+
hide:boolean
1716
}
1817

19-
constStepDescription=({ content, status}:Props)=>{
20-
consthidden=!status.active&&!status.complete
21-
if(hidden){
18+
constStepDescription=({ text, hide}:Props)=>{
19+
if(hide){
2220
returnnull
2321
}
2422
return(
2523
<divstyle={styles.card}>
26-
<Markdown>{content.text}</Markdown>
24+
<Markdown>{text||''}</Markdown>
2725
</div>
2826
)
2927
}

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

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import*asReactfrom'react'
2+
import{useQuery}from'@apollo/react-hooks'
3+
import*asTfrom'typings/graphql'
4+
5+
importStagefrom'../../../components/Stage'
6+
importErrorViewfrom'../../../components/Error'
7+
importqueryStagefrom'./queryStage'
8+
9+
interfacePageProps{
10+
stage:T.Stage
11+
send(action:string):void
12+
}
13+
14+
exportconstStageSummaryPage=({ stage, send}:PageProps)=>{
15+
if(!stage){
16+
// may throw if no stage is supplied on restart
17+
thrownewError('No stage provided')
18+
}
19+
20+
conststageComplete=stage.status==='COMPLETE'
21+
22+
constonContinue=():void=>{
23+
send('STAGE_NEXT')
24+
}
25+
26+
return<Stagestage={stage}onContinue={onContinue}complete={stageComplete}/>
27+
}
28+
29+
constStageSummaryPageContainer=props=>{
30+
const{ loading, error, data}=useQuery(queryStage,{
31+
variables:{
32+
tutorialId:'1',
33+
version:'1.0.0',
34+
stageId:'1',
35+
},
36+
})
37+
if(loading){
38+
return<div>Loading Levels...</div>
39+
}
40+
41+
if(error){
42+
return<ErrorViewerror={error}/>
43+
}
44+
45+
const{ stage}=data.tutorial.version
46+
47+
return<StageSummaryPagestage={stage}send={props.send}/>
48+
}
49+
50+
exportdefaultStageSummaryPageContainer
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import{gql}from'apollo-boost'
2+
3+
exportdefaultgql`
4+
query getStage($tutorialId: ID!, $version: String, $stageId: ID!) {
5+
tutorial(id: $tutorialId) {
6+
id
7+
version(version: $version) {
8+
version
9+
coderoadVersion
10+
stage(stageId: $stageId) {
11+
id
12+
title
13+
text
14+
status @client
15+
}
16+
}
17+
}
18+
}
19+
`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp