refactor(live-state): hoist display_name into {% set %} to DRY card loops
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
20fb564246
commit
6656588b8f
1 changed files with 4 additions and 2 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
{% if current_players %}
|
{% if current_players %}
|
||||||
<ul class="player-grid current">
|
<ul class="player-grid current">
|
||||||
{% for session, profile in current_players %}
|
{% for session, profile in current_players %}
|
||||||
|
{% set display_name = (profile and profile.persona_name) or session.name_at_join %}
|
||||||
<li class="player-card current-card">
|
<li class="player-card current-card">
|
||||||
<a class="player-link"
|
<a class="player-link"
|
||||||
href="https://steamcommunity.com/profiles/{{ session.steam_id_64 }}"
|
href="https://steamcommunity.com/profiles/{{ session.steam_id_64 }}"
|
||||||
|
|
@ -27,7 +28,7 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="avatar placeholder" aria-hidden="true"></span>
|
<span class="avatar placeholder" aria-hidden="true"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="name" title="{{ (profile and profile.persona_name) or session.name_at_join }}">{{ (profile and profile.persona_name) or session.name_at_join }}</span>
|
<span class="name" title="{{ display_name }}">{{ display_name }}</span>
|
||||||
</a>
|
</a>
|
||||||
<span class="meta">
|
<span class="meta">
|
||||||
{{ session.joined_at | timeago }} · {{ session.min_ping }}-{{ session.max_ping }}ms
|
{{ session.joined_at | timeago }} · {{ session.min_ping }}-{{ session.max_ping }}ms
|
||||||
|
|
@ -50,6 +51,7 @@
|
||||||
</h3>
|
</h3>
|
||||||
<ul class="player-grid recent">
|
<ul class="player-grid recent">
|
||||||
{% for row in recent_players_overview %}
|
{% for row in recent_players_overview %}
|
||||||
|
{% set display_name = row.persona_name or row.name_at_join %}
|
||||||
<li class="player-card recent-chip">
|
<li class="player-card recent-chip">
|
||||||
<a class="player-link"
|
<a class="player-link"
|
||||||
href="https://steamcommunity.com/profiles/{{ row.steam_id_64 }}"
|
href="https://steamcommunity.com/profiles/{{ row.steam_id_64 }}"
|
||||||
|
|
@ -59,7 +61,7 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="avatar placeholder" aria-hidden="true"></span>
|
<span class="avatar placeholder" aria-hidden="true"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="name" title="{{ row.persona_name or row.name_at_join }}">{{ row.persona_name or row.name_at_join }}</span>
|
<span class="name" title="{{ display_name }}">{{ display_name }}</span>
|
||||||
</a>
|
</a>
|
||||||
<span class="meta">· {{ row.last_seen | timeago }}</span>
|
<span class="meta">· {{ row.last_seen | timeago }}</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue