diff --git a/client/src/Board.css b/client/src/Board.css index 0447a41..f30b447 100755 --- a/client/src/Board.css +++ b/client/src/Board.css @@ -71,7 +71,8 @@ width: 40vw; max-height: 100vh; overflow: hidden; - min-width: 20em; + min-width: 100vw; + max-width: 40vw; z-index: 100; padding: 0.5em; opacity: 0.7; @@ -87,7 +88,7 @@ } .lobby { - width: calc(100vw - 1em); + width: 100vw; } .Chat { @@ -102,10 +103,11 @@ min-height: 0; } -.Chat #ChatList { +#ChatList { flex: 1; overflow: auto; scroll-behavior: smooth; + align-items: flex-start; } #ChatList .MuiListItem-gutters { @@ -129,7 +131,8 @@ #ChatList .PlayerColor { width: 1em; height: 1em; - padding: 0px; + padding: 0; + margin-top: 4px; } .Players { @@ -137,22 +140,44 @@ user-select: none; } +.PlayerSelector .PlayerColor { + width: 1em; + height: 1em; +} + .PlayerSelector { - display: flex; + display: inline-flex; + flex-wrap: wrap; flex-direction: row; justify-content: space-between; } +.PlayerSelector.MuiList-padding { + padding: 0; +} + .PlayerSelector .PlayerEntry { + flex: 1 1 0px; align-items: center; - display: flex; + display: inline-flex; flex-direction: row; - width: 50%; + min-width: 10em; +} + +.PlayerSelector .MuiTypography-body1 { + font-size: 0.8rem; + white-space: nowrap; +} + +.PlayerSelector .MuiTypography-body2 { + font-size: 0.7rem; + white-space: nowrap; } .Players .PlayerEntry { border: 1px solid rgba(0,0,0,0); border-radius: 0.5em; + min-width: 10em; } .Players .PlayerEntry[data-selectable=true]:hover { @@ -258,6 +283,8 @@ button { text-align: left; font-size: 12pt; padding: 1em; + margin: 1em; + z-index: 10000; } .Message { @@ -266,7 +293,7 @@ button { background-color: rgba(224, 224, 224); text-align: left; font-size: 12pt; - padding: 1em; + padding: 0.5em; user-select: none; } diff --git a/client/src/Board.js b/client/src/Board.js index 734cb34..38a9a56 100755 --- a/client/src/Board.js +++ b/client/src/Board.js @@ -9,7 +9,7 @@ import ListItem from '@material-ui/core/ListItem'; import ListItemAvatar from '@material-ui/core/ListItemAvatar'; import ListItemText from '@material-ui/core/ListItemText'; import { makeStyles } from '@material-ui/core/styles'; -import { deepOrange, lightBlue, red, grey } from '@material-ui/core/colors'; +import { orange, deepOrange, lightBlue, red, grey } from '@material-ui/core/colors'; import Avatar from '@material-ui/core/Avatar'; import Moment from 'react-moment'; //import moment from 'moment'; @@ -57,8 +57,8 @@ const useStyles = makeStyles((theme) => ({ backgroundColor: red[500], }, O: { - color: theme.palette.getContrastText(deepOrange[500]), - backgroundColor: deepOrange[500], + color: theme.palette.getContrastText(orange[500]), + backgroundColor: orange[500], }, W: { color: theme.palette.getContrastText(grey[500]), @@ -73,7 +73,7 @@ const useStyles = makeStyles((theme) => ({ const PlayerColor = ({ color }) => { const classes = useStyles(); return ( - + ); }; @@ -425,13 +425,14 @@ const getPlayerName = (sessions, color) => { * player's active item in the game */ const Players = ({ board }) => { const toggleSelected = (key) => { + console.log('toggle'); board.setSelected(board.game.color === key ? "" : key); } const players = []; for (let color in board.game.players) { - const item = board.game.players[color]; - if (board.game.state !== "lobby" && item.status === 'Not active') { + const item = board.game.players[color], inLobby = board.game.state === 'lobby'; + if (!inLobby && item.status === 'Not active') { continue; } const name = getPlayerName(board.game.sessions, color), @@ -442,15 +443,16 @@ const Players = ({ board }) => { data-selectable={selectable} data-selected={board.game.color === color} className="PlayerEntry" + onClick={() => { inLobby && selectable && toggleSelected(color) }} key={`player-${color}`}> - { selectable && toggleSelected(color) }} color={color}/> - { selectable && toggleSelected(color) }}primary={toggleText} secondary={( + + { item.status + ' ' } { item.status !== 'Not active' && Date.now() ? Date.now() : item.lastActive}/>} )} /> - { board.game.state !== 'lobby' && board.game.color === color && - + { !inLobby && board.game.color === color && + } )); @@ -1478,7 +1480,7 @@ class Board extends React.Component { return (
this.el = el}> this.canvas = el}> - + { game &&
{ this.state.message } {(this.state.pickName || !this.game.name) && } @@ -1487,54 +1489,55 @@ class Board extends React.Component { } - { this.state.error &&
{this.state.error}
}
} +
this.cards = el}> - { - game && game.state === "active" && - <> -
In hand
-
- - - - - -
-
Available to play
-
- - -
- - + { game && game.state === "active" && <> +
In hand
+
+ + + + +
-
-
Points
-
-
- - - +
Available to play
+
+ + +
+ + +
-
-
- - -
-
-
Stats
-
-
Points: 7
-
Cards: {this.state.total}
-
Roads remaining: 4
-
Longest road: 7
-
Cities remaining: 4
-
Settlements remaining: 5
+
Points
+
+
+ + + +
+
+
+ + +
+
+
Stats
+
+
Points: 7
+
Cards: {this.state.total}
+
Roads remaining: 4
+
Longest road: 7
+
Cities remaining: 4
+
Settlements remaining: 5
+
-
}
+ + { this.state.error &&
{this.state.error}
} +
); }