-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandQueue.jsx
More file actions
36 lines (33 loc) · 1.15 KB
/
CommandQueue.jsx
File metadata and controls
36 lines (33 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React, { Component } from 'react'
import * as a from '../reducers/action'
import classNames from 'classnames'
class CommandQueue extends Component {
render () {
const commandImgs = {}
commandImgs[a.MOVE_FORWARD] = '/resources/images/move-forward.svg'
commandImgs[a.JUMP_UP] = '/resources/images/jump.svg'
commandImgs[a.TURN_LEFT] = '/resources/images/turn-left.svg'
commandImgs[a.TURN_RIGHT] = '/resources/images/turn-right.svg'
return (
<div className='command-queue'>
{this.props.commandQueue.map((e, i) => {
return (
<div
key={i}
onClick={!this.props.running ? () => { this.props.removeAction(i) } : null}
className={
classNames('commandQueueIcon', {
'commandQueueIcon-active': this.props.executeCommandIndex - 1 === i && this.props.running && !this.props.hasFinished,
'commandQueueIcon-removable': !this.props.running
})
}
>
<img src={commandImgs[e]} />
</div>
)
})}
</div>
)
}
}
export default CommandQueue