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

Commitaa978af

Browse files
committed
define processes
1 parent3599137 commitaa978af

File tree

5 files changed

+52
-45
lines changed

5 files changed

+52
-45
lines changed

‎typings/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface MachineContext {
4343
tutorial:G.Tutorial|null
4444
position:Position
4545
progress:Progress
46+
processes:ProcessEvent[]
4647
}
4748

4849
exportinterfaceMachineEvent{
@@ -107,4 +108,5 @@ export type EditorDispatch = (type: string, payload?: MessageData | MessageState
107108
exportinterfaceProcessEvent{
108109
title:string
109110
description:string
111+
status:'RUNNING'|'SUCCESS'|'FAIL'|'ERROR'
110112
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ const styles = {
2020

2121
// display a list of active processes
2222
constProcessEvents=(props:Props)=>{
23-
if(!props.processes.length){
24-
returnnull
25-
}
2623
return(
2724
<divstyle={styles.container}>
2825
{props.processes.map(process=>(

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const styles = {
3939
fontWeight:'bold'as'bold',
4040
lineHeight:'1.2rem',
4141
},
42+
processes:{
43+
padding:'0 1rem',
44+
},
4245
footer:{
4346
height:'36px',
4447
backgroundColor:'black',
@@ -101,7 +104,11 @@ const Level = ({ level, onContinue, onLoadSolution, processes }: Props) => {
101104
</div>
102105
)}
103106

104-
<ProcessEventsprocesses={processes}/>
107+
{processes.length&&(
108+
<divstyle={styles.processes}>
109+
<ProcessEventsprocesses={processes}/>
110+
</div>
111+
)}
105112

106113
<div>
107114
<divstyle={styles.footer}>

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

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,50 @@ import * as selectors from '../../../services/selectors'
66
importLevelfrom'./Level'
77

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

1313
constLevelSummaryPageContainer=(props:PageProps)=>{
14-
const{ position, progress}=props.context
15-
16-
constversion=selectors.currentVersion(props.context)
17-
constlevelData:G.Level=selectors.currentLevel(props.context)
18-
19-
constonContinue=():void=>{
20-
props.send({
21-
type:'LEVEL_NEXT',
22-
payload:{
23-
LevelId:position.levelId,
24-
},
25-
})
26-
}
27-
28-
constonLoadSolution=():void=>{
29-
props.send({type:'STEP_SOLUTION_LOAD'})
30-
}
31-
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-
}
51-
52-
return<Levellevel={level}onContinue={onContinue}onLoadSolution={onLoadSolution}/>
14+
const{ position, progress, processes}=props.context
15+
16+
constversion=selectors.currentVersion(props.context)
17+
constlevelData:G.Level=selectors.currentLevel(props.context)
18+
19+
constonContinue=():void=>{
20+
props.send({
21+
type:'LEVEL_NEXT',
22+
payload:{
23+
LevelId:position.levelId,
24+
},
25+
})
26+
}
27+
28+
constonLoadSolution=():void=>{
29+
props.send({type:'STEP_SOLUTION_LOAD'})
30+
}
31+
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+
}
51+
52+
return<Levellevel={level}onContinue={onContinue}onLoadSolution={onLoadSolution}processes={processes}/>
5353
}
5454

5555
exportdefaultLevelSummaryPageContainer

‎web-app/src/services/state/machine.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const machine = Machine<CR.MachineContext, CR.MachineStateSchema, CR.Mach
2020
steps:{},
2121
complete:false,
2222
},
23+
processes:[],
2324
},
2425
states:{
2526
Start:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp