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;
}

27
package-lock.json generated Normal file
View File

@@ -0,0 +1,27 @@
{
"name": "splinter",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"uuid": "^8.3.2"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
}
},
"dependencies": {
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
}

5
package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"uuid": "^8.3.2"
}
}