diff --git a/client/src/Board.css b/client/src/Board.css
index 335fa3b..47717f9 100644
--- a/client/src/Board.css
+++ b/client/src/Board.css
@@ -130,7 +130,7 @@
.Option {
cursor: pointer;
pointer-events: all;
- filter: brightness(150%);
+ filter: brightness(115%);
}
.Option .Pip-Shape,
diff --git a/client/src/Table.css b/client/src/Table.css
index d85b7af..0863943 100755
--- a/client/src/Table.css
+++ b/client/src/Table.css
@@ -396,6 +396,14 @@
margin: 0.25em;
display: inline-block;
}
+.Placard:not([disabled]) {
+ cursor: pointer;
+}
+.Placard.Selected {
+ filter: brightness(110%);
+ transform-origin: 100% 100%;
+ transform: scale(1.5);
+}
.Development {
position: relative;
diff --git a/client/src/Table.js b/client/src/Table.js
index d21d2d0..0043aae 100755
--- a/client/src/Table.js
+++ b/client/src/Table.js
@@ -93,9 +93,17 @@ const PlayerColor = ({ color }) => {
);
};
-const Placard = ({type}) => {
- return (
+const Placard = ({table, type}) => {
+ const buildClicked = (event) => {
+ if (table) {
+ table.buildClicked(event);
+ }
+ };
+
+ return (
{
const Chat = ({ table }) => {
const [lastTop, setLastTop] = useState(0),
[autoScroll, setAutoscroll] = useState(true),
+ [latest, setLatest] = useState(''),
[scrollTime, setScrollTime] = useState(0);
const chatInput = (event) => {
@@ -241,6 +250,12 @@ const Chat = ({ table }) => {
);
});
+ if (table.game && table.game.chat &&
+ table.game.chat[table.game.chat.length - 1].date !== latest) {
+ setLatest(table.game.chat[table.game.chat.length - 1].date);
+ setAutoscroll(true);
+ }
+
const name = table.game ? table.game.name : "Why no game?";
return (
@@ -372,6 +387,10 @@ const SelectPlayer = ({table, players}) => {
};
const Action = ({ table }) => {
+ const buildClicked = (event) => {
+ table.buildClicked(event);
+ };
+
const discardClick = (event) => {
const nodes = document.querySelectorAll('.Hand .Selected'),
discarding = { wheat: 0, brick: 0, sheep: 0, stone: 0, wood: 0 };
@@ -414,8 +433,8 @@ const Action = ({ table }) => {
> }
{ table.game.state === 'normal' && <>
-
-
+
+
{ table.game.turn.roll === 7 && player && player.mustDiscard > 0 &&
}
@@ -552,6 +571,7 @@ class Table extends React.Component {
this.updateMessage = this.updateMessage.bind(this);
this.gameSignature = this.gameSignature.bind(this);
this.sendAction = this.sendAction.bind(this);
+ this.buildClicked = this.buildClicked.bind(this);
this.mouse = { x: 0, y: 0 };
this.radius = 0.317;
@@ -718,6 +738,28 @@ class Table extends React.Component {
});
}
+ buildClicked(event) {
+ console.log("Build clicked");
+ const game = this.state.game,
+ player = game ? game.player : undefined
+ let color;
+ switch (game ? game.color : undefined) {
+ case "O": color = "orange"; break;
+ case "R": color = "red"; break;
+ case "B": color = "blue"; break;
+ case "W": color = "white"; break;
+ }
+
+ const nodes = document.querySelectorAll(`.Placard.Selected`);
+ for (let i = 0; i < nodes.length; i++) {
+ nodes[i].classList.remove('Selected');
+ }
+ const placard = document.querySelector(`.Placard[data-type="${color}"]`);
+ if (placard) {
+ placard.classList.add('Selected');
+ }
+ };
+
placeRobber(robber) {
return this.sendAction('place-robber', robber);
};
@@ -1013,7 +1055,7 @@ class Table extends React.Component {
-
+
}