Address react warnings vis implementing unique keys

This commit is contained in:
Chris Blanchard 2016-04-01 14:02:26 +01:00
parent 2292e374b3
commit fd9a9e94fb
5 changed files with 29 additions and 21 deletions

View file

@ -864,9 +864,9 @@ const GathererListItem = React.createClass({
let adminOptions;
if ((user && user.admin) || (user && user.moderator)) {
adminOptions = [
<hr />,
<dt>Admin</dt>,
<dd>
<hr key="line"/>,
<dt key="title">Admin</dt>,
<dd key="adminmenu">
<button
className="btn btn-xs btn-danger"
value={gatherer.user.id}
@ -951,7 +951,7 @@ const Gatherers = React.createClass({
})
.map(gatherer => {
return <GathererListItem socket={socket} gatherer={gatherer} thisGatherer={thisGatherer}
soundController={this.props.soundController}
soundController={this.props.soundController} key={gatherer.id}
user={user} gather={gather}/>
});
@ -1004,9 +1004,9 @@ const CompletedGather = exports.CompletedGather = React.createClass({
let maps = this.props.maps;
let servers = this.props.servers;
if (this.state.show) {
gatherInfo.push(<GatherTeams gather={gather} />);
gatherInfo.push(<GatherTeams gather={gather} key="gatherteams" />);
gatherInfo.push(<GatherVotingResults gather={gather}
maps={maps}
maps={maps} key="gathervotingresults"
servers={servers}/>);
}
return (

View file

@ -15,7 +15,7 @@ const ArchivedGathers = exports.ArchivedGathers = React.createClass({
})
.map((archivedGather, index) => {
return <CompletedGather
id={archivedGather.gather.done.time}
key={archivedGather.gather.done.time}
show={(index === 0) ? true : false}
gather={archivedGather.gather}
maps={this.props.maps}

View file

@ -156,10 +156,12 @@ const GatherPage = React.createClass({
modal: null,
gatherPool: {
classic: {
gatherers: []
gatherers: [],
type: "classic"
},
casual: {
gatherers: []
gatherers: [],
type: "casual"
}
},
currentGather: "classic",

View file

@ -321,16 +321,22 @@ const ChatMessage = React.createClass({
);
}
return self.autolink(message, {
target: "_blank",
rel: "nofollow"
}).map((elem) => {
if (_.isString(elem)) {
return self.emojify(elem);
} else {
return elem;
return (
<p className="wordwrap">
{
self.autolink(message, {
target: "_blank",
rel: "nofollow"
}).map((elem) => {
if (_.isString(elem)) {
return self.emojify(elem);
} else {
return elem;
}
})
}
});
</p>
);
},
render() {
@ -360,7 +366,7 @@ const ChatMessage = React.createClass({
{deleteButton}
</small>
</div>
<p className="wordwrap">{this.messageContent()}</p>
{this.messageContent()}
</div>
</li>
);

View file

@ -37,9 +37,9 @@ function Gather (options) {
this.REGATHER_THRESHOLD = Math.floor(this.teamSize / 2) + 2;
this.type = options.type || "public";
this.type = options.type || "classic";
this.name = options.name || "Public Gather";
this.name = options.name || "Classic Gather";
this.description = options.description || "No player requirements";