working in tournament.. some fixes, but still many bugs

This commit is contained in:
CHIBOUB Chakib
2024-09-01 02:21:37 +02:00
parent c0634938a6
commit fecc91447b
7 changed files with 257 additions and 19 deletions

View File

@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tournament Brackets</title>
<style>
.tournament-bracket {
display: flex;
flex-direction: row;
justify-content: space-around;
font-family: Arial, sans-serif;
}
.round {
display: flex;
flex-direction: column;
justify-content: space-around;
width: 200px;
}
.match {
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
overflow: hidden;
}
.player {
padding: 5px;
background-color: #f0f0f0;
border-bottom: 1px solid #ccc;
}
.player.winner {
font-weight: bold;
background-color: #e6ffe6;
}
.player.loser {
color: #999;
}
.score {
float: right;
font-weight: normal;
}
.connector {
border-right: 2px solid #ccc;
height: 50px;
position: relative;
left: 200px;
}
.connector:before, .connector:after {
content: '';
position: absolute;
left: 0;
border-top: 2px solid #ccc;
width: 10px;
}
.connector:before {
top: 0;
}
.connector:after {
bottom: 0;
}
</style>
</head>
<body>
<div class="tournament-bracket">
{% for round in tournament_rounds %}
<div class="round">
<h3>Round {{ forloop.counter }}</h3>
{% for match in round %}
<div class="match">
<div class="player {% if match.winner == match.player1 %}winner{% elif match.winner %}loser{% endif %}">
{{ match.player1 }}
{% if match.score1 is not None %}<span class="score">{{ match.score1 }}</span>{% endif %}
</div>
<div class="player {% if match.winner == match.player2 %}winner{% elif match.winner %}loser{% endif %}">
{{ match.player2|default:"BYE" }}
{% if match.score2 is not None %}<span class="score">{{ match.score2 }}</span>{% endif %}
</div>
</div>
{% if not forloop.last %}<div class="connector"></div>{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</body>
</html>

View File

@@ -1,10 +1,20 @@
<!-- templates/tournament_waiting_room.html -->
<!-- pong/tournament_waiting_room.html -->
<div class="tournament-waiting-room">
<h2>Tournament Waiting Room</h2>
<p>Players currently waiting: {{ players|length }}</p>
<p>Players currently waiting: {{ players_count }}</p>
<p>Minimum players needed to start: {{ min_players_to_start }}</p>
<h3>Players:</h3>
<ul>
{% for player in players %}
<li>{{ player }}</li>
{% endfor %}
{% for player in players %}
<li>{{ player }}</li>
{% endfor %}
</ul>
{% if players_count >= min_players_to_start %}
<button id="start-tournament-btn">Start Tournament</button>
{% else %}
<p>Waiting for more players to join...</p>
{% endif %}
</div>