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

Fix/workflow#8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 7 commits intomasterfromfix/workflow
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletionssrc/editor/ReactWebView.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,7 @@ class ReactWebView {
console.log('webview loaded')
}

publicasynccreateOrShow(column: number):Promise<void> {
public createOrShow(column: number): void {
// If we already have a panel, show it.
// Otherwise, create a new panel.
if (this.panel && this.panel.webview) {
Expand All@@ -40,7 +40,6 @@ class ReactWebView {
} else {
console.log('make new panel')
this.panel = this.createWebviewPanel(column)

}
}

Expand Down
3 changes: 3 additions & 0 deletionssrc/editor/commands/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,6 +43,9 @@ export const createCommands = ({ context, machine, storage, git, position }: Cre
// open React webview
[COMMANDS.OPEN_WEBVIEW]: (column: number = vscode.ViewColumn.One) => {
webview.createOrShow(column);
setTimeout(() => {
machine.send('WEBVIEW_INITIALIZED')
}, 2000)
},
// launch a new tutorial
// NOTE: may be better to move into action as logic is primarily non-vscode
Expand Down
33 changes: 24 additions & 9 deletionssrc/state/actions/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -78,23 +78,31 @@ export default {
console.log('ACTION: tutorialLoad.progress')
return currentProgress
},
position() {
position(context: any): CR.Position {
console.log('ACTION: tutorialLoad.position')
if (!currentTutorial) {
throw new Error('No Tutorial loaded')
}
const { data } = currentTutorial

const levelId = data.summary.levelList[0]
const stageId = data.levels[levelId].stageList[0]
const stepId = data.stages[stageId].stepList[0]
const levelId = data.summary.levelList.find((id: string) => !currentProgress.levels[id])
if (!levelId) {
throw new Error('No level found on position load')
}
const stageId = data.levels[levelId].stageList.find((id: string) => !currentProgress.stages[id])
if (!stageId) {
throw new Error('No stage found on position load')
}
const stepId = data.stages[stageId].stepList.find((id: string) => !currentProgress.steps[id])
if (!stepId) {
throw new Error('No step found on position load')
}

const position = {
levelId,
stageId,
stepId,
stepId
}

console.log('position', position)
return position
}
}),
Expand All@@ -120,6 +128,7 @@ export default {
[context.position.stepId]: true,
}
}
console.log('progress update', nextProgress)
storage.setProgress(nextProgress)
return nextProgress
}
Expand All@@ -134,6 +143,7 @@ export default {
[context.position.stageId]: true,
}
}
console.log('progress update', nextProgress)
storage.setProgress(nextProgress)
return nextProgress
}
Expand All@@ -148,6 +158,7 @@ export default {
[context.position.levelId]: true,
}
}
console.log('progress update', nextProgress)
storage.setProgress(nextProgress)
return nextProgress

Expand All@@ -160,20 +171,24 @@ export default {
...context.progress,
complete: true,
}
console.log('progress update', nextProgress)
storage.setProgress(nextProgress)
return nextProgress
}
}),
stepLoadNext: assign({
position: (context: any) => {
position: (context: any): CR.Position => {
const { data, position } = context
const { stepList } = data.stages[position.stageId]
const currentStepIndex = stepList.indexOf(position.stepId)
const nextStepId = stepList[currentStepIndex + 1]
return {

const nextPosition = {
...context.position,
stepId: nextStepId,
}
console.log('position update', nextPosition)
return nextPosition
}
}),
loadLevel() {
Expand Down
11 changes: 7 additions & 4 deletionssrc/state/guards/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,11 +2,14 @@ import * as CR from 'typings'

export default {
hasNextStep: (context: CR.MachineContext): boolean => {
const { data, position } = context
const { data, position, progress } = context
const steps = data.stages[position.stageId].stepList
const hasNext = steps[steps.length - 1] !== position.stepId
console.log('GUARD: hasNextStep', hasNext)
return hasNext
// isn't final step yet
if (steps[steps.length - 1] !== position.stepId) {
return true
}
// final step is not yet complete
return !progress.steps[position.stepId]
},
hasNextStage: (context: CR.MachineContext): boolean => {
const { data, position } = context
Expand Down
32 changes: 20 additions & 12 deletionssrc/state/machine.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,8 +20,8 @@ export const machine = Machine<
initial: 'Initial',
states: {
Initial: {
after: {
2000: 'Startup'
on: {
WEBVIEW_INITIALIZED: 'Startup'
}
},
Startup: {
Expand DownExpand Up@@ -50,7 +50,7 @@ export const machine = Machine<
ContinueTutorial: {
onEntry: ['tutorialContinue'],
on: {
TUTORIAL_START: '#tutorial-load-next'
TUTORIAL_START: '#tutorial-load-current'
}
},
}
Expand All@@ -66,6 +66,13 @@ export const machine = Machine<
0: 'Summary'
}
},
LoadCurrent: {
id: 'tutorial-load-current',
// TODO: verify current is not complete
after: {
0: 'Stage'
},
},
LoadNext: {
id: 'tutorial-load-next',
onEntry: ['tutorialLoadNext'],
Expand DownExpand Up@@ -120,14 +127,9 @@ export const machine = Machine<
TestPass: {
onEntry: ['testPass', 'stepComplete'],
after: {
1000: {
target: 'StepNext',
cond: 'hasNextStep',
}
},
on: {
NEXT: 'StageComplete',
1000: 'StepNext',
},

},
TestFail: {
onEntry: ['testFail'],
Expand All@@ -138,8 +140,14 @@ export const machine = Machine<
StepNext: {
onEntry: ['stepLoadNext'],
after: {
0: 'Normal'
}
0: [{
target: 'Normal',
cond: 'hasNextStep',
actions: ['stepLoadCommits']
}, {
target: 'StageComplete'
}]
},
},
StageComplete: {
onEntry: 'stageComplete',
Expand Down
1 change: 1 addition & 0 deletionstypings/index.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -148,6 +148,7 @@ export interface MachineStateSchema {
states: {
Initialize: {}
Summary: {}
LoadCurrent: {}
LoadNext: {}
Level: {}
Stage: {
Expand Down
2 changes: 1 addition & 1 deletionweb-app/src/containers/Tutorial/StagePage.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ const StagePage = (props: PageProps) => {
...data.steps[stepId],
status: {
// flag progressed steps as complete
complete: progress.steps[stepId] || false,
complete: progress.stages[stageId] || false,
// set active step to active
active: position.stepId === stepId,
},
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp