Skip to content

Feature/key bindings #391

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
hot key to continue (ctrl + enter)
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 18, 2020
commit 9976f58fd1f10fcd6b59adecce28bf29f063a553
9 changes: 7 additions & 2 deletions web-app/src/containers/Tutorial/components/Continue.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { Dialog } from '@alifd/next'
import { Dialog, Icon } from '@alifd/next'
import { css, jsx } from '@emotion/core'
import Button from '../../../components/Button'
import ProgressPie from './ProgressPie'
Expand All @@ -14,6 +14,9 @@ const styles = {
message: {
textAlign: 'center' as 'center',
},
buttonSubtext: {
padding: '0.5rem',
},
}

interface Props {
Expand Down Expand Up @@ -58,8 +61,10 @@ const Continue = (props: Props) => {
<h3>{props.title}</h3>
<br />
<Button type="primary" size="large" onClick={onContinue}>
Continue
Continue&nbsp;&nbsp;
<Icon type="arrow-right" />
</Button>
<div css={styles.buttonSubtext}>(ctrl + enter)</div>
</div>
</div>
</Dialog>
Expand Down
3 changes: 0 additions & 3 deletions web-app/src/containers/Tutorial/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ const TutorialPage = (props: PageProps) => {
const onContinue = (): void => {
props.send({
type: 'NEXT_LEVEL',
payload: {
levelId: position.levelId,
},
})
}

Expand Down
7 changes: 7 additions & 0 deletions web-app/src/services/state/actions/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ const contextActions: ActionFunctionMap<T.MachineContext, T.MachineEvent> = {
return event.payload
},
}),
// @ts-ignore
updateLevel: assign({
position: (context: T.MachineContext, event: T.MachineEvent): any => {
const levelId = context.position.levelId
return { levelId }
},
}),
loadNext: send(
(context: T.MachineContext): T.Action => {
const { position, progress } = context
Expand Down
6 changes: 5 additions & 1 deletion web-app/src/services/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,11 @@ export const createMachine = (options: any) => {
on: {
NEXT_LEVEL: {
target: 'LoadNext',
actions: ['testClear', 'updatePosition'],
actions: ['testClear', 'updateLevel'],
},
KEY_PRESS_ENTER: {
target: 'LoadNext',
actions: ['testClear', 'updateLevel'],
},
},
},
Expand Down