Skip to content
Snippets Groups Projects
Commit 6548dce6 authored by Joni Laukka's avatar Joni Laukka
Browse files

send and receive faction colour

parent 512062e6
No related branches found
No related tags found
2 merge requests!26Development,!24Faction color edit form
...@@ -23,14 +23,14 @@ export class EditGameForm extends React.Component { ...@@ -23,14 +23,14 @@ export class EditGameForm extends React.Component {
}, },
factionNameInput: "", // >= 2 chars factionNameInput: "", // >= 2 chars
factionPasswordInput: "", // >= 3 chars factionPasswordInput: "", // >= 3 chars
factionColorInput: "#852222",
factions: [], factions: [],
objectivePointDescriptionInput: "", // >= 7 objectivePointDescriptionInput: "", // >= 7
objectivePointMultiplierInput: "", // number objectivePointMultiplierInput: "", // number
objectivePoints: [], objectivePoints: [],
capture_time: 300, capture_time: 300,
confirmation_time: 60, confirmation_time: 60,
displayColorPicker: false, displayColorPicker: false
color: "#852222"
}; };
this.handleMapDrag = this.handleMapDrag.bind(this); this.handleMapDrag = this.handleMapDrag.bind(this);
...@@ -67,9 +67,11 @@ export class EditGameForm extends React.Component { ...@@ -67,9 +67,11 @@ export class EditGameForm extends React.Component {
this.setState(state => { this.setState(state => {
let factions = state.factions; let factions = state.factions;
console.log(this.state.factionColorInput);
factions.push({ factions.push({
factionName: this.state.factionNameInput, factionName: this.state.factionNameInput,
factionPassword: this.state.factionPasswordInput, factionPassword: this.state.factionPasswordInput,
colour: this.state.factionColorInput,
multiplier: 1 multiplier: 1
}); });
return { return {
...@@ -302,7 +304,8 @@ export class EditGameForm extends React.Component { ...@@ -302,7 +304,8 @@ export class EditGameForm extends React.Component {
return { return {
factionName: faction.factionName, factionName: faction.factionName,
factionPassword: faction.factionPassword, factionPassword: faction.factionPassword,
multiplier: 1 multiplier: 1,
colour: faction.colour
}; };
}); });
...@@ -353,7 +356,7 @@ export class EditGameForm extends React.Component { ...@@ -353,7 +356,7 @@ export class EditGameForm extends React.Component {
const faction = this.state.factions[i]; const faction = this.state.factions[i];
factions.push( factions.push(
<li key={faction.factionName}> <li key={faction.factionName}>
<div> <div style={{ color: faction.colour }}>
{faction.factionName} : {faction.factionPassword} {faction.factionName} : {faction.factionPassword}
</div> </div>
<button <button
...@@ -392,7 +395,7 @@ export class EditGameForm extends React.Component { ...@@ -392,7 +395,7 @@ export class EditGameForm extends React.Component {
width: "36px", width: "36px",
height: "14px", height: "14px",
borderRadius: "2px", borderRadius: "2px",
background: `${this.state.color}` background: `${this.state.factionColorInput}`
}, },
swatch: { swatch: {
padding: "5px", padding: "5px",
...@@ -540,8 +543,10 @@ export class EditGameForm extends React.Component { ...@@ -540,8 +543,10 @@ export class EditGameForm extends React.Component {
onClick={() => this.setState({ displayColorPicker: false })} onClick={() => this.setState({ displayColorPicker: false })}
> >
<SketchPicker <SketchPicker
color={this.state.color} color={this.state.factionColorInput}
onChangeComplete={color => this.setState({ color: color.hex })} onChangeComplete={color =>
this.setState({ factionColorInput: color.hex })
}
/> />
</div> </div>
)} )}
......
...@@ -51,7 +51,7 @@ class GameList extends React.Component { ...@@ -51,7 +51,7 @@ class GameList extends React.Component {
}, },
() => { () => {
// taking the changed gameID to UserMap.js (GameList.js -> Header.js -> App.js -> UserMap.js) // taking the changed gameID to UserMap.js (GameList.js -> Header.js -> App.js -> UserMap.js)
this.props.handleGameChange(this.state.selectedGame); //this.props.handleGameChange(this.state.selectedGame);
} }
); );
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment