Private
Public Access
1
0

new: usr: a new feature came up - the abandoned plays can be restored, if both users are registered users #7

This commit is contained in:
2026-04-19 18:04:01 +02:00
parent c79584c7d2
commit 991b114a3c
23 changed files with 910 additions and 251 deletions

View File

@@ -10,6 +10,7 @@
<div id="mine-wrapper"
data-env="{{ env }}"
data-game-id="{{ app.request.get('gameAssoc') }}"
data-opponent-name="{{ opponent_name }}"
data-mercure-hub-url="{{ mercure_hub_url }}"
data-mercure-subscriber-jwt="{{ mercure_subscriber_jwt }}"
data-recaptcha-site-key="{{ recaptcha_site_key }}">

View File

@@ -128,23 +128,37 @@
{% set opp = is_red ? game.blue : game.red %}
{% set opp_anon = is_red ? game.blueAnon : game.redAnon %}
{% set result = 'draw' %}
{% if game.resign == (is_red ? 'red' : 'blue') %}
{% set result = 'loss' %}
{% elseif game.resign == (is_red ? 'blue' : 'red') %}
{% set result = 'win' %}
{% elseif my_points is not null and opp_points is not null %}
{% if my_points > opp_points %}
{% set result = 'win' %}
{% elseif my_points < opp_points %}
{% set result = 'loss' %}
{% endif %}
{% endif %}
{% set result = 'draw' %}
{% set is_finished = false %}
{% set is_anonymous = not opp and opp_anon %}
{% if game.resign == (is_red ? 'red' : 'blue') %}
{% set result = 'loss' %}
{% set is_finished = true %}
{% elseif game.resign == (is_red ? 'blue' : 'red') %}
{% set result = 'win' %}
{% set is_finished = true %}
{% elseif my_points is not null and opp_points is not null %}
{% if my_points > opp_points %}
{% set result = 'win' %}
{% set is_finished = (my_points > 25 or opp_points > 25) %}
{% elseif my_points < opp_points %}
{% set result = 'loss' %}
{% set is_finished = (my_points > 25 or opp_points > 25) %}
{% else %}
{% set is_finished = (my_points > 25 or opp_points > 25) %}
{% endif %}
{% endif %}
<div class="profile-game profile-game--{{ result }}" data-game-index="{{ loop.index0 }}">
<span class="profile-game__badge">
{{ result == 'win' ? 'W' : (result == 'loss' ? 'L' : 'D') }}
</span>
<div class="profile-game profile-game--{{ result }}{% if not is_finished and not is_anonymous %} profile-game--ongoing{% elseif is_anonymous %} profile-game--abandoned{% endif %}" data-game-index="{{ loop.index0 }}">
<span class="profile-game__badge">
{% if is_finished %}
{{ result == 'win' ? 'Win' : (result == 'loss' ? 'Loss' : 'Draw') }}
{% elseif is_anonymous %}
Abandoned
{% else %}
Ongoing
{% endif %}
</span>
<span class="profile-game__score">
{{ my_points ?? '—' }} : {{ opp_points ?? '—' }}
</span>