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

Commit160185c

Browse files
committed
setup subtask data passing on client
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentee86204 commit160185c

File tree

4 files changed

+142
-4
lines changed

4 files changed

+142
-4
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,24 @@ const Level = ({
157157
if(!step){
158158
returnnull
159159
}
160+
letsubtasks=null
161+
if(step.setup.subtasks?.length){
162+
if(testStatus?.summary){
163+
subtasks=Object.keys(testStatus.summary).map((testName:string)=>({
164+
name:testName,
165+
//@ts-ignore typescript is wrong here
166+
pass:testStatus.summary[testName],
167+
}))
168+
}
169+
}
160170
return(
161171
<Step
162172
key={step.id}
163173
order={index+1}
164174
status={step.status}
165175
content={step.content}
166176
onLoadSolution={onLoadSolution}
177+
subtasks={subtasks}
167178
/>
168179
)
169180
})}

‎web-app/src/containers/Tutorial/components/Step.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface Props {
88
order:number
99
content:string
1010
status:T.ProgressStatus
11+
subtasks:{name:string;pass:boolean}[]|null
1112
onLoadSolution():void
1213
}
1314

@@ -48,6 +49,13 @@ const Step = (props: Props) => {
4849
<div>
4950
<Markdown>{props.content||''}</Markdown>
5051
</div>
52+
{props.subtasks ?(
53+
<ul>
54+
{props.subtasks.map((subtask)=>(
55+
<likey={subtask.name}>{subtask.name}</li>
56+
))}
57+
</ul>
58+
) :null}
5159
</div>
5260
</div>
5361
)

‎web-app/stories/Level.stories.tsx

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,96 @@ storiesOf('Level', module)
9393
index={0}
9494
status={level.status}
9595
steps={level.steps}
96+
onRunTest={action('onRunTest')}
97+
onOpenLogs={action('onOpenLogs')}
9698
onContinue={action('onContinue')}
9799
onLoadSolution={action('onLoadSolution')}
98100
processes={[]}
99101
testStatus={null}
100102
/>
101103
)
102104
})
105+
.add('Subtasks',()=>{
106+
constlevel={
107+
id:'L1',
108+
index:0,
109+
title:'A Title',
110+
description:'A summary of the level',
111+
content:'Some content here in markdown',
112+
setup:null,
113+
status:'ACTIVE'as'ACTIVE',
114+
steps:[
115+
{
116+
id:'L1:S1',
117+
title:'First Step',
118+
content:'First step description',
119+
setup:{
120+
id:'L1:S1:SETUP',
121+
commits:['abcdefg'],
122+
},
123+
solution:{
124+
id:'L1:S1:SOLUTION',
125+
commits:['hijklmn'],
126+
},
127+
status:'COMPLETE',
128+
},
129+
{
130+
id:'L1:S2',
131+
title:'Second Step',
132+
content:'Second step description',
133+
setup:{
134+
id:'L1:S2:SETUP',
135+
commits:['abcdefg'],
136+
subtasks:['^SomeTest'],
137+
},
138+
solution:{
139+
id:'L1:S2:SOLUTION',
140+
commits:['hijklmn'],
141+
},
142+
status:'ACTIVE',
143+
},
144+
{
145+
id:'L1:S3',
146+
title:'Third Step',
147+
content:'Third step description',
148+
setup:{
149+
id:'L1:S3:SETUP',
150+
commits:['abcdefg'],
151+
},
152+
solution:{
153+
id:'L1:S3:SOLUTION',
154+
commits:['hijklmn'],
155+
},
156+
status:'INCOMPLETE',
157+
},
158+
],
159+
}
160+
consttestStatus:T.TestStatus={
161+
type:'error',
162+
title:'Test Failed because X',
163+
summary:{
164+
first:false,
165+
second:true,
166+
third:false,
167+
},
168+
}
169+
return(
170+
<Level
171+
menu={menu}
172+
title={level.title}
173+
content={level.content}
174+
index={0}
175+
status={level.status}
176+
steps={level.steps}
177+
onRunTest={action('onRunTest')}
178+
onOpenLogs={action('onOpenLogs')}
179+
onContinue={action('onContinue')}
180+
onLoadSolution={action('onLoadSolution')}
181+
processes={[]}
182+
testStatus={testStatus}
183+
/>
184+
)
185+
})
103186
.add('Level 2',()=>{
104187
constlevel={
105188
id:'L1',
@@ -143,16 +226,17 @@ storiesOf('Level', module)
143226
status:'COMPLETE',
144227
},
145228
],
146-
status:'COMPLETE',
147229
}
148230
return(
149231
<Level
150232
menu={menu}
151233
title={level.title}
152234
content={level.content}
153235
index={0}
154-
status={level.status}
236+
status={'COMPLETE'}
155237
steps={level.steps}
238+
onRunTest={action('onRunTest')}
239+
onOpenLogs={action('onOpenLogs')}
156240
onContinue={action('onContinue')}
157241
onLoadSolution={action('onLoadSolution')}
158242
processes={[
@@ -242,6 +326,8 @@ storiesOf('Level', module)
242326
index={0}
243327
status={level.status}
244328
steps={level.steps}
329+
onRunTest={action('onRunTest')}
330+
onOpenLogs={action('onOpenLogs')}
245331
onContinue={action('onContinue')}
246332
onLoadSolution={action('onLoadSolution')}
247333
processes={[]}
@@ -320,6 +406,8 @@ storiesOf('Level', module)
320406
index={0}
321407
status={level.status}
322408
steps={level.steps}
409+
onRunTest={action('onRunTest')}
410+
onOpenLogs={action('onOpenLogs')}
323411
onContinue={action('onContinue')}
324412
onLoadSolution={action('onLoadSolution')}
325413
processes={[]}
@@ -346,6 +434,8 @@ storiesOf('Level', module)
346434
index={0}
347435
status={level.status}
348436
steps={level.steps}
437+
onRunTest={action('onRunTest')}
438+
onOpenLogs={action('onOpenLogs')}
349439
onContinue={action('onContinue')}
350440
onLoadSolution={action('onLoadSolution')}
351441
processes={[]}

‎web-app/stories/Step.stories.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,46 @@ const paragraphText = `Markdown included \`code\`, *bold*, & _italics_.
3131
Emojis: :) :| :(
3232
`
3333

34-
storiesOf('Level',module)
34+
storiesOf('Step',module)
3535
.addDecorator(SideBarDecorator)
3636
.addDecorator(withKnobs)
3737
.add('Active Step',()=>(
38-
<Steporder={1}content={text('text',stepText)}status="ACTIVE"onLoadSolution={action('onLoadSolution')}/>
38+
<Step
39+
order={1}
40+
content={text('text',stepText)}
41+
status="ACTIVE"
42+
onLoadSolution={action('onLoadSolution')}
43+
subtasks={null}
44+
/>
3945
))
4046
.add('Step Markdown',()=>(
4147
<Step
4248
order={2}
4349
content={text('text',paragraphText)}
4450
status={select('mode',{ACTIVE:'ACTIVE',COMPLETE:'COMPLETE',INCOMPLETE:'INCOMPLETE'},'ACTIVE','step')}
4551
onLoadSolution={action('onLoadSolution')}
52+
subtasks={null}
53+
/>
54+
))
55+
.add('Substasks',()=>(
56+
<Step
57+
order={2}
58+
content={'A task with subtasks'}
59+
status={select('mode',{ACTIVE:'ACTIVE',COMPLETE:'COMPLETE',INCOMPLETE:'INCOMPLETE'},'ACTIVE','step')}
60+
onLoadSolution={action('onLoadSolution')}
61+
subtasks={[
62+
{
63+
name:'First Test',
64+
pass:false,
65+
},
66+
{
67+
name:'Second Test',
68+
pass:true,
69+
},
70+
{
71+
name:'Third Test',
72+
pass:false,
73+
},
74+
]}
4675
/>
4776
))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp