Add teamspeak links

This commit is contained in:
Chris Blanchard 2015-08-27 12:57:35 +01:00
parent c0d2ae6613
commit 9578b72ac8
2 changed files with 229 additions and 0 deletions

View file

@ -263,6 +263,72 @@ var GatherProgress = React.createClass({
}
});
var TeamSpeakButton = React.createClass({
getDefaultProps() {
let password = "ns2gather";
return {
url: "ts3server://ensl.org/",
password: password,
alien: {
channel: "NS2 Gather/Gather #1/Alien (Team Y)",
password: password
},
marine: {
channel: "NS2 Gather/Gather #1/Marine (Team X)",
password: password
}
};
},
marineUrl() {
this.teamSpeakUrl(this.props.marine);
},
alienUrl() {
this.teamSpeakUrl(this.props.alien);
},
teamSpeakUrl(conn) {
let params = `channel=${encodeURIComponent(conn.channel)}&channelpassword=${encodeURIComponent(conn.password)}`;
return (`${this.props.url}?${params}`);
},
render() {
return (
<div className="btn-group dropup">
<button type="button" className="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Teamspeak <span className="caret"></span>
</button>
<ul className="dropdown-menu">
<li><a href={this.props.url}>Join Teamspeak Lobby</a></li>
<li><a href={this.marineUrl()}>Join Marine Teamspeak</a></li>
<li><a href={this.alienUrl()}>Join Alien Teamspeak</a></li>
<li role="separator" className="divider"></li>
<li><a href="#" data-toggle="modal" data-target="#teamspeakmodal">Get Teamspeak Info</a></li>
</ul>
<div className="modal fade text-left" id="teamspeakmodal">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<button type="button" className="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 className="modal-title">Teamspeak Server Information</h4>
</div>
<div className="modal-body">
<dl className="dl-horizontal">
<dt>Server</dt>
<dd>{this.props.url}</dd>
<dt>Password</dt>
<dd>{this.props.password}</dd>
<dt>Marine Channel</dt>
<dd>{this.props.marine.channel}</dd>
<dt>Alien Channel</dt>
<dd>{this.props.alien.channel}</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
);
}
});
var GatherActions = React.createClass({
joinGather(e) {
e.preventDefault();
@ -338,6 +404,7 @@ var GatherActions = React.createClass({
return (
<div className="panel-footer text-right">
<ul className="list-inline no-bottom">
<TeamSpeakButton />
{confirmTeam}
{inviteButton}
{joinButton}

View file

@ -328,6 +328,167 @@ var GatherProgress = React.createClass({
}
});
var TeamSpeakButton = React.createClass({
displayName: "TeamSpeakButton",
getDefaultProps: function getDefaultProps() {
var password = "ns2gather";
return {
url: "ts3server://ensl.org/",
password: password,
alien: {
channel: "NS2 Gather/Gather #1/Alien (Team Y)",
password: password
},
marine: {
channel: "NS2 Gather/Gather #1/Marine (Team X)",
password: password
}
};
},
marineUrl: function marineUrl() {
this.teamSpeakUrl(this.props.marine);
},
alienUrl: function alienUrl() {
this.teamSpeakUrl(this.props.alien);
},
teamSpeakUrl: function teamSpeakUrl(conn) {
var params = "channel=" + encodeURIComponent(conn.channel) + "&channelpassword=" + encodeURIComponent(conn.password);
return this.props.url + "?" + params;
},
render: function render() {
return React.createElement(
"div",
{ className: "btn-group dropup" },
React.createElement(
"button",
{ type: "button", className: "btn btn-primary dropdown-toggle", "data-toggle": "dropdown", "aria-haspopup": "true", "aria-expanded": "false" },
"Teamspeak ",
React.createElement("span", { className: "caret" })
),
React.createElement(
"ul",
{ className: "dropdown-menu" },
React.createElement(
"li",
null,
React.createElement(
"a",
{ href: this.props.url },
"Join Teamspeak Lobby"
)
),
React.createElement(
"li",
null,
React.createElement(
"a",
{ href: this.marineUrl() },
"Join Marine Teamspeak"
)
),
React.createElement(
"li",
null,
React.createElement(
"a",
{ href: this.alienUrl() },
"Join Alien Teamspeak"
)
),
React.createElement("li", { role: "separator", className: "divider" }),
React.createElement(
"li",
null,
React.createElement(
"a",
{ href: "#", "data-toggle": "modal", "data-target": "#teamspeakmodal" },
"Get Teamspeak Info"
)
)
),
React.createElement(
"div",
{ className: "modal fade text-left", id: "teamspeakmodal" },
React.createElement(
"div",
{ className: "modal-dialog" },
React.createElement(
"div",
{ className: "modal-content" },
React.createElement(
"div",
{ className: "modal-header" },
React.createElement(
"button",
{ type: "button", className: "close", "data-dismiss": "modal", "aria-label": "Close" },
React.createElement(
"span",
{ "aria-hidden": "true" },
"×"
)
),
React.createElement(
"h4",
{ className: "modal-title" },
"Teamspeak Server Information"
)
),
React.createElement(
"div",
{ className: "modal-body" },
React.createElement(
"dl",
{ className: "dl-horizontal" },
React.createElement(
"dt",
null,
"Server"
),
React.createElement(
"dd",
null,
this.props.url
),
React.createElement(
"dt",
null,
"Password"
),
React.createElement(
"dd",
null,
this.props.password
),
React.createElement(
"dt",
null,
"Marine Channel"
),
React.createElement(
"dd",
null,
this.props.marine.channel
),
React.createElement(
"dt",
null,
"Alien Channel"
),
React.createElement(
"dd",
null,
this.props.alien.channel
)
)
)
)
)
)
);
}
});
var GatherActions = React.createClass({
displayName: "GatherActions",
@ -429,6 +590,7 @@ var GatherActions = React.createClass({
React.createElement(
"ul",
{ className: "list-inline no-bottom" },
React.createElement(TeamSpeakButton, null),
confirmTeam,
inviteButton,
joinButton