Commit 12df4a1d authored by Alexander Kotov's avatar Alexander Kotov

add redux-undo reducer

parent 99b2a997
......@@ -9018,6 +9018,11 @@
"symbol-observable": "^1.2.0"
}
},
"redux-undo": {
"version": "1.0.0-beta9-9-7",
"resolved": "https://registry.npmjs.org/redux-undo/-/redux-undo-1.0.0-beta9-9-7.tgz",
"integrity": "sha1-/juqGycUI9fdu/w6gscbApotuLo="
},
"regenerate": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
......
......@@ -7,7 +7,8 @@
"react-dom": "^16.4.2",
"react-redux": "^5.0.7",
"react-scripts": "1.1.4",
"redux": "^4.0.0"
"redux": "^4.0.0",
"redux-undo": "^1.0.0-beta9-9-7"
},
"scripts": {
"start": "react-scripts start",
......
......@@ -103,9 +103,7 @@ class Board extends Component {
}
}
const mapStateToProps = ({left, center, right, move}) => {
return {left, center, right, move}
}
const mapStateToProps = (state) => state.game.present
export default connect(mapStateToProps, {
onStartMove: startMove,
......
......@@ -17,7 +17,7 @@ const Toolbar = (props) => {
const mapStateToProps = (state) => {
return {
moveCount: state.moves
moveCount: state.game.present.moves
}
}
......
import { combineReducers } from 'redux'
import undoable from 'redux-undo'
import moves from './movesReducer'
import move from './moveReducer'
......@@ -12,13 +13,15 @@ const chainReducers = (...reducers) => {
}
}
export default chainReducers(
gameReducer,
combineReducers({
moves,
move,
left: towerReducer('left'),
center: towerReducer('center'),
right: towerReducer('right')
})
)
\ No newline at end of file
export default combineReducers({
game: undoable(chainReducers(
gameReducer,
combineReducers({
moves,
move,
left: towerReducer('left'),
center: towerReducer('center'),
right: towerReducer('right')
})
))
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment