Skip to content

Commit

Permalink
Merge pull request #585 from battlecode/jerrym-tournament-results
Browse files Browse the repository at this point in the history
Show replay url for tournament
  • Loading branch information
j-mao authored Jan 18, 2023
2 parents b92dee7 + c9dd529 commit 3e009f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ class App extends Component {
<Route
path={`/:episode/tournament_matches/:tournament_id`}
component={(props) => (
<QueueHistory {...props} episode={this.state.episode} />
<QueueHistory
{...props}
episode={this.state.episode}
episode_info={this.state.episode_info}
/>
)}
key="tournaments"
/>,
Expand Down
19 changes: 19 additions & 0 deletions frontend/src/views/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class QueueHistory extends Component {
<th>Team (Δ)</th>
<th>Ranked</th>
<th>Status</th>
{this.state.tournament_id !== null && <th>Replay</th>}
<th>Creation time</th>
</tr>
</thead>
Expand All @@ -138,6 +139,22 @@ class QueueHistory extends Component {
participation1 = s.participants[0];
participation2 = s.participants[1];
}
let replay_entry = <td></td>;
if (
this.state.tournament_id !== null &&
s.replay_url !== null
) {
replay_entry = (
<td>
<a
href={`https://releases.battlecode.org/client/${this.props.episode_info.artifact_name}/${this.props.episode_info.release_version_public}/visualizer.html?${s.replay_url}`}
target="_blank"
>
Watch
</a>
</td>
);
}
if (s.status == "ERR") {
stat_entry = (
<td>
Expand Down Expand Up @@ -211,6 +228,8 @@ class QueueHistory extends Component {
</td>
<td>{s.is_ranked ? "Ranked" : "Unranked"}</td>
{stat_entry}
{this.state.tournament_id !== null &&
replay_entry}
<td>{created_date_string}</td>
</tr>
);
Expand Down

0 comments on commit 3e009f8

Please sign in to comment.