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

Commite0e2839

Browse files
committed
remove unused model
1 parent74e20ee commite0e2839

File tree

9 files changed

+88
-91
lines changed

9 files changed

+88
-91
lines changed

‎web-app/src/Routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const Routes = () => {
5454
<LoadingPagetext="Launching Tutorial..."/>
5555
</Route>
5656
<Routepath="Start.ContinueTutorial">
57-
<ContinuePage/>
57+
<ContinuePagecontext={{}asCR.MachineContext}/>
5858
</Route>
5959
<Routepath="Tutorial.Initialize">
6060
<LoadingPagetext="Initializing..."/>

‎web-app/src/containers/Continue/index.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import*asReactfrom'react'
22
import{useQuery}from'@apollo/react-hooks'
33
import{Button,Card}from'@alifd/next'
4+
import*asCRfrom'typings'
45
import*asTfrom'typings/graphql'
56

6-
importcurrentTutorialfrom'../../services/current'
77
// import { editorDispatch } from '../../services/vscode'
88
importLoadingPagefrom'../LoadingPage'
99
importqueryTutorialfrom'./queryTutorial'
@@ -29,13 +29,18 @@ export const ContinuePage = (props: Props) => (
2929

3030
constLoading=()=><LoadingPagetext="Loading tutorials"/>
3131

32-
constContinuePageContainer=()=>{
32+
interfaceContainerProps{
33+
context:CR.MachineContext
34+
}
35+
36+
constContinuePageContainer=({ context}:ContainerProps)=>{
3337
// TODO: load specific tutorialId
34-
const{ tutorialId, version}=currentTutorial.get()
38+
const{ tutorial}=context
39+
// const { tutorialId, version } = currentTutorial.get()
3540
const{ data, loading, error}=useQuery(queryTutorial,{
3641
variables:{
37-
tutorialId,
38-
version,
42+
tutorialId:tutorial.id,
43+
version:tutorial.version.version,
3944
},
4045
})
4146

‎web-app/src/containers/Tutorial/StagePage/Stage/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ const styles = {
2424

2525
interfaceProps{
2626
stage:T.Stage
27-
onContinue():void
27+
onContinue():void
28+
onSave():void
2829
}
2930

30-
constStage=({ stage, onContinue}:Props)=>{
31+
constStage=({ stage, onContinue, onSave}:Props)=>{
3132
if(!stage.steps){
3233
thrownewError('No Stage steps found')
3334
}
@@ -61,11 +62,15 @@ const Stage = ({ stage, onContinue }: Props) => {
6162
</Step>
6263
</div>
6364

64-
{stage.status==='COMPLETE'&&(
65+
{stage.status==='COMPLETE'?(
6566
<divstyle={styles.options}>
6667
<ButtononClick={onContinue}>Continue</Button>
6768
</div>
68-
)}
69+
) :(
70+
<divstyle={styles.options}>
71+
<ButtononClick={onSave}>Save</Button>
72+
</div>
73+
)}
6974
</div>
7075
)
7176
}

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import queryStage from './queryStage'
99

1010
interfacePageProps{
1111
context:CR.MachineContext,
12-
send(action:string):void
12+
send(action:CR.Action):void
1313
}
1414

1515
constStageSummaryPageContainer=(props:PageProps)=>{
@@ -31,6 +31,24 @@ const StageSummaryPageContainer = (props: PageProps) => {
3131

3232
const{ stage}=data.tutorial.version
3333

34+
constonContinue=():void=>{
35+
props.send({
36+
type:'STAGE_NEXT',
37+
payload:{
38+
stageId:position.stageId,
39+
}
40+
})
41+
}
42+
43+
constonSave=():void=>{
44+
props.send({
45+
type:'TEST_RUNNING',
46+
payload:{
47+
stepId:position.stepId,
48+
}
49+
})
50+
}
51+
3452
stage.steps.forEach((step:G.Step)=>{
3553
if(step.id===position.stepId){
3654
step.status='ACTIVE'
@@ -41,11 +59,7 @@ const StageSummaryPageContainer = (props: PageProps) => {
4159
}
4260
})
4361

44-
constonContinue=():void=>{
45-
props.send('STAGE_NEXT')
46-
}
47-
48-
return<Stagestage={stage}onContinue={onContinue}/>
62+
return<Stagestage={stage}onContinue={onContinue}onSave={onSave}/>
4963
}
5064

5165
exportdefaultStageSummaryPageContainer

‎web-app/src/services/current/index.ts

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

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,29 @@ export default {
2525

2626
returnposition
2727
},
28+
}),
29+
//@ts-ignore
30+
testPass:assign({
31+
progress:(context:CR.MachineContext,event:CR.MachineEvent):CR.Progress=>{
32+
// update progress by tracking completed
33+
constcurrentProgress:CR.Progress=context.progress
34+
conststepId=event.payload.stepId
35+
36+
currentProgress.steps[stepId]=true
37+
38+
returncurrentProgress
39+
},
40+
}),
41+
//@ts-ignore
42+
stepLoadNext:assign({
43+
position:(context:CR.MachineContext,event:CR.MachineEvent):CR.Position=>{
44+
constcurrentPosition:CR.Position=context.position
45+
// merge in the updated position
46+
// sent with the test to ensure consistency
47+
return{
48+
...currentPosition,
49+
...event.payload.nextPosition,
50+
}
51+
},
2852
})
2953
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import*asCRfrom'typings'
2+
importchannelfrom'../../channel'
3+
4+
exportdefault{
5+
tutorialStart(){
6+
channel.editorSend({
7+
type:'TUTORIAL_START',
8+
payload:{
9+
tutorial:{
10+
id:'some-tutorial-id'
11+
}
12+
}
13+
})
14+
},
15+
testRunnerSetup(context:CR.MachineContext){
16+
console.log('test runner setup',context)
17+
},
18+
testStart(){
19+
console.log('test start')
20+
}
21+
}

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import{send}from'xstate'
2-
importchannelfrom'../../channel'
32
// import {machine} from '../../extension'
43
// import {cache} from '../../services/apollo'
54
// import {editorDispatch} from '../../services/vscode'
65
import*asCRfrom'typings'
76
// import * as G from 'typings/graphql'
87
// import tutorialConfig from '../../services/apollo/queries/tutorialConfig'
8+
importeditorActionsfrom'./editor'
99
importcontextActionsfrom'./context'
1010

1111
exportdefault{
@@ -16,19 +16,7 @@ export default {
1616
consthasExistingTutorial:boolean=false
1717
returnhasExistingTutorial ?'CONTINUE' :'NEW'
1818
}),
19-
tutorialStart(){
20-
channel.editorSend({
21-
type:'TUTORIAL_START',
22-
payload:{
23-
tutorial:{
24-
id:'some-tutorial-id'
25-
}
26-
}
27-
})
28-
},
29-
testRunnerSetup(context:CR.MachineContext){
30-
console.log('test runner setup',context)
31-
},
19+
...editorActions,
3220
...contextActions,
3321
}
3422

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ export const machine = Machine<CR.MachineContext, CR.MachineStateSchema, CR.Mach
6060
id:'tutorial',
6161
initial:'Initialize',
6262
onEntry:['testRunnerSetup'],
63-
// on: {
64-
// WEBVIEW_INITIALIZED: '#tutorial-load-next'
65-
// },
6663
states:{
6764
Initialize:{
6865
onEntry:['initializeNewTutorial'],
@@ -127,7 +124,7 @@ export const machine = Machine<CR.MachineContext, CR.MachineStateSchema, CR.Mach
127124
},
128125
},
129126
TestPass:{
130-
onEntry:['testPass','progressUpdate'],
127+
onEntry:['testPass'],
131128
onExit:['stepLoadNext'],
132129
after:{
133130
1000:'StepNext',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp