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

Commit17e968f

Browse files
committed
remove progress progress (progressing)
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent3983bda commit17e968f

File tree

7 files changed

+30
-32
lines changed

7 files changed

+30
-32
lines changed

‎CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,8 @@ Adds a review page for viewing tutorial content. The review page should be espec
236236
- Launch from URL fixes
237237
- Move styles into a central theme
238238
- Prevent multiple versions of CodeRoad from launching
239+
240+
### [0.13.0]
241+
242+
- Significant internal refactor to remove recording progress
243+
- Admin mode to allow creators to jump between tutorial levels/steps during development

‎src/commands.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const createCommands = ({ extensionPath, workspaceState }: CreateCommandP
5454
onSuccess:(position:T.Position)=>{
5555
logger('test pass position',position)
5656
// send test pass message back to client
57-
webview.send({type:'TEST_PASS',payload:{ position}})
57+
webview.send({type:'TEST_PASS',payload:{position:{ ...position,complete:true}}})
5858
},
5959
onFail:(position:T.Position,failSummary:T.TestFail):void=>{
6060
// send test fail message back to client with failure message
@@ -82,13 +82,6 @@ export const createCommands = ({ extensionPath, workspaceState }: CreateCommandP
8282
subtasks,
8383
callbacks,
8484
}:{subtasks?:boolean;callbacks?:{onSuccess:()=>void}}={})=>{
85-
logger('run test current',currentPosition)
86-
// use stepId from client, or last set stepId
87-
// const position: T.Position = {
88-
// ...current,
89-
// stepId: current && current.position.stepId?.length ? current.position.stepId : currentPosition.stepId,
90-
// }
91-
logger('currentPosition',currentPosition)
9285
testRunner({position:currentPosition,onSuccess:callbacks?.onSuccess, subtasks})
9386
},
9487
[COMMANDS.ENTER]:()=>{

‎web-app/src/Routes.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import LoadingPage from './containers/Loading'
66
importStartPagefrom'./containers/Start'
77
importSelectTutorialPagefrom'./containers/SelectTutorial'
88
importTutorialPagefrom'./containers/Tutorial'
9+
importloggerfrom'./services/logger'
910

1011
/*
1112
* NOTE: due to a lack of URLs and a dependency on xstate
@@ -19,6 +20,8 @@ const Routes = () => {
1920
return<ErrorViewsend={send}error={context.error}/>
2021
}
2122

23+
logger(`ROUTE:${route}`)
24+
2225
return(
2326
<Routerroute={route}>
2427
{/* Setup */}

‎web-app/src/services/state/actions/context.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ export const updateStepPosition = assign({
4040
constlevel:TT.Level=selectors.currentLevel(context)
4141
conststeps:TT.Step[]=level.steps
4242

43-
// final stepbut not completed
43+
// final stepnow completed
4444
if(steps[steps.length-1].id===position.stepId){
45-
return{ ...position,complete:false}
45+
return{ ...position,complete:true}
4646
}
4747

4848
conststepIndex=steps.findIndex((s:TT.Step)=>s.id===position.stepId)
@@ -75,6 +75,8 @@ export const loadNext = send(
7575
exportconststepNext=send(
7676
(context:T.MachineContext):T.Action=>{
7777
constlevel:TT.Level=selectors.currentLevel(context)
78+
console.log(`STEP_NEXT:${JSON.stringify(context.position)}`)
79+
console.log(`STEP NEXT LEVEL${JSON.stringify(level)}`)
7880
returngetStepNext(context.position,level)
7981
},
8082
)

‎web-app/src/services/state/actions/utils/stepNext.test.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const level: TT.Level = {
2626
}
2727

2828
describe('stepNext',()=>{
29-
it('should LOAD_NEXT_STEP when there is another step and is complete',()=>{
30-
constposition={stepId:'1.1',levelId:'1',complete:true}
29+
it('should LOAD_NEXT_STEP when there is another step',()=>{
30+
constposition={levelId:'1',stepId:'1.2',complete:false}
3131
constresult=getStepNext(position,level)
3232
expect(result).toEqual({
3333
type:'LOAD_NEXT_STEP',
@@ -36,25 +36,26 @@ describe('stepNext', () => {
3636
},
3737
})
3838
})
39-
it('should LOAD_NEXT_STEPto the samestepif not complete',()=>{
40-
constposition={stepId:'1.1',levelId:'1',complete:false}
39+
it('should LOAD_NEXT_STEPwhen there is anotherstepbut no more',()=>{
40+
constposition={levelId:'1',stepId:'1.3',complete:false}
4141
constresult=getStepNext(position,level)
4242
expect(result).toEqual({
4343
type:'LOAD_NEXT_STEP',
4444
payload:{
45-
step:level.steps[0],
45+
step:level.steps[2],
4646
},
4747
})
4848
})
49+
4950
it('should LEVEL_COMPLETE when there are no steps',()=>{
50-
constposition={stepId:'1.3',levelId:'1',complete:true}
51-
constresult=getStepNext(position,level)
51+
constposition={levelId:'1',stepId:null,complete:false}
52+
constresult=getStepNext(position,{ ...level,steps:[]})
5253
expect(result).toEqual({
5354
type:'LEVEL_COMPLETE',
5455
})
5556
})
5657
it('should LEVEL_COMPLETE when all steps are complete',()=>{
57-
constposition={stepId:'1.3',levelId:'1',complete:true}
58+
constposition={levelId:'1',stepId:'1.3',complete:true}
5859
constresult=getStepNext(position,{ ...level,steps:[]})
5960
expect(result).toEqual({
6061
type:'LEVEL_COMPLETE',

‎web-app/src/services/state/actions/utils/stepNext.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,14 @@ import * as TT from 'typings/tutorial'
44
constgetStepNext=(position:T.Position,level:TT.Level):T.Action=>{
55
const{ steps}=level
66

7-
if(steps.length&&position.stepId){
7+
if(steps.length){
88
conststepIndex=steps.findIndex((s:TT.Step)=>s.id===position.stepId)
9-
constfinalStep=stepIndex===steps.length-1
10-
// not final step, or final step but not complete
11-
consthasNextStep=!finalStep
12-
13-
if(hasNextStep){
14-
constnextStep=steps[stepIndex+(position.complete ?1 :0)]
15-
return{
16-
type:'LOAD_NEXT_STEP',
17-
payload:{
18-
step:nextStep,
19-
},
20-
}
9+
constnextStep=steps[stepIndex]
10+
return{
11+
type:'LOAD_NEXT_STEP',
12+
payload:{
13+
step:nextStep,
14+
},
2115
}
2216
}
2317
return{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export const createMachine = (options: any) => {
215215
},
216216
},
217217
LevelComplete:{
218-
onExit:['testClear'],
218+
onExit:['testClear','incrementLevel'],
219219
on:{
220220
NEXT_LEVEL:'LoadNext',
221221
KEY_PRESS_ENTER:'LoadNext',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp