-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge: Pull request #78 from ShrimpCryptid/feature/hide-player-info
fix: Unknown player roles are removed from player list
- Loading branch information
Showing
7 changed files
with
103 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,48 @@ | ||
import React, {Component} from 'react'; | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import './PolicyDisplay.css'; | ||
import {LIBERAL} from "../GlobalDefinitions"; | ||
import "./PolicyDisplay.css"; | ||
import { LIBERAL } from "../GlobalDefinitions"; | ||
import LiberalPolicy from "../assets/policy-liberal.png"; | ||
import FascistPolicy from "../assets/policy-fascist.png"; | ||
|
||
class PolicyDisplay extends Component { | ||
render() { | ||
return ( | ||
<div id={"legislative-policy-container"}> | ||
{this.props.policies.map((value, index) => { | ||
let policyName = value === LIBERAL ? "liberal" : "fascist"; | ||
return ( | ||
<img | ||
id={"legislative-policy"} | ||
className={this.props.allowSelection ? "selectable " + (index === this.props.selection ? " selected" : ""):""} | ||
onClick={() => this.props.onClick(index)} | ||
disabled={!this.props.allowSelection} | ||
src={value === LIBERAL ? LiberalPolicy : FascistPolicy} // Toggles fascist/liberal policy | ||
alt={"A " + policyName + " policy." + (this.props.allowSelection ? " Click to select." : "")} | ||
/> | ||
); | ||
} )} | ||
</div> | ||
); | ||
} | ||
render() { | ||
return ( | ||
<div id={"legislative-policy-container"}> | ||
{this.props.policies.map((value, index) => { | ||
let policyName = value === LIBERAL ? "liberal" : "fascist"; | ||
return ( | ||
<img | ||
id={"legislative-policy"} | ||
key={index} | ||
className={ | ||
this.props.allowSelection | ||
? "selectable " + | ||
(index === this.props.selection ? " selected" : "") | ||
: "" | ||
} | ||
onClick={() => this.props.onClick(index)} | ||
disabled={!this.props.allowSelection} | ||
src={value === LIBERAL ? LiberalPolicy : FascistPolicy} // Toggles fascist/liberal policy | ||
alt={ | ||
"A " + | ||
policyName + | ||
" policy." + | ||
(this.props.allowSelection ? " Click to select." : "") | ||
} | ||
/> | ||
); | ||
})} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
PolicyDisplay.propTypes = { | ||
policies: PropTypes.array.isRequired, | ||
onClick: PropTypes.func, // If undefined, the policies cannot be selected. | ||
selection: PropTypes.number, | ||
allowSelection: PropTypes.bool, | ||
policies: PropTypes.array.isRequired, | ||
onClick: PropTypes.func, // If undefined, the policies cannot be selected. | ||
selection: PropTypes.number, | ||
allowSelection: PropTypes.bool, | ||
}; | ||
|
||
export default PolicyDisplay; | ||
export default PolicyDisplay; |