696 lines
42 KiB
HTML
696 lines
42 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<div class="space-y-8" x-data="{ range: '20' }">
|
|
<!-- 1. Header & Data Dashboard (Top) -->
|
|
<div class="bg-white dark:bg-slate-800 shadow-xl rounded-2xl overflow-hidden border border-gray-100 dark:border-slate-700">
|
|
<div class="p-8">
|
|
<div class="lg:flex lg:items-start lg:space-x-8">
|
|
<!-- Avatar & Basic Info -->
|
|
<div class="flex-shrink-0 flex flex-col items-center lg:items-start space-y-4">
|
|
<div class="relative group">
|
|
{% if player.avatar_url %}
|
|
<img src="{{ player.avatar_url }}" class="h-32 w-32 rounded-2xl object-cover shadow-lg border-4 border-white dark:border-slate-700 transform group-hover:scale-105 transition duration-300">
|
|
{% else %}
|
|
<div class="h-32 w-32 rounded-2xl bg-gradient-to-br from-yrtv-100 to-yrtv-200 flex items-center justify-center text-yrtv-600 font-bold text-4xl shadow-lg border-4 border-white dark:border-slate-700">
|
|
{{ player.username[:2] | upper if player.username else '??' }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if session.get('is_admin') %}
|
|
<button onclick="document.getElementById('editProfileModal').classList.remove('hidden')" class="absolute -bottom-2 -right-2 bg-white dark:bg-slate-700 p-2 rounded-full shadow-md text-gray-500 hover:text-yrtv-600 transition">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path></svg>
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="text-center lg:text-left">
|
|
<h1 class="text-3xl font-black text-gray-900 dark:text-white tracking-tight">{{ player.username }}</h1>
|
|
<p class="text-sm font-mono text-gray-500 dark:text-gray-400 mt-1">{{ player.steam_id_64 }}</p>
|
|
|
|
<!-- Tags -->
|
|
<div class="mt-3 flex flex-wrap justify-center lg:justify-start gap-2">
|
|
{% for tag in metadata.tags %}
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-bold bg-gray-100 text-gray-700 dark:bg-slate-700 dark:text-gray-300 border border-gray-200 dark:border-slate-600">
|
|
{{ tag }}
|
|
{% if session.get('is_admin') %}
|
|
<form action="{{ url_for('players.detail', steam_id=player.steam_id_64) }}" method="POST" class="inline ml-1">
|
|
<input type="hidden" name="admin_action" value="remove_tag">
|
|
<input type="hidden" name="tag" value="{{ tag }}">
|
|
<button type="submit" class="text-gray-400 hover:text-red-500 focus:outline-none">×</button>
|
|
</form>
|
|
{% endif %}
|
|
</span>
|
|
{% endfor %}
|
|
|
|
{% if session.get('is_admin') %}
|
|
<form action="{{ url_for('players.detail', steam_id=player.steam_id_64) }}" method="POST" class="inline-flex">
|
|
<input type="hidden" name="admin_action" value="add_tag">
|
|
<input type="text" name="tag" placeholder="+Tag" class="w-16 text-xs border border-gray-300 rounded px-1 py-0.5 focus:outline-none dark:bg-slate-700 dark:border-slate-600 dark:text-white">
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Data Dashboard -->
|
|
<div class="flex-1 w-full mt-8 lg:mt-0">
|
|
<div class="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
|
{% macro stat_card(label, metric_key, format_str, icon) %}
|
|
{% set dist = distribution[metric_key] if distribution else None %}
|
|
<div class="bg-gray-50 dark:bg-slate-700/50 rounded-xl p-5 border border-gray-100 dark:border-slate-600 relative overflow-hidden group hover:shadow-md transition-shadow">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider flex items-center gap-1">
|
|
{{ icon }} {{ label }}
|
|
</div>
|
|
{% if dist %}
|
|
<span class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold
|
|
{% if dist.rank == 1 %}bg-yellow-100 text-yellow-800 border border-yellow-200
|
|
{% elif dist.rank <= 3 %}bg-gray-100 text-gray-800 border border-gray-200
|
|
{% else %}bg-slate-100 text-slate-600 border border-slate-200{% endif %}">
|
|
Rank #{{ dist.rank }}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="text-3xl font-black text-gray-900 dark:text-white mb-3">
|
|
{{ format_str.format(dist.val if dist else 0) }}
|
|
</div>
|
|
|
|
<!-- Distribution Bar -->
|
|
{% if dist %}
|
|
<div class="w-full h-1.5 bg-gray-200 dark:bg-slate-600 rounded-full overflow-hidden relative">
|
|
<!-- Range: Min to Max -->
|
|
{% set range = dist.max - dist.min %}
|
|
{% set percent = ((dist.val - dist.min) / range * 100) if range > 0 else 100 %}
|
|
<div class="absolute h-full bg-yrtv-500 rounded-full transition-all duration-1000" style="width: {{ percent }}%"></div>
|
|
</div>
|
|
<div class="flex justify-between text-[10px] text-gray-400 mt-1 font-mono">
|
|
<span>{{ format_str.format(dist.min) }}</span>
|
|
<span>Avg: {{ format_str.format(dist.avg) }}</span>
|
|
<span>{{ format_str.format(dist.max) }}</span>
|
|
</div>
|
|
{% else %}
|
|
<div class="text-xs text-gray-400">No team data</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{{ stat_card('Rating', 'rating', '{:.2f}', '⭐') }}
|
|
{{ stat_card('K/D Ratio', 'kd', '{:.2f}', '🔫') }}
|
|
{{ stat_card('ADR', 'adr', '{:.1f}', '🔥') }}
|
|
{{ stat_card('KAST', 'kast', '{:.1%}', '🛡️') }} <!-- Note: KAST is stored as 0-1, formatted as % -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 2. Charts Section (Middle) -->
|
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
<!-- Trend Chart -->
|
|
<div class="lg:col-span-2 bg-white dark:bg-slate-800 shadow-lg rounded-2xl p-6 border border-gray-100 dark:border-slate-700">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h3 class="text-lg font-bold text-gray-900 dark:text-white flex items-center gap-2">
|
|
<span>📈</span> 近期表现走势 (Performance Trend)
|
|
</h3>
|
|
<!-- Simple Range Filter (Visual Only for now, could be wired to JS) -->
|
|
<div class="flex bg-gray-100 dark:bg-slate-700 rounded-lg p-1">
|
|
<button class="px-3 py-1 text-xs font-bold rounded-md bg-white dark:bg-slate-600 shadow-sm text-gray-800 dark:text-white">Recent 20</button>
|
|
<!-- <button class="px-3 py-1 text-xs font-medium rounded-md text-gray-500 hover:text-gray-900">All Time</button> -->
|
|
</div>
|
|
</div>
|
|
<div class="relative h-80 w-full">
|
|
<canvas id="trendChart"></canvas>
|
|
</div>
|
|
<div class="mt-4 flex justify-center gap-6 text-xs text-gray-500">
|
|
<div class="flex items-center gap-1"><span class="w-3 h-3 rounded-full bg-green-500/20 border border-green-500"></span> Carry (>1.5)</div>
|
|
<div class="flex items-center gap-1"><span class="w-3 h-3 rounded-full bg-yellow-500/20 border border-yellow-500"></span> Normal (1.0-1.5)</div>
|
|
<div class="flex items-center gap-1"><span class="w-3 h-3 rounded-full bg-red-500/20 border border-red-500"></span> Poor (<0.6)</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Radar Chart -->
|
|
<div class="bg-white dark:bg-slate-800 shadow-lg rounded-2xl p-6 border border-gray-100 dark:border-slate-700 flex flex-col">
|
|
<h3 class="text-lg font-bold text-gray-900 dark:text-white mb-6 flex items-center gap-2">
|
|
<span>🕸️</span> 能力六维图 (Capabilities)
|
|
</h3>
|
|
<div class="relative flex-1 min-h-[300px] flex items-center justify-center">
|
|
<canvas id="radarChart"></canvas>
|
|
</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">
|
|
<span>📊</span> 详细数据面板 (Detailed Stats)
|
|
</h3>
|
|
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-y-6 gap-x-4">
|
|
{% macro detail_item(label, value, key, format_str='{:.2f}', sublabel=None) %}
|
|
{% set dist = distribution[key] if distribution else None %}
|
|
<div class="flex flex-col group relative">
|
|
<div class="flex justify-between items-center mb-1">
|
|
<span class="text-xs font-bold text-gray-400 uppercase tracking-wider">{{ label }}</span>
|
|
{% if dist %}
|
|
<span class="inline-flex items-center px-1 py-0.5 rounded text-[9px] font-bold
|
|
{% if dist.rank == 1 %}bg-yellow-50 text-yellow-700 border border-yellow-100
|
|
{% elif dist.rank <= 3 %}bg-gray-50 text-gray-600 border border-gray-100
|
|
{% else %}text-gray-300{% endif %}">
|
|
#{{ dist.rank }}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="flex items-baseline gap-1 mb-1">
|
|
<span class="text-xl font-black text-gray-900 dark:text-white font-mono">
|
|
{{ format_str.format(value if value is not none else 0) }}
|
|
</span>
|
|
{% if sublabel %}
|
|
<span class="text-[10px] text-gray-400">{{ sublabel }}</span>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Distribution Bar -->
|
|
{% if dist %}
|
|
<div class="w-full h-1 bg-gray-100 dark:bg-slate-700 rounded-full overflow-hidden relative mt-1">
|
|
{% set range = dist.max - dist.min %}
|
|
{% set percent = ((dist.val - dist.min) / range * 100) if range > 0 else 100 %}
|
|
<div class="absolute h-full bg-yrtv-400/60 rounded-full" style="width: {{ percent }}%"></div>
|
|
<!-- Avg Marker -->
|
|
{% set avg_pct = ((dist.avg - dist.min) / range * 100) if range > 0 else 50 %}
|
|
<div class="absolute h-full w-0.5 bg-gray-400 dark:bg-slate-400 top-0" style="left: {{ avg_pct }}%"></div>
|
|
</div>
|
|
<div class="flex justify-between text-[9px] text-gray-300 dark:text-gray-600 font-mono mt-0.5">
|
|
<span>L:{{ format_str.format(dist.min) }}</span>
|
|
<span>H:{{ format_str.format(dist.max) }}</span>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
<!-- Row 1: Core -->
|
|
{{ detail_item('Rating (评分)', features['basic_avg_rating'], 'basic_avg_rating') }}
|
|
{{ detail_item('KD Ratio (击杀比)', features['basic_avg_kd'], 'basic_avg_kd') }}
|
|
{{ detail_item('KAST (贡献率)', features['basic_avg_kast'], 'basic_avg_kast', '{:.1%}') }}
|
|
{{ detail_item('RWS (每局得分)', features['basic_avg_rws'], 'basic_avg_rws') }}
|
|
{{ detail_item('ADR (场均伤害)', features['basic_avg_adr'], 'basic_avg_adr', '{:.1f}') }}
|
|
|
|
<!-- Row 2: Combat -->
|
|
{{ detail_item('Avg HS (场均爆头)', features['basic_avg_headshot_kills'], 'basic_avg_headshot_kills') }}
|
|
{{ detail_item('HS Rate (爆头率)', features['basic_headshot_rate'], 'basic_headshot_rate', '{:.1%}') }}
|
|
{{ detail_item('Assists (场均助攻)', features['basic_avg_assisted_kill'], 'basic_avg_assisted_kill') }}
|
|
{{ detail_item('AWP Kills (狙击击杀)', features['basic_avg_awp_kill'], 'basic_avg_awp_kill') }}
|
|
{{ detail_item('Jumps (场均跳跃)', features['basic_avg_jump_count'], 'basic_avg_jump_count', '{:.1f}') }}
|
|
|
|
<!-- Row 3: Objective -->
|
|
{{ detail_item('MVP (最有价值)', features['basic_avg_mvps'], 'basic_avg_mvps') }}
|
|
{{ detail_item('Plants (下包)', features['basic_avg_plants'], 'basic_avg_plants') }}
|
|
{{ detail_item('Defuses (拆包)', features['basic_avg_defuses'], 'basic_avg_defuses') }}
|
|
{{ detail_item('Flash Assist (闪光助攻)', features['basic_avg_flash_assists'], 'basic_avg_flash_assists') }}
|
|
<div class="hidden lg:block"></div> <!-- Spacer -->
|
|
|
|
<!-- Row 4: Opening -->
|
|
{{ detail_item('First Kill (场均首杀)', features['basic_avg_first_kill'], 'basic_avg_first_kill') }}
|
|
{{ detail_item('First Death (场均首死)', features['basic_avg_first_death'], 'basic_avg_first_death') }}
|
|
{{ detail_item('FK Rate (首杀率)', features['basic_first_kill_rate'], 'basic_first_kill_rate', '{:.1%}') }}
|
|
{{ detail_item('FD Rate (首死率)', features['basic_first_death_rate'], 'basic_first_death_rate', '{:.1%}') }}
|
|
<div class="hidden lg:block"></div> <!-- Spacer -->
|
|
|
|
<!-- Row 5: Multi-Kills -->
|
|
{{ detail_item('2K Rounds (双杀)', features['basic_avg_kill_2'], 'basic_avg_kill_2') }}
|
|
{{ detail_item('3K Rounds (三杀)', features['basic_avg_kill_3'], 'basic_avg_kill_3') }}
|
|
{{ detail_item('4K Rounds (四杀)', features['basic_avg_kill_4'], 'basic_avg_kill_4') }}
|
|
{{ detail_item('5K Rounds (五杀)', features['basic_avg_kill_5'], 'basic_avg_kill_5') }}
|
|
|
|
<!-- Row 6: Special -->
|
|
{{ detail_item('Perfect Kills (无伤杀)', features['basic_avg_perfect_kill'], 'basic_avg_perfect_kill') }}
|
|
{{ detail_item('Revenge Kills (复仇杀)', features['basic_avg_revenge_kill'], 'basic_avg_revenge_kill') }}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 2.6 Advanced Dimensions Breakdown -->
|
|
<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> 进阶能力分析 (Capabilities Breakdown)
|
|
</h3>
|
|
|
|
<!-- Reusing detail_item macro, but with a different grid if needed -->
|
|
<!-- Grouped by Dimensions -->
|
|
<div class="space-y-8">
|
|
<!-- Group 1: STA & BAT -->
|
|
<div>
|
|
<h4 class="text-xs font-black text-gray-400 uppercase tracking-widest mb-4 border-b border-gray-100 dark:border-slate-700 pb-2">
|
|
STA (Stability) & BAT (Aim/Battle)
|
|
</h4>
|
|
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-y-6 gap-x-4">
|
|
{{ detail_item('Last 30 Rating (近30场)', features['sta_last_30_rating'], 'sta_last_30_rating') }}
|
|
{{ detail_item('Win Rating (胜局)', features['sta_win_rating'], 'sta_win_rating') }}
|
|
{{ detail_item('Loss Rating (败局)', features['sta_loss_rating'], 'sta_loss_rating') }}
|
|
{{ detail_item('Volatility (波动)', features['sta_rating_volatility'], 'sta_rating_volatility') }}
|
|
{{ detail_item('Time Corr (耐力)', features['sta_time_rating_corr'], 'sta_time_rating_corr') }}
|
|
|
|
{{ detail_item('High Elo KD Diff (高分抗压)', features['bat_kd_diff_high_elo'], 'bat_kd_diff_high_elo') }}
|
|
{{ detail_item('Duel Win% (对枪胜率)', features['bat_avg_duel_win_rate'], 'bat_avg_duel_win_rate', '{:.1%}') }}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Group 2: HPS & PTL -->
|
|
<div>
|
|
<h4 class="text-xs font-black text-gray-400 uppercase tracking-widest mb-4 border-b border-gray-100 dark:border-slate-700 pb-2">
|
|
HPS (Clutch/Pressure) & PTL (Pistol)
|
|
</h4>
|
|
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-y-6 gap-x-4">
|
|
{{ detail_item('1v1 Win% (1v1胜率)', features['hps_clutch_win_rate_1v1'], 'hps_clutch_win_rate_1v1', '{:.1%}') }}
|
|
{{ detail_item('1v3+ Win% (残局大神)', features['hps_clutch_win_rate_1v3_plus'], 'hps_clutch_win_rate_1v3_plus', '{:.1%}') }}
|
|
{{ detail_item('Match Pt Win% (赛点胜率)', features['hps_match_point_win_rate'], 'hps_match_point_win_rate', '{:.1%}') }}
|
|
{{ detail_item('Pressure Entry (逆风首杀)', features['hps_pressure_entry_rate'], 'hps_pressure_entry_rate', '{:.1%}') }}
|
|
{{ detail_item('Comeback KD (翻盘KD)', features['hps_comeback_kd_diff'], 'hps_comeback_kd_diff') }}
|
|
|
|
{{ detail_item('Pistol Kills (手枪击杀)', features['ptl_pistol_kills'], 'ptl_pistol_kills') }}
|
|
{{ detail_item('Pistol Win% (手枪胜率)', features['ptl_pistol_win_rate'], 'ptl_pistol_win_rate', '{:.1%}') }}
|
|
{{ detail_item('Pistol KD (手枪KD)', features['ptl_pistol_kd'], 'ptl_pistol_kd') }}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Group 3: SIDE & UTIL -->
|
|
<div>
|
|
<h4 class="text-xs font-black text-gray-400 uppercase tracking-widest mb-4 border-b border-gray-100 dark:border-slate-700 pb-2">
|
|
SIDE (T/CT Preference) & UTIL (Utility)
|
|
</h4>
|
|
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-y-6 gap-x-4">
|
|
{{ detail_item('CT Rating (CT评分)', features['side_rating_ct'], 'side_rating_ct') }}
|
|
{{ detail_item('T Rating (T评分)', features['side_rating_t'], 'side_rating_t') }}
|
|
{{ detail_item('CT FK Rate (CT首杀)', features['side_first_kill_rate_ct'], 'side_first_kill_rate_ct', '{:.1%}') }}
|
|
{{ detail_item('T FK Rate (T首杀)', features['side_first_kill_rate_t'], 'side_first_kill_rate_t', '{:.1%}') }}
|
|
{{ detail_item('Side KD Diff (攻防差)', features['side_kd_diff_ct_t'], 'side_kd_diff_ct_t') }}
|
|
|
|
{{ detail_item('Usage Rate (道具频率)', features['util_usage_rate'], 'util_usage_rate') }}
|
|
{{ detail_item('Nade Dmg (雷火伤)', features['util_avg_nade_dmg'], 'util_avg_nade_dmg', '{:.1f}') }}
|
|
{{ detail_item('Flash Time (致盲时间)', features['util_avg_flash_time'], 'util_avg_flash_time', '{:.2f}s') }}
|
|
{{ detail_item('Flash Enemy (致盲人数)', features['util_avg_flash_enemy'], 'util_avg_flash_enemy') }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 3. Match History & Comments (Bottom) -->
|
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
<!-- Match History Table -->
|
|
<div class="lg:col-span-2 bg-white dark:bg-slate-800 shadow-lg rounded-2xl overflow-hidden border border-gray-100 dark:border-slate-700">
|
|
<div class="p-6 border-b border-gray-100 dark:border-slate-700 flex justify-between items-center">
|
|
<h3 class="text-lg font-bold text-gray-900 dark:text-white">比赛记录 (Match History)</h3>
|
|
<span class="px-2.5 py-0.5 rounded-full text-xs font-bold bg-gray-100 text-gray-600 dark:bg-slate-700 dark:text-gray-300">
|
|
{{ history|length }} Matches
|
|
</span>
|
|
</div>
|
|
<div class="overflow-x-auto max-h-[600px] overflow-y-auto custom-scroll">
|
|
<table class="min-w-full divide-y divide-gray-200 dark:divide-slate-700">
|
|
<thead class="bg-gray-50 dark:bg-slate-700/50 sticky top-0 backdrop-blur-sm z-10">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">Date/Map</th>
|
|
<th class="px-6 py-3 text-center text-xs font-bold text-gray-500 uppercase tracking-wider">Result</th>
|
|
<th class="px-6 py-3 text-right text-xs font-bold text-gray-500 uppercase tracking-wider">Rating</th>
|
|
<th class="px-6 py-3 text-right text-xs font-bold text-gray-500 uppercase tracking-wider">K/D</th>
|
|
<th class="px-6 py-3 text-right text-xs font-bold text-gray-500 uppercase tracking-wider">ADR</th>
|
|
<th class="px-6 py-3 text-center text-xs font-bold text-gray-500 uppercase tracking-wider">Link</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100 dark:divide-slate-700 bg-white dark:bg-slate-800">
|
|
{% for m in history | reverse %}
|
|
<tr class="hover:bg-gray-50 dark:hover:bg-slate-700/50 transition-colors group">
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="text-sm font-bold text-gray-900 dark:text-white">{{ m.map_name }}</div>
|
|
<div class="text-xs text-gray-500 font-mono">
|
|
<script>document.write(new Date({{ m.start_time }} * 1000).toLocaleDateString())</script>
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-center">
|
|
<div class="flex flex-col items-center gap-1">
|
|
<span class="px-2.5 py-0.5 rounded text-[10px] font-black uppercase tracking-wide
|
|
{% if m.is_win %}bg-green-100 text-green-700 border border-green-200
|
|
{% else %}bg-red-50 text-red-600 border border-red-100{% endif %}">
|
|
{{ 'WIN' if m.is_win else 'LOSS' }}
|
|
</span>
|
|
{% if m.party_size and m.party_size > 1 %}
|
|
<span class="text-[10px] text-gray-400 flex items-center gap-0.5" title="Party Size">
|
|
👥 {{ m.party_size }}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-right">
|
|
{% set r = m.rating or 0 %}
|
|
<div class="flex items-center justify-end gap-2">
|
|
<span class="text-sm font-bold font-mono {% if r >= 1.5 %}text-yrtv-600{% elif r >= 1.1 %}text-green-600{% elif r < 0.6 %}text-red-500{% else %}text-gray-700 dark:text-gray-300{% endif %}">
|
|
{{ "%.2f"|format(r) }}
|
|
</span>
|
|
<!-- Mini Bar -->
|
|
<div class="w-12 h-1 bg-gray-100 dark:bg-slate-700 rounded-full overflow-hidden">
|
|
<div class="h-full {% if r >= 1.1 %}bg-green-500{% elif r < 0.9 %}bg-red-500{% else %}bg-gray-400{% endif %}" style="width: {{ (r / 2.0 * 100)|int }}%"></div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-right text-sm text-gray-600 dark:text-gray-400 font-mono">
|
|
{{ "%.2f"|format(m.kd_ratio or 0) }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-right text-sm text-gray-600 dark:text-gray-400 font-mono">
|
|
{{ "%.1f"|format(m.adr or 0) }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-center">
|
|
<a href="{{ url_for('matches.detail', match_id=m.match_id) }}" class="p-2 text-gray-400 hover:text-yrtv-600 transition-colors">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="6" class="px-6 py-12 text-center text-gray-400">
|
|
<div class="text-4xl mb-2">🏜️</div>
|
|
No matches recorded yet.
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Reviews / Comments -->
|
|
<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">留言板 (Comments)</h3>
|
|
|
|
<form action="{{ url_for('players.detail', steam_id=player.steam_id_64) }}" method="POST" class="mb-8 relative">
|
|
<input type="text" name="username" class="absolute top-2 left-2 text-xs border-none bg-transparent focus:ring-0 text-gray-500 w-full" placeholder="Name (Optional)">
|
|
<textarea name="content" rows="3" required class="block w-full pt-8 pb-2 px-3 border border-gray-200 dark:border-slate-600 rounded-xl bg-gray-50 dark:bg-slate-700/50 focus:ring-2 focus:ring-yrtv-500 focus:bg-white dark:focus:bg-slate-700 transition" placeholder="Write a comment..."></textarea>
|
|
<button type="submit" class="absolute bottom-2 right-2 px-3 py-1 bg-yrtv-600 text-white text-xs font-bold rounded-lg hover:bg-yrtv-700 transition shadow-sm">Post</button>
|
|
</form>
|
|
|
|
<div class="space-y-4 max-h-[500px] overflow-y-auto custom-scroll pr-2">
|
|
{% for comment in comments %}
|
|
<div class="flex gap-3 group">
|
|
<div class="flex-shrink-0 mt-1">
|
|
<div class="h-8 w-8 rounded-full bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center text-gray-500 text-xs font-bold border border-white shadow-sm">
|
|
{{ comment.username[:1] | upper }}
|
|
</div>
|
|
</div>
|
|
<div class="flex-1 bg-gray-50 dark:bg-slate-700/30 rounded-r-xl rounded-bl-xl p-3 text-sm hover:bg-gray-100 dark:hover:bg-slate-700/50 transition-colors">
|
|
<div class="flex justify-between items-baseline mb-1">
|
|
<span class="font-bold text-gray-900 dark:text-white">{{ comment.username }}</span>
|
|
<span class="text-xs text-gray-400">{{ comment.created_at }}</span>
|
|
</div>
|
|
<p class="text-gray-600 dark:text-gray-300 leading-relaxed">{{ comment.content }}</p>
|
|
<div class="mt-2 flex justify-end">
|
|
<button onclick="likeComment({{ comment.id }}, this)" class="text-xs text-gray-400 hover:text-red-500 flex items-center gap-1 transition-colors">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/></svg>
|
|
<span class="like-count font-bold">{{ comment.likes }}</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="text-center py-8 text-gray-400 text-sm">No comments yet.</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Edit Modal (Hidden) -->
|
|
<div id="editProfileModal" class="hidden fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center">
|
|
<div class="bg-white dark:bg-slate-800 rounded-2xl shadow-2xl w-full max-w-md p-6 m-4 animate-scale-in">
|
|
<h3 class="text-xl font-bold text-gray-900 dark:text-white mb-4">Edit Profile</h3>
|
|
<form action="{{ url_for('players.detail', steam_id=player.steam_id_64) }}" method="POST" enctype="multipart/form-data">
|
|
<input type="hidden" name="admin_action" value="update_profile">
|
|
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="block text-sm font-bold text-gray-700 dark:text-gray-300 mb-1">Avatar</label>
|
|
<input type="file" name="avatar" accept="image/*" class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-bold file:bg-yrtv-50 file:text-yrtv-700 hover:file:bg-yrtv-100">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-bold text-gray-700 dark:text-gray-300 mb-1">Notes</label>
|
|
<textarea name="notes" rows="3" class="w-full border-gray-300 rounded-lg shadow-sm focus:border-yrtv-500 focus:ring-yrtv-500 dark:bg-slate-700 dark:border-slate-600 dark:text-white">{{ metadata.notes }}</textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-6 flex gap-3">
|
|
<button type="button" onclick="document.getElementById('editProfileModal').classList.add('hidden')" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 font-bold transition">Cancel</button>
|
|
<button type="submit" class="flex-1 px-4 py-2 bg-yrtv-600 text-white rounded-lg hover:bg-yrtv-700 font-bold shadow-lg shadow-yrtv-500/30 transition">Save Changes</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
let trendChartInstance = null;
|
|
|
|
function resetZoom() {
|
|
if (trendChartInstance) {
|
|
trendChartInstance.resetZoom();
|
|
}
|
|
}
|
|
|
|
function likeComment(commentId, btn) {
|
|
fetch(`/players/comment/${commentId}/like`, { method: 'POST' })
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
const countSpan = btn.querySelector('.like-count');
|
|
countSpan.innerText = parseInt(countSpan.innerText) + 1;
|
|
btn.classList.add('text-red-500');
|
|
}
|
|
});
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const steamId = "{{ player.steam_id_64 }}";
|
|
|
|
fetch(`/players/${steamId}/charts_data`)
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
// Register Zoom Plugin Manually if needed (usually auto-registers in UMD)
|
|
if (window.ChartZoom) {
|
|
Chart.register(window.ChartZoom);
|
|
}
|
|
|
|
// Radar Chart
|
|
const ctxRadar = document.getElementById('radarChart').getContext('2d');
|
|
|
|
// Prepare Distribution Data
|
|
const dist = data.radar_dist || {};
|
|
const getDist = (key) => dist[key] || { rank: '?', avg: 0 };
|
|
|
|
// Map friendly names to keys
|
|
const keys = ['score_bat', 'score_hps', 'score_ptl', 'score_tct', 'score_util', 'score_sta'];
|
|
// Corresponding Labels
|
|
const rawLabels = ['Aim (BAT)', 'Clutch (HPS)', 'Pistol (PTL)', 'Defense (SIDE)', 'Util (UTIL)', 'Rating (STA)'];
|
|
|
|
const labels = rawLabels.map((l, i) => {
|
|
const k = keys[i];
|
|
const d = getDist(k);
|
|
return `${l} #${d.rank}`;
|
|
});
|
|
|
|
const teamAvgs = keys.map(k => getDist(k).avg);
|
|
|
|
new Chart(ctxRadar, {
|
|
type: 'radar',
|
|
data: {
|
|
// Update labels to friendly names
|
|
labels: labels,
|
|
datasets: [{
|
|
label: 'Player',
|
|
data: [
|
|
data.radar.BAT, data.radar.HPS,
|
|
data.radar.PTL, data.radar.SIDE, data.radar.UTIL,
|
|
data.radar.STA
|
|
],
|
|
backgroundColor: 'rgba(124, 58, 237, 0.2)',
|
|
borderColor: '#7c3aed',
|
|
borderWidth: 2,
|
|
pointBackgroundColor: '#7c3aed',
|
|
pointBorderColor: '#fff',
|
|
pointHoverBackgroundColor: '#fff',
|
|
pointHoverBorderColor: '#7c3aed'
|
|
},
|
|
{
|
|
label: 'Team Avg',
|
|
data: teamAvgs,
|
|
backgroundColor: 'rgba(148, 163, 184, 0.2)', // Slate-400
|
|
borderColor: '#94a3b8',
|
|
borderWidth: 2,
|
|
pointRadius: 0,
|
|
borderDash: [5, 5]
|
|
}]
|
|
},
|
|
options: {
|
|
plugins: {
|
|
legend: { display: true, position: 'bottom' }
|
|
},
|
|
scales: {
|
|
r: {
|
|
beginAtZero: true,
|
|
suggestedMax: 100,
|
|
angleLines: {
|
|
color: 'rgba(156, 163, 175, 0.2)'
|
|
},
|
|
grid: {
|
|
color: 'rgba(156, 163, 175, 0.2)'
|
|
},
|
|
pointLabels: {
|
|
font: {
|
|
size: 11,
|
|
weight: 'bold'
|
|
},
|
|
color: '#6b7280' // gray-500
|
|
},
|
|
ticks: {
|
|
display: false // Hide numbers on axis
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// Trend Chart
|
|
const ctxTrend = document.getElementById('trendChart').getContext('2d');
|
|
|
|
// Create Gradient
|
|
const gradient = ctxTrend.createLinearGradient(0, 0, 0, 400);
|
|
gradient.addColorStop(0, 'rgba(124, 58, 237, 0.5)'); // Purple
|
|
gradient.addColorStop(1, 'rgba(124, 58, 237, 0.0)');
|
|
|
|
trendChartInstance = new Chart(ctxTrend, {
|
|
type: 'line',
|
|
data: {
|
|
labels: data.trend.labels,
|
|
datasets: [
|
|
{
|
|
label: 'Rating',
|
|
data: data.trend.values,
|
|
borderColor: '#7c3aed', // YRTV Purple
|
|
backgroundColor: gradient,
|
|
borderWidth: 2,
|
|
tension: 0.4, // Smoother curve
|
|
pointRadius: 3,
|
|
pointBackgroundColor: '#fff',
|
|
pointBorderColor: '#7c3aed',
|
|
pointHoverRadius: 6,
|
|
pointHoverBackgroundColor: '#7c3aed',
|
|
pointHoverBorderColor: '#fff',
|
|
fill: true,
|
|
order: 1
|
|
},
|
|
// Baselines
|
|
{
|
|
label: 'Carry (1.5)',
|
|
data: Array(data.trend.labels.length).fill(1.5),
|
|
borderColor: 'rgba(34, 197, 94, 0.6)', // Green
|
|
borderWidth: 1,
|
|
borderDash: [5, 5],
|
|
pointRadius: 0,
|
|
fill: false,
|
|
order: 2
|
|
},
|
|
{
|
|
label: 'Normal (1.0)',
|
|
data: Array(data.trend.labels.length).fill(1.0),
|
|
borderColor: 'rgba(234, 179, 8, 0.6)', // Yellow
|
|
borderWidth: 1,
|
|
borderDash: [5, 5],
|
|
pointRadius: 0,
|
|
fill: false,
|
|
order: 3
|
|
},
|
|
{
|
|
label: 'Poor (0.6)',
|
|
data: Array(data.trend.labels.length).fill(0.6),
|
|
borderColor: 'rgba(239, 68, 68, 0.6)', // Red
|
|
borderWidth: 1,
|
|
borderDash: [5, 5],
|
|
pointRadius: 0,
|
|
fill: false,
|
|
order: 4
|
|
}
|
|
]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
maintainAspectRatio: false,
|
|
interaction: {
|
|
mode: 'index',
|
|
intersect: false,
|
|
},
|
|
plugins: {
|
|
legend: {
|
|
display: false
|
|
},
|
|
zoom: {
|
|
pan: {
|
|
enabled: true,
|
|
mode: 'x',
|
|
modifierKey: null, // Allow plain drag
|
|
},
|
|
zoom: {
|
|
wheel: {
|
|
enabled: true,
|
|
},
|
|
pinch: {
|
|
enabled: true
|
|
},
|
|
mode: 'x',
|
|
}
|
|
},
|
|
tooltip: {
|
|
backgroundColor: 'rgba(17, 24, 39, 0.9)',
|
|
titleFont: { size: 12 },
|
|
bodyFont: { size: 14, weight: 'bold' },
|
|
padding: 12,
|
|
cornerRadius: 8,
|
|
displayColors: false, // Cleaner look
|
|
callbacks: {
|
|
label: function(context) {
|
|
if (context.datasetIndex > 0) return null; // Hide baseline tooltips
|
|
let val = context.parsed.y.toFixed(2);
|
|
let label = "Rating: " + val;
|
|
if (val >= 1.5) label += " 🔥";
|
|
else if (val < 0.6) label += " 💀";
|
|
return label;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true,
|
|
suggestedMax: 2.0,
|
|
grid: {
|
|
color: 'rgba(156, 163, 175, 0.1)',
|
|
borderDash: [2, 2]
|
|
},
|
|
ticks: {
|
|
font: { size: 10 }
|
|
}
|
|
},
|
|
x: {
|
|
grid: {
|
|
display: false
|
|
},
|
|
ticks: {
|
|
maxRotation: 0, // Keep labels horizontal
|
|
minRotation: 0,
|
|
autoSkip: true,
|
|
maxTicksLimit: 10, // Avoid crowding
|
|
font: { size: 10 }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %} |