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

Commitc30e11d

Browse files
committed
reset to position
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parenta4418b1 commitc30e11d

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

‎src/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export { default as onStartup } from './onStartup'
22
export{defaultasonTutorialConfig}from'./onTutorialConfig'
33
export{defaultasonTutorialContinueConfig}from'./onTutorialContinueConfig'
44
export{defaultasonValidateSetup}from'./onValidateSetup'
5-
export{defaultasonRunLatestReset}from'./onRunLatestReset'
5+
export{defaultasonRunReset}from'./onRunReset'
66
export{defaultasonErrorPage}from'./onErrorPage'
77
export{onRunTest,onTestPass}from'./onTest'
88
export{onSetupActions,onSolutionActions}from'./onActions'

‎src/actions/onRunLatestReset.tsrenamed to‎src/actions/onRunReset.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ import * as TT from 'typings/tutorial'
33
importContextfrom'../services/context/context'
44
import{exec}from'../services/node'
55
importresetfrom'../services/reset'
6-
importgetLastCommitHashfrom'../services/reset/lastHash'
6+
importgetCommitHashByPositionfrom'../services/reset/lastHash'
7+
8+
typeResetAction={
9+
type:'LATEST'|'POSITION'
10+
position?:T.Position
11+
}
712

813
// reset to the start of the last test
9-
constonRunLatestReset=async(context:Context)=>{
14+
constonRunReset=async(action:ResetAction,context:Context)=>{
1015
// reset to timeline
1116
consttutorial:TT.Tutorial|null=context.tutorial.get()
12-
constposition:T.Position=context.position.get()
17+
constposition:T.Position=action.position ?action.position :context.position.get()
1318

1419
// get last pass commit
15-
consthash=getLastCommitHash(position,tutorial?.levels||[])
20+
consthash:string=getCommitHashByPosition(position,tutorial?.levels||[])
1621

1722
constbranch=tutorial?.config.repo.branch
1823

@@ -30,4 +35,4 @@ const onRunLatestReset = async (context: Context) => {
3035
}
3136
}
3237

33-
exportdefaultonRunLatestReset
38+
exportdefaultonRunReset

‎src/channel.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ class Channel implements Channel {
7979
case'EDITOR_RUN_TEST':
8080
actions.onRunTest(action)
8181
return
82-
case'EDITOR_RUN_RESET':
83-
actions.onRunLatestReset(this.context)
82+
case'EDITOR_RUN_RESET_LATEST':
83+
actions.onRunReset({type:'LATEST'},this.context)
84+
return
85+
case'EDITOR_RUN_RESET_POSITION':
86+
actions.onRunReset({type:'POSITION',position:action.payload.position},this.context)
8487
return
8588
default:
8689
logger(`No match for action type:${actionType}`)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default (editorSend: any) => ({
119119
},
120120
runReset(){
121121
editorSend({
122-
type:'EDITOR_RUN_RESET',
122+
type:'EDITOR_RUN_RESET_LATEST',
123123
})
124124
},
125125
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp