From 4c0826f88419cdaf357e38695e03e03abe255d4e Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Sun, 6 Mar 2022 12:47:09 -0800 Subject: [PATCH] Fix #30 - Show available pieces on board Signed-off-by: James Ketrenos --- client/src/Board.css | 20 ++++++++++---------- client/src/PlayerColor.js | 31 +++---------------------------- client/src/Table.css | 1 - client/src/Table.js | 6 ++++-- client/src/Winner.css | 14 +++++++++++++- client/src/Winner.js | 11 ++++++----- 6 files changed, 36 insertions(+), 47 deletions(-) diff --git a/client/src/Board.css b/client/src/Board.css index a4e66a7..a0ce1fd 100644 --- a/client/src/Board.css +++ b/client/src/Board.css @@ -15,7 +15,7 @@ top: 50%; } -.Tile { +.Board .Tile { z-index: 5; /* Below Road and Corner */ position: absolute; background-position-y: 0px; @@ -74,7 +74,7 @@ pointer-events: none; } -.Corner { +.Board .Corner { filter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 0.75)); z-index: 20; /* Above Tile, below Road */ position: absolute; @@ -106,7 +106,7 @@ clip-path: polygon(15% 0%,39% 23%,39% 52%,100% 56%,100% 74%,100% 100%,80% 100%,63% 100%,62% 75%,46% 75%,47% 100%,0% 100%,0% 24%); } -.Road { +.Board .Road { position: absolute; display: flex; align-items: center; @@ -155,21 +155,21 @@ div[disabled] .Option { pointer-events: none; } -.Option { +.Board .Option { cursor: pointer; pointer-events: all; filter: brightness(115%); } -.Option .Tile-Shape, -.Option .Corner-Shape, -.Option .Road-Shape { +.Board .Option .Tile-Shape, +.Board .Option .Corner-Shape, +.Board .Option .Road-Shape { background-color: rgba(255, 255, 255, 0.5) !important; } -.Option .Tile-Shape:hover, -.Option .Corner-Shape:hover, -.Option .Road-Shape :hover{ +.Board .Option .Tile-Shape:hover, +.Board .Option .Corner-Shape:hover, +.Board .Option .Road-Shape :hover{ background-color: rgba(255, 255, 255, 0.75) !important; } diff --git a/client/src/PlayerColor.js b/client/src/PlayerColor.js index 362d99f..04ee338 100644 --- a/client/src/PlayerColor.js +++ b/client/src/PlayerColor.js @@ -1,39 +1,14 @@ import React from "react"; import Avatar from '@material-ui/core/Avatar'; -import { makeStyles } from '@material-ui/core/styles'; -import { orange,lightBlue, red, grey } from '@material-ui/core/colors'; + +import { useStyles } from './Styles.js'; import "./PlayerColor.css"; -const useStyles = makeStyles((theme) => ({ - root: { - display: 'flex', - '& > *': { - margin: theme.spacing(1), - }, - }, - R: { - color: theme.palette.getContrastText(red[500]), - backgroundColor: red[500], - }, - O: { - color: theme.palette.getContrastText(orange[500]), - backgroundColor: orange[500], - }, - W: { - color: theme.palette.getContrastText(grey[50]), - backgroundColor: grey[50], - }, - B: { - color: theme.palette.getContrastText(lightBlue[500]), - backgroundColor: lightBlue[500], - }, -})); - - const PlayerColor = ({ color }) => { const classes = useStyles(); + return ( ); diff --git a/client/src/Table.css b/client/src/Table.css index dcea2a5..7167451 100755 --- a/client/src/Table.css +++ b/client/src/Table.css @@ -36,7 +36,6 @@ background-image:url("./assets/woman-robber.png"); } - .BottomBar { display: flex; margin-right: 30rem; diff --git a/client/src/Table.js b/client/src/Table.js index 61c13e7..67c4b16 100755 --- a/client/src/Table.js +++ b/client/src/Table.js @@ -20,6 +20,7 @@ import Chat from './Chat.js'; import { CircularProgress } from "@material-ui/core"; import 'moment-timezone'; import Activities from './Activities.js'; +import BoardPieces from './BoardPieces.js'; /* Start of withRouter polyfill */ // https://reactrouter.com/docs/en/v6/faq#what-happened-to-withrouter-i-need-it @@ -992,7 +993,8 @@ class Table extends React.Component {
- { player !== undefined && + { player !== undefined && <> +
@@ -1023,7 +1025,7 @@ class Table extends React.Component { disabled={!game || !game.turn || !game.turn.roll} table={this} type={`${color}`}/>
- } + } { player === undefined &&
}
diff --git a/client/src/Winner.css b/client/src/Winner.css index b5cebd7..e287cd9 100644 --- a/client/src/Winner.css +++ b/client/src/Winner.css @@ -32,8 +32,20 @@ .Winner .Description { padding: 1em; - max-width: 20vw; box-sizing: border-box; + display: flex; + flex-direction: column; + align-items: flex-start; +} + +.Winner .Description > div { + display: inline; + margin-bottom: 1rem; + line-height: 1.25rem; +} + +.Winner .Description b { + margin: 0;/* 0.25rem;*/ } .Winner .Resource { diff --git a/client/src/Winner.js b/client/src/Winner.js index 19f1290..3c64e66 100644 --- a/client/src/Winner.js +++ b/client/src/Winner.js @@ -24,9 +24,10 @@ const Winner = ({table, color}) => { } } - let description = <>Congratulations, {name}! -

{name} won the game after {Math.floor(table.game.turns / playerCount)} turns. They - had {player.potential} unplayed Victory Point card(s).

+ let description = <> +
Congratulations, {name}!
+
{name} won the game after {Math.floor(table.game.turns / playerCount)} turns. They + had {player.potential} unplayed Victory Point card(s).
; for (let key in table.game.players) { if (key === color) { @@ -38,10 +39,10 @@ const Winner = ({table, color}) => { } let line = <> {getPlayerName(table.game.sessions, key)} finished with {tmp.points} victory points. They had {tmp.potential} unplayed Victory Point card(s). - description = <>{description}

{line}

; + description = <>{description}
{line}
; } - description = <>{description}

If everyone goes back to the Lobby, you can play again.

; + description = <>{description}
If everyone goes back to the Lobby, you can play again.
; return (