mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
Move pieces piece-by-piece, peacefully!
This commit is contained in:
parent
e7933b5661
commit
877506a648
@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
import { selectPiece } from "store/actions";
|
import { movePiece, selectPiece } from "store/actions";
|
||||||
|
|
||||||
class ChessBoardSquare extends React.Component {
|
class ChessBoardSquare extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -21,6 +21,11 @@ class ChessBoardSquare extends React.Component {
|
|||||||
if (this.props.piece != undefined) {
|
if (this.props.piece != undefined) {
|
||||||
store.dispatch(selectPiece(this.squareCoords()));
|
store.dispatch(selectPiece(this.squareCoords()));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
console.log("About to move!");
|
||||||
|
store.dispatch(movePiece(store.getState().selectedSquare, this.squareCoords()));
|
||||||
|
console.log("Moved!");
|
||||||
|
}
|
||||||
|
|
||||||
console.log(store.getState().selectedSquare);
|
console.log(store.getState().selectedSquare);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user