2019-12-08 22:43:49 +01:00
|
|
|
/*** @jsx React.DOM */
|
|
|
|
|
|
|
|
var valid_versions = Object.keys(window.versions);
|
|
|
|
var pagenav = new History(valid_versions);
|
|
|
|
|
|
|
|
var profile_view = React.createClass({
|
|
|
|
|
|
|
|
getInitialState: function(props) {
|
|
|
|
var profiles = Object.keys(window.player);
|
|
|
|
return {
|
|
|
|
player: window.player,
|
|
|
|
profiles: profiles,
|
|
|
|
version: pagenav.getInitialState(profiles[profiles.length - 1]),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
componentDidMount: function() {
|
|
|
|
pagenav.onChange(function(version) {
|
|
|
|
this.setState({version: version});
|
|
|
|
}.bind(this));
|
|
|
|
this.refreshProfile();
|
|
|
|
},
|
|
|
|
|
|
|
|
refreshProfile: function() {
|
|
|
|
AJAX.get(
|
|
|
|
Link.get('refresh'),
|
|
|
|
function(response) {
|
|
|
|
var profiles = Object.keys(response.player);
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
player: response.player,
|
|
|
|
profiles: profiles,
|
|
|
|
});
|
|
|
|
setTimeout(this.refreshProfile, 5000);
|
|
|
|
}.bind(this)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2022-10-07 02:32:37 +02:00
|
|
|
renderJubility: function(player) {
|
|
|
|
return(
|
|
|
|
// version == prop ( No Jubility )
|
|
|
|
this.state.version == 10 ?
|
|
|
|
null
|
|
|
|
:
|
|
|
|
// version == qubell ( No Jubility )
|
|
|
|
this.state.version == 11 ?
|
|
|
|
null
|
|
|
|
:
|
|
|
|
// version == festo
|
|
|
|
this.state.version == 13 ?
|
2022-10-08 03:32:59 +02:00
|
|
|
<LabelledSection label="Jubility">
|
|
|
|
{(player.common_jubility+player.pick_up_jubility).toFixed(1)}
|
|
|
|
</LabelledSection>
|
2022-10-07 02:32:37 +02:00
|
|
|
:
|
|
|
|
// Default which version >= Saucer except qubell and festo
|
|
|
|
this.state.version >= 8 ?
|
2022-10-08 03:32:59 +02:00
|
|
|
<LabelledSection label="Jubility">
|
|
|
|
{player.jubility / 100}
|
|
|
|
</LabelledSection>
|
2022-10-07 02:32:37 +02:00
|
|
|
:
|
|
|
|
null
|
|
|
|
)
|
|
|
|
},
|
|
|
|
|
2019-12-08 22:43:49 +01:00
|
|
|
render: function() {
|
|
|
|
if (this.state.player[this.state.version]) {
|
|
|
|
var player = this.state.player[this.state.version];
|
2022-10-07 02:32:37 +02:00
|
|
|
var item = Object.keys(window.versions).map(function(k){
|
|
|
|
return window.versions[k]
|
|
|
|
})
|
2019-12-08 22:43:49 +01:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className="section">
|
|
|
|
<h3>{player.name}'s profile</h3>
|
|
|
|
{this.state.profiles.map(function(version) {
|
|
|
|
return (
|
|
|
|
<Nav
|
|
|
|
title={window.versions[version]}
|
|
|
|
active={this.state.version == version}
|
|
|
|
onClick={function(event) {
|
|
|
|
if (this.state.version == version) { return; }
|
|
|
|
this.setState({version: version});
|
|
|
|
pagenav.navigate(version);
|
|
|
|
}.bind(this)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}.bind(this))}
|
|
|
|
</div>
|
|
|
|
<div className="section">
|
|
|
|
<LabelledSection label="User ID">{player.extid}</LabelledSection>
|
2022-10-08 03:32:59 +02:00
|
|
|
<LabelledSection label="Profile Created">
|
2019-12-08 22:43:49 +01:00
|
|
|
<Timestamp timestamp={player.first_play_time}/>
|
|
|
|
</LabelledSection>
|
2022-10-08 03:32:59 +02:00
|
|
|
<LabelledSection label="Last Played">
|
2019-12-08 22:43:49 +01:00
|
|
|
<Timestamp timestamp={player.last_play_time}/>
|
|
|
|
</LabelledSection>
|
2022-10-08 03:32:59 +02:00
|
|
|
<LabelledSection label="Total Rounds">
|
2019-12-08 22:43:49 +01:00
|
|
|
{player.plays}回
|
|
|
|
</LabelledSection>
|
2022-10-08 03:32:59 +02:00
|
|
|
</div>
|
|
|
|
<div className="section">
|
|
|
|
<LabelledSection label="Excellent Clears">
|
2022-10-07 02:32:37 +02:00
|
|
|
{player.ex_count}回
|
|
|
|
</LabelledSection>
|
2022-10-08 03:32:59 +02:00
|
|
|
<LabelledSection label="Full Combo Clears">
|
2022-10-07 02:32:37 +02:00
|
|
|
{player.fc_count}回
|
|
|
|
</LabelledSection>
|
|
|
|
{this.renderJubility(player)}
|
2019-12-08 22:43:49 +01:00
|
|
|
</div>
|
2022-10-08 03:32:59 +02:00
|
|
|
{this.state.version >= 12 ? <div className="section">
|
|
|
|
<b>
|
|
|
|
<a href={Link.get('jubility', null, this.state.version)}>{ window.own_profile ?
|
|
|
|
<span>Your Jubility Breakdown →</span> :
|
|
|
|
<span>{player.name}'s Jubility Breakdown →</span>
|
|
|
|
}</a>
|
|
|
|
</b>
|
|
|
|
</div> : null}
|
2019-12-08 22:43:49 +01:00
|
|
|
<div className="section">
|
|
|
|
<a href={Link.get('records')}>{ window.own_profile ?
|
|
|
|
<span>view your records</span> :
|
|
|
|
<span>view {player.name}'s records</span>
|
|
|
|
}</a>
|
|
|
|
<span className="separator">·</span>
|
|
|
|
<a href={Link.get('scores')}>{ window.own_profile ?
|
|
|
|
<span>view all your scores</span> :
|
|
|
|
<span>view all {player.name}'s scores</span>
|
|
|
|
}</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
} else {
|
2022-10-07 02:32:37 +02:00
|
|
|
var item = Object.keys(window.versions).map(function(k){
|
|
|
|
return window.versions[k]
|
|
|
|
})
|
2019-12-08 22:43:49 +01:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className="section">
|
2022-10-07 02:32:37 +02:00
|
|
|
<SelectVersion
|
|
|
|
name="version"
|
|
|
|
value={ item.indexOf(item[this.state.version - 1]) }
|
|
|
|
versions={ item }
|
|
|
|
onChange={function(event) {
|
|
|
|
var version = item.indexOf(item[event]) + 1
|
|
|
|
if (this.state.version == version) { return; }
|
|
|
|
this.setState({version: version});
|
|
|
|
pagenav.navigate(version);
|
|
|
|
}.bind(this)}
|
|
|
|
/>
|
2019-12-08 22:43:49 +01:00
|
|
|
</div>
|
|
|
|
<div className="section">
|
|
|
|
This player has no profile for {window.versions[this.state.version]}!
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
React.createElement(profile_view, null),
|
|
|
|
document.getElementById('content')
|
|
|
|
);
|