2023-12-20 18:21:18 -05:00
|
|
|
import {client} from "../index.js";
|
|
|
|
import AbstractAuthentifiedView from "./abstracts/AbstractAuthentifiedView.js";
|
|
|
|
|
2023-12-21 05:35:47 -05:00
|
|
|
export default class extends AbstractAuthentifiedView
|
|
|
|
{
|
|
|
|
constructor(params)
|
|
|
|
{
|
2023-12-20 18:21:18 -05:00
|
|
|
super(params, "Tournament");
|
|
|
|
this.id = params.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
async postInit()
|
|
|
|
{
|
|
|
|
let tournament = await client.tournaments.getTournament(this.id);
|
|
|
|
|
|
|
|
if (tournament === null)
|
|
|
|
return 1;
|
|
|
|
|
2023-12-21 05:35:47 -05:00
|
|
|
document.getElementById("name").innerText = tournament.name;
|
2023-12-20 18:21:18 -05:00
|
|
|
document.getElementById("nb_players").innerText = tournament.nb_players;
|
|
|
|
document.getElementById("nb_players_by_game").innerText = tournament.nb_players_by_game;
|
|
|
|
document.getElementById("level").innerText = tournament.level;
|
|
|
|
document.getElementById("state").innerText = tournament.state;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
async getHtml()
|
|
|
|
{
|
|
|
|
return `
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th id="name">Loading...</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>Number of players</td>
|
|
|
|
<td id="nb_players">Loading...</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Number of players by game</td>
|
|
|
|
<td id="nb_players_by_game">Loading...</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Number of round</td>
|
|
|
|
<td id="level">Loading...</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>status</td>
|
|
|
|
<td id="state">Loading...</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
`
|
|
|
|
}
|
|
|
|
}
|