Add Skins format, GolfCourseAPI import, and UX improvements
- Add Skins game format with optional carryover, mirroring BBB scoring pattern
- Add GolfCourseAPI integration for course search and import (httpx)
- Unwrap {"course": {}} API response envelope on import
- Add searchable course combobox and player filter to new game form
- Redirect to summary page after finishing a game
- Fix auth to allow registered users without a pending invitation
- Fix hardcoded BBB format in create_game; store carryover flag in DB
- Add game summary/scorecard view for completed games
- Add live games social stream to dashboard
- Add course name + subtitle to recent game cards
- Reorder nav: Home → Games → Admin → Profile
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,14 @@
|
||||
{# Leaderboard #}
|
||||
<div class="card" style="padding:0.75rem 1rem;">
|
||||
{% for p in results %}
|
||||
{% set t = totals.get(p.id, {}) %}
|
||||
{% if game.format == 'skins' %}
|
||||
{% set score_val = skins_won.get(p.id, 0) %}
|
||||
{% set score_label = score_val | string + ' skin' + ('s' if score_val != 1 else '') %}
|
||||
{% else %}
|
||||
{% set t = totals.get(p.id, {}) %}
|
||||
{% set score_val = t.total %}
|
||||
{% set score_label = t.total | round(1) | string + ' pts' %}
|
||||
{% endif %}
|
||||
<div class="result-row {% if loop.first %}result-winner{% endif %}" style="padding:0.4rem 0;">
|
||||
<span class="result-rank">{% if loop.first %}🏆{% else %}{{ loop.index }}{% endif %}</span>
|
||||
<span class="result-avatar">
|
||||
@@ -26,18 +33,29 @@
|
||||
{% endif %}
|
||||
</span>
|
||||
<a href="/users/{{ p.id }}" style="flex:1; color:inherit; text-decoration:none;">{{ p.name }}</a>
|
||||
<span class="result-pts">{{ t.total | round(1) }} pts</span>
|
||||
<span class="result-pts">{{ score_label }}</span>
|
||||
{% if game.format == 'bingo_bango_bongo' %}
|
||||
<span style="font-size:0.75rem; color:var(--text-muted); margin-left:0.5rem;">
|
||||
B{{ t.bingo | int }}/{{ t.bango | round(1) }}/{{ t.bongo | int }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if game.format == 'skins' and unclaimed %}
|
||||
<div style="font-size:0.8rem; color:var(--text-muted); margin-top:0.5rem; text-align:center;">
|
||||
{{ unclaimed }} skin{{ 's' if unclaimed != 1 else '' }} unclaimed
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# Scorecard toggle #}
|
||||
<div class="scorecard-toggle" style="margin-top:1rem;">
|
||||
<button @click="view = 'strokes'" :class="{ active: view === 'strokes' }">Strokes</button>
|
||||
{% if game.format == 'skins' %}
|
||||
<button @click="view = 'skins'" :class="{ active: view === 'skins' }">Skins</button>
|
||||
{% else %}
|
||||
<button @click="view = 'points'" :class="{ active: view === 'points' }">Points</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# Strokes scorecard #}
|
||||
@@ -150,5 +168,72 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
{# Skins scorecard #}
|
||||
{% if game.format == 'skins' %}
|
||||
<table class="scorecard" x-show="view === 'skins'">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Hole</th>
|
||||
{% if hole_pars %}<th style="color:var(--text-muted);">Par</th>{% endif %}
|
||||
{% for p in players %}
|
||||
<th>
|
||||
{% if p.avatar and p.avatar.startswith('/') %}
|
||||
<img src="{{ p.avatar }}" style="width:1.3rem;height:1.3rem;border-radius:50%;object-fit:cover;vertical-align:middle;">
|
||||
{% else %}
|
||||
{{ p.avatar or '👤' }}
|
||||
{% endif %}<br>
|
||||
<a href="/users/{{ p.id }}" style="font-size:0.7rem; color:inherit; text-decoration:none;">{{ p.name.split()[0] }}</a>
|
||||
</th>
|
||||
{% endfor %}
|
||||
<th style="color:var(--text-muted);">Skin</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for h in holes %}
|
||||
{% set hr = skins_hole_results.get(h) %}
|
||||
<tr>
|
||||
<td class="hole-num">{{ h }}</td>
|
||||
{% if hole_pars %}<td class="score-cell" style="color:var(--text-muted);">{{ hole_pars.get(h, '—') }}</td>{% endif %}
|
||||
{% for p in players %}
|
||||
{% set s = scores.get(h, {}).get(p.id, {}) %}
|
||||
{% set strokes = s.strokes if s else 0 %}
|
||||
{% set par = hole_pars.get(h, 0) %}
|
||||
<td class="score-cell">
|
||||
{% if strokes %}
|
||||
{% set is_winner = hr and hr.winner == p.id %}
|
||||
{% if par %}
|
||||
{% set diff = strokes - par %}
|
||||
{% if strokes == 1 %}<span class="score-hio{% if is_winner %} skin-winner{% endif %}">{{ strokes }}</span>
|
||||
{% elif diff <= -2 %}<span class="score-eagle{% if is_winner %} skin-winner{% endif %}">{{ strokes }}</span>
|
||||
{% elif diff == -1 %}<span class="score-birdie{% if is_winner %} skin-winner{% endif %}">{{ strokes }}</span>
|
||||
{% elif diff == 1 %}<span class="score-bogey{% if is_winner %} skin-winner{% endif %}">{{ strokes }}</span>
|
||||
{% elif diff >= 2 %}<span class="score-double-bogey{% if is_winner %} skin-winner{% endif %}">{{ strokes }}</span>
|
||||
{% else %}<span{% if is_winner %} class="skin-winner"{% endif %}>{{ strokes }}</span>{% endif %}
|
||||
{% else %}<span{% if is_winner %} class="skin-winner"{% endif %}>{{ strokes }}</span>{% endif %}
|
||||
{% else %}—{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
<td class="score-cell">
|
||||
{% if hr %}
|
||||
{% if hr.winner %}✓{% if hr.pot > 1 %} {{ hr.pot }}{% endif %}
|
||||
{% else %}→ {{ hr.pot }}{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="totals-row">
|
||||
<td>Skins</td>
|
||||
{% if hole_pars %}<td></td>{% endif %}
|
||||
{% for p in players %}
|
||||
<td>{{ skins_won.get(p.id, 0) }}</td>
|
||||
{% endfor %}
|
||||
<td>{% if unclaimed %}({{ unclaimed }}){% endif %}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user