Replace non working Hive-Url with link to observatory profile

This commit is contained in:
Absurdon 2018-03-18 18:23:09 +01:00
parent b68556465a
commit 0a956b80bd
4 changed files with 2786 additions and 914 deletions

View file

@ -1,10 +1,10 @@
import {AssumeUserIdButton} from "javascripts/components/user";
import { AssumeUserIdButton } from "javascripts/components/user";
const React = require("react");
const helper = require("javascripts/helper");
const enslUrl = helper.enslUrl;
const rankVotes = helper.rankVotes;
const hiveUrl = helper.hiveUrl;
const obsUrl = helper.observatoryUrl;
const SelectPlayerButton = React.createClass({
propTypes: {
@ -158,7 +158,7 @@ const ProgressBar = React.createClass({
const GatherProgress = React.createClass({
stateDescription() {
switch(this.props.gather.state) {
switch (this.props.gather.state) {
case "gathering":
return "Waiting for more gatherers.";
case "election":
@ -497,7 +497,7 @@ const ServerVoting = React.createClass({
<div className="panel panel-primary">
<div className="panel-heading">
{votes === 2 ? "Server Votes" :
`Please Vote for a Server. ${2 - votes} votes remaining` }
`Please Vote for a Server. ${2 - votes} votes remaining`}
</div>
<div className="list-group gather-voting">
{servers}
@ -562,7 +562,7 @@ const MapVoting = React.createClass({
<div className="panel panel-primary">
<div className="panel-heading">
{votes === 2 ? "Map Votes" :
`Please Vote for a Map. ${2 - votes} votes remaining` }
`Please Vote for a Map. ${2 - votes} votes remaining`}
</div>
<div className="list-group gather-voting">
{maps}
@ -631,7 +631,7 @@ const Gather = exports.Gather = React.createClass({
</div>
</div>
<Gatherers gather={gather} user={user} thisGatherer={thisGatherer}
socket={socket} soundController={soundController}/>
socket={socket} soundController={soundController} />
{gatherTeams}
{voting}
</div>
@ -643,7 +643,7 @@ const Gather = exports.Gather = React.createClass({
<div className="panel-heading">{gather.name} ({gather.description})</div>
</div>
<Gatherers gather={gather} user={user} thisGatherer={thisGatherer}
socket={socket} soundController={soundController}/>
socket={socket} soundController={soundController} />
</div>
);
}
@ -842,7 +842,7 @@ const GathererListItem = React.createClass({
<span>
<SelectPlayerButton gatherer={gatherer}
gather={gather}
socket={socket}/>
socket={socket} />
</span>
);
} else {
@ -864,7 +864,7 @@ const GathererListItem = React.createClass({
let adminOptions;
if ((user && user.admin) || (user && user.moderator)) {
adminOptions = [
<hr key="line"/>,
<hr key="line" />,
<dt key="title">Admin</dt>,
<dd key="adminmenu">
<button
@ -910,9 +910,9 @@ const GathererListItem = React.createClass({
<a href={enslUrl(gatherer)}
className="btn btn-xs btn-primary"
target="_blank">ENSL Profile</a>&nbsp;
<a href={hiveUrl(gatherer)}
<a href={obsUrl(gatherer)}
className="btn btn-xs btn-primary"
target="_blank">Hive Profile</a>
target="_blank">Observatory Profile</a>
</dd>
{adminOptions}
</dl>
@ -952,7 +952,7 @@ const Gatherers = React.createClass({
.map(gatherer => {
return <GathererListItem socket={socket} gatherer={gatherer} thisGatherer={thisGatherer}
soundController={this.props.soundController} key={gatherer.id}
user={user} gather={gather}/>
user={user} gather={gather} />
});
if (gather.gatherers.length) {
@ -1008,7 +1008,7 @@ const CompletedGather = exports.CompletedGather = React.createClass({
gatherInfo.push(<GatherTeams gather={gather} key="gatherteams" />);
gatherInfo.push(<GatherVotingResults gather={gather}
maps={maps} key="gathervotingresults"
servers={servers}/>);
servers={servers} />);
}
return (
<div>

View file

@ -1,9 +1,9 @@
import {LifeformIcons} from "javascripts/components/gather";
import { LifeformIcons } from "javascripts/components/gather";
const React = require("react");
const helper = require("javascripts/helper");
const enslUrl = helper.enslUrl;
const hiveUrl = helper.hiveUrl;
const modalId = helper.modalId;
const obsUrl = helper.observatoryUrl;
const Ps = require('perfect-scrollbar');
const DisconnectUserButton = React.createClass({
@ -89,7 +89,7 @@ const UserModal = React.createClass({
<h4 className="modal-title">
<img src="blank.gif"
className={"flag flag-" + ((user.country === null) ? "eu" :
user.country.toLowerCase()) }
user.country.toLowerCase())}
alt={user.country} />&nbsp;
{user.username}
</h4>
@ -104,7 +104,7 @@ const UserModal = React.createClass({
<tbody>
<tr>
<td>Lifeforms</td>
<td><LifeformIcons gatherer={{user: user}} /></td>
<td><LifeformIcons gatherer={{ user: user }} /></td>
</tr>
<tr>
<td>Links</td>
@ -112,9 +112,9 @@ const UserModal = React.createClass({
<a href={enslUrl(user)}
className="btn btn-xs btn-primary"
target="_blank">ENSL Profile</a>&nbsp;
<a href={hiveUrl({user: user})}
<a href={obsUrl({ user: user })}
className="btn btn-xs btn-primary"
target="_blank">Hive Profile</a>
target="_blank">Observatory Profile</a>
</td>
</tr>
{hiveStats}
@ -232,7 +232,7 @@ const ProfileModal = exports.ProfileModal = React.createClass({
handleAbilityChange(e) {
let abilities = this.state.abilities;
abilities[e.target.name] = e.target.checked;
this.setState({abilities: abilities});
this.setState({ abilities: abilities });
},
handleSkillChange(e) {
@ -261,7 +261,7 @@ const ProfileModal = exports.ProfileModal = React.createClass({
let skillLevel = user.profile.skill;
let skillLevels = _.uniq(["Low Skill", "Medium Skill", "High Skill", skillLevel])
.filter(skill => { return typeof skill === 'string' })
.map(skill => { return <option key={skill} value={skill}>{skill}</option>});
.map(skill => { return <option key={skill} value={skill}>{skill}</option> });
return (
<div className="modal-dialog">

View file

@ -69,7 +69,16 @@ const storageAvailable = exports.storageAvailable = (type) => {
storage.removeItem(x);
return true;
}
catch(e) {
catch (e) {
return false;
}
};
const observatoryUrl = exports.observatoryUrl = (gatherer) => {
const steamId = gatherer.user.steam.id;
if (steamId) {
return `https://observatory.morrolan.ch/player?steam_id=STEAM_${steamId}`;
} else {
return null;
}
};

3341
package-lock.json generated

File diff suppressed because it is too large Load diff