feat: Add recent performance stability stats (matches/days) to player profile

This commit is contained in:
2026-01-28 15:11:31 +08:00
parent a5a9016b7f
commit f110ae52f0
3 changed files with 131 additions and 1 deletions

View File

@@ -141,6 +141,66 @@
</div>
</div>
<!-- 2.2 Recent Performance Stability -->
<div class="bg-white dark:bg-slate-800 shadow-lg rounded-2xl p-6 border border-gray-100 dark:border-slate-700">
<h3 class="text-lg font-bold text-gray-900 dark:text-white mb-6 flex items-center gap-2">
<span>📅</span> 近期表现稳定性 (Recent Stability)
</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<!-- By Match Count -->
<div>
<h4 class="text-sm font-bold text-gray-500 uppercase tracking-wider mb-4">By Matches</h4>
<div class="space-y-4">
{% for n in [5, 10, 15] %}
{% set key = 'last_' ~ n ~ '_matches' %}
{% set data = recent_stats.get(key) %}
<div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-slate-700/50 rounded-lg border border-gray-100 dark:border-slate-600">
<div class="flex items-center gap-3">
<span class="text-2xl font-black text-gray-300 dark:text-slate-600 w-8 text-center">{{ n }}</span>
<span class="text-xs font-bold text-gray-500 uppercase">Matches</span>
</div>
<div class="text-right">
{% if data and data.count > 0 %}
<div class="text-xl font-black text-gray-900 dark:text-white">{{ "{:.2f}".format(data.avg) }} <span class="text-xs text-gray-400 font-normal">Rating</span></div>
<div class="text-xs text-gray-500 font-mono">Var: {{ "{:.3f}".format(data.var) }}</div>
{% else %}
<span class="text-xs text-gray-400">N/A</span>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
<!-- By Days -->
<div>
<h4 class="text-sm font-bold text-gray-500 uppercase tracking-wider mb-4">By Days</h4>
<div class="space-y-4">
{% for n in [5, 10, 15] %}
{% set key = 'last_' ~ n ~ '_days' %}
{% set data = recent_stats.get(key) %}
<div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-slate-700/50 rounded-lg border border-gray-100 dark:border-slate-600">
<div class="flex items-center gap-3">
<span class="text-2xl font-black text-gray-300 dark:text-slate-600 w-8 text-center">{{ n }}</span>
<span class="text-xs font-bold text-gray-500 uppercase">Days</span>
</div>
<div class="text-right">
{% if data and data.count > 0 %}
<div class="text-xl font-black text-gray-900 dark:text-white">{{ "{:.2f}".format(data.avg) }} <span class="text-xs text-gray-400 font-normal">Rating</span></div>
<div class="text-xs text-gray-500 font-mono">Var: {{ "{:.3f}".format(data.var) }}</div>
<div class="text-[10px] text-gray-400">{{ data.count }} matches</div>
{% else %}
<span class="text-xs text-gray-400">No matches</span>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
<!-- 2.5 Detailed Stats Panel -->
<div class="bg-white dark:bg-slate-800 shadow-lg rounded-2xl p-6 border border-gray-100 dark:border-slate-700">
<h3 class="text-lg font-bold text-gray-900 dark:text-white mb-6 flex items-center gap-2">