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

Commit5145137

Browse files
committed
update local typings
1 parent8d9ca41 commit5145137

File tree

5 files changed

+29
-105
lines changed

5 files changed

+29
-105
lines changed

‎typings/context.d.ts

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

‎typings/index.d.ts

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,7 @@ import {send} from 'xstate'
22
importStoragefrom'../src/services/storage'
33
import*asGfrom'./graphql'
44

5-
exportinterfaceTutorialLevel{
6-
stepList:string[]
7-
content:{
8-
title:string
9-
text:string
10-
}
11-
actions?:{
12-
setup:TutorialAction
13-
}
14-
}
15-
16-
exportinterfaceTutorialHint{
17-
text:string
18-
displayed?:boolean
19-
}
20-
21-
exportinterfaceTutorialAction{
22-
commits:string[]
23-
commands?:string[]
24-
files?:string[]
25-
}
26-
27-
exportinterfaceTutorialStepContent{
28-
text:string
29-
title?:string
30-
}
31-
32-
exportinterfaceTutorialStep{
33-
content:TutorialStepContent
34-
actions:{
35-
setup:TutorialAction
36-
solution:TutorialAction
37-
}
38-
hints?:TutorialHint[]
39-
}
40-
41-
exportinterfaceTutorialData{
42-
summary:TutorialSummary
43-
levels:{
44-
[levelId:string]:TutorialLevel
45-
}
46-
steps:{
47-
[stepId:string]:TutorialStep
48-
}
49-
}
50-
51-
exportinterfaceTutorialMeta{
52-
version:string
53-
repo:string
54-
createdBy:string
55-
createdAt:string
56-
updatedBy:string
57-
updatedAt:string
58-
contributors:string[]
59-
languages:string[]
60-
testRunner:string
61-
}
62-
63-
exportinterfaceTutorialSummary{
64-
title:string
65-
description:string
66-
levelList:string[]
67-
}
68-
69-
exportinterfaceTutorial{
70-
id:string
71-
meta:TutorialMeta
72-
data:TutorialData
73-
}
5+
exporttypeProgressStatus='ACTIVE'|'COMPLETE'|'INCOMPLETE'
746

757
exportinterfaceProgress{
768
levels:{

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import{Button,Step}from'@alifd/next'
22
import*asReactfrom'react'
33
import*asGfrom'typings/graphql'
4+
import*asTfrom'typings'
45

56
importMarkdownfrom'../../../../components/Markdown'
67
importStepDescriptionfrom'./StepDescription'
@@ -45,7 +46,7 @@ const styles = {
4546
}
4647

4748
interfaceProps{
48-
level:G.Level
49+
level:G.Level&{status:T.ProgressStatus;index:number;steps:Array<G.Step&{status:T.ProgressStatus}>}
4950
onContinue():void
5051
onLoadSolution():void
5152
}
@@ -56,7 +57,7 @@ const Level = ({ level, onContinue, onLoadSolution }: Props) => {
5657
}
5758

5859
// grab the active step
59-
constactiveIndex:number=level.steps.findIndex((step:G.Step|null)=>{
60+
constactiveIndex:number=level.steps.findIndex((step:G.Step&{status:T.ProgressStatus}|null)=>{
6061
returnstep&&step.status==='ACTIVE'
6162
})
6263

@@ -76,7 +77,7 @@ const Level = ({ level, onContinue, onLoadSolution }: Props) => {
7677
<divstyle={styles.header}>Tasks</div>
7778
<divstyle={styles.steps}>
7879
<Stepcurrent={activeIndex}direction="ver"shape="dot"animationreadOnly>
79-
{level.steps.map((step:G.Step|null,index:number)=>{
80+
{level.steps.map((step:G.Step&{status:T.ProgressStatus}|null,index:number)=>{
8081
if(!step){
8182
returnnull
8283
}

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import*asReactfrom'react'
2-
import*asCRfrom'typings'
2+
import*asTfrom'typings'
33
import*asGfrom'typings/graphql'
44
import*asselectorsfrom'../../../services/selectors'
55

66
importLevelfrom'./Level'
77

88
interfacePageProps{
9-
context:CR.MachineContext
10-
send(action:CR.Action):void
9+
context:T.MachineContext
10+
send(action:T.Action):void
1111
}
1212

1313
constLevelSummaryPageContainer=(props:PageProps)=>{
1414
const{ position, progress}=props.context
1515

16-
constlevel:G.Level=selectors.currentLevel(props.context)
16+
constversion=selectors.currentVersion(props.context)
17+
constlevelData:G.Level=selectors.currentLevel(props.context)
1718

1819
constonContinue=():void=>{
1920
props.send({
@@ -28,16 +29,25 @@ const LevelSummaryPageContainer = (props: PageProps) => {
2829
props.send({type:'STEP_SOLUTION_LOAD'})
2930
}
3031

31-
level.steps.forEach((step:G.Step)=>{
32-
if(progress.steps[step.id]){
33-
step.status='COMPLETE'
34-
}elseif(step.id===position.stepId){
35-
step.status='ACTIVE'
36-
}else{
37-
step.status='INCOMPLETE'
38-
}
39-
})
40-
level.status=progress.levels[position.levelId] ?'COMPLETE' :'ACTIVE'
32+
constlevel:G.Level&{
33+
status:T.ProgressStatus
34+
index:number
35+
steps:Array<G.Step&{status:T.ProgressStatus}>
36+
}={
37+
...levelData,
38+
index:version.data.levels.findIndex((l:G.Level)=>l.id===position.levelId),
39+
status:progress.levels[position.levelId] ?'COMPLETE' :'ACTIVE',
40+
steps:levelData.steps.map((step:G.Step)=>{
41+
// label step status for step component
42+
letstatus:T.ProgressStatus='INCOMPLETE'
43+
if(progress.steps[step.id]){
44+
status='COMPLETE'
45+
}elseif(step.id===position.stepId){
46+
status='ACTIVE'
47+
}
48+
return{ ...step, status}
49+
}),
50+
}
4151

4252
return<Levellevel={level}onContinue={onContinue}onLoadSolution={onLoadSolution}/>
4353
}

‎web-app/src/services/selectors/tutorial.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export const currentLevel = (context: MachineContext): G.Level => createSelector
3030
thrownewError('Level not found when selecting level')
3131
}
3232
constlevel:G.Level=levels[levelIndex]
33-
level.index=levelIndex
3433

3534
returnlevel
3635
})(context)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp