player state passed into gameboard

This commit is contained in:
Mikayla Dobson
2022-04-16 14:22:45 -05:00
parent 42c15e2160
commit b272df9b39
6 changed files with 65 additions and 4 deletions

View File

@@ -59,10 +59,18 @@ export default function GameBoard() {
return (
<div className="gameboard">
<h1 className="gameboard-title">SPLINTER</h1>
<a href='/' className="gameboard-title">SPLINTER</a>
<div>
<h2>Players:</h2>
{state.players.map(player => <p key={`player-${v4()}`}>{player}</p>)}
{state.players.map(player => {
return (
<div className="player-info">
<p>{player.name}</p>
<p>{player.points && `Score: ${player.points}`}</p>
</div>
)
})
}
</div>
<div className="gameboard-row">

View File

@@ -58,7 +58,26 @@ export default function LocalMultiForm() {
let toSubmit = [];
let iter = 0;
while (iter < players) {
toSubmit.push(allPlayerNames[iter]);
toSubmit.push({
name: allPlayerNames[iter],
tokens: {
cedar: 0,
birch: 0,
walnut: 0,
mahogany: 0,
cherry: 0,
resin: 0,
},
cards: {
cedar: 0,
birch: 0,
walnut: 0,
mahogany: 0,
cherry: 0,
},
points: 0,
spirits: 0,
});
iter++;
}

View File

@@ -6,7 +6,7 @@ import { TierThreeDeck } from './TierThreeDeck';
import { Spirits } from '../components/Game/Spirits';
const initialGameState = {
players: ['no players'],
players: [{name: 'no players', inventory: null, cards: null}],
materials: {
cards: {
tierOneRemaining: TierOneDeck,

View File

@@ -1,4 +1,6 @@
.gameboard-title {
text-decoration: none;
font-size: 2rem;
font-weight: bold;
}