2.1.1: Fixed new profile.

This commit is contained in:
2026-01-28 01:38:45 +08:00
parent 4afb728bfa
commit a5a9016b7f
9 changed files with 190 additions and 50 deletions

View File

@@ -349,8 +349,99 @@
<div class="mt-6 grid grid-cols-1 lg:grid-cols-3 gap-4">
<div class="bg-gray-50 dark:bg-slate-700/30 rounded-xl p-4 border border-gray-100 dark:border-slate-600">
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-2">Phase Split</div>
<div class="h-40">
<canvas id="phaseChart"></canvas>
{% macro phase_row(title, ke, km, kl, de, dm, dl, ke_key, km_key, kl_key, de_key, dm_key, dl_key) %}
{% set ke = ke or 0 %}
{% set km = km or 0 %}
{% set kl = kl or 0 %}
{% set de = de or 0 %}
{% set dm = dm or 0 %}
{% set dl = dl or 0 %}
{% set k_total = ke + km + kl %}
{% set d_total = de + dm + dl %}
<div class="grid grid-cols-12 gap-2 items-center py-1">
<div class="col-span-2 text-[10px] font-bold text-gray-500 dark:text-gray-400">{{ title }}</div>
<div class="col-span-5">
<div class="w-full h-2 rounded-full overflow-hidden bg-gray-200/60 dark:bg-slate-600/50 flex">
{% if k_total > 0 %}
<div class="h-full bg-yrtv-500" style="width: {{ (ke / k_total) * 100 }}%"></div>
<div class="h-full bg-yrtv-500/70" style="width: {{ (km / k_total) * 100 }}%"></div>
<div class="h-full bg-yrtv-500/40" style="width: {{ (kl / k_total) * 100 }}%"></div>
{% else %}
<div class="h-full w-full bg-gray-300/50 dark:bg-slate-600/40"></div>
{% endif %}
</div>
<div class="mt-0.5 text-[9px] text-gray-400 font-mono flex justify-between">
<span>
E {{ '{:.0%}'.format(ke) }}
{% if distribution and distribution.get(ke_key) %} (#{{ distribution.get(ke_key).rank }}/{{ distribution.get(ke_key).total }}){% endif %}
</span>
<span>
M {{ '{:.0%}'.format(km) }}
{% if distribution and distribution.get(km_key) %} (#{{ distribution.get(km_key).rank }}/{{ distribution.get(km_key).total }}){% endif %}
</span>
<span>
L {{ '{:.0%}'.format(kl) }}
{% if distribution and distribution.get(kl_key) %} (#{{ distribution.get(kl_key).rank }}/{{ distribution.get(kl_key).total }}){% endif %}
</span>
</div>
</div>
<div class="col-span-5">
<div class="w-full h-2 rounded-full overflow-hidden bg-gray-200/60 dark:bg-slate-600/50 flex">
{% if d_total > 0 %}
<div class="h-full bg-slate-400" style="width: {{ (de / d_total) * 100 }}%"></div>
<div class="h-full bg-slate-400/70" style="width: {{ (dm / d_total) * 100 }}%"></div>
<div class="h-full bg-slate-400/40" style="width: {{ (dl / d_total) * 100 }}%"></div>
{% else %}
<div class="h-full w-full bg-gray-300/50 dark:bg-slate-600/40"></div>
{% endif %}
</div>
<div class="mt-0.5 text-[9px] text-gray-400 font-mono flex justify-between">
<span>
E {{ '{:.0%}'.format(de) }}
{% if distribution and distribution.get(de_key) %} (#{{ distribution.get(de_key).rank }}/{{ distribution.get(de_key).total }}){% endif %}
</span>
<span>
M {{ '{:.0%}'.format(dm) }}
{% if distribution and distribution.get(dm_key) %} (#{{ distribution.get(dm_key).rank }}/{{ distribution.get(dm_key).total }}){% endif %}
</span>
<span>
L {{ '{:.0%}'.format(dl) }}
{% if distribution and distribution.get(dl_key) %} (#{{ distribution.get(dl_key).rank }}/{{ distribution.get(dl_key).total }}){% endif %}
</span>
</div>
</div>
</div>
{% endmacro %}
<div class="text-[10px] text-gray-500 dark:text-gray-400 mb-2 grid grid-cols-12 gap-2">
<div class="col-span-2"></div>
<div class="col-span-5 flex justify-between">
<span>Kills</span><span class="font-mono">E / M / L</span>
</div>
<div class="col-span-5 flex justify-between">
<span>Deaths</span><span class="font-mono">E / M / L</span>
</div>
</div>
<div class="space-y-1">
{{ phase_row('Total',
features.get('rd_phase_kill_early_share', 0), features.get('rd_phase_kill_mid_share', 0), features.get('rd_phase_kill_late_share', 0),
features.get('rd_phase_death_early_share', 0), features.get('rd_phase_death_mid_share', 0), features.get('rd_phase_death_late_share', 0),
'rd_phase_kill_early_share', 'rd_phase_kill_mid_share', 'rd_phase_kill_late_share',
'rd_phase_death_early_share', 'rd_phase_death_mid_share', 'rd_phase_death_late_share'
) }}
{{ phase_row('T',
features.get('rd_phase_kill_early_share_t', 0), features.get('rd_phase_kill_mid_share_t', 0), features.get('rd_phase_kill_late_share_t', 0),
features.get('rd_phase_death_early_share_t', 0), features.get('rd_phase_death_mid_share_t', 0), features.get('rd_phase_death_late_share_t', 0),
'rd_phase_kill_early_share_t', 'rd_phase_kill_mid_share_t', 'rd_phase_kill_late_share_t',
'rd_phase_death_early_share_t', 'rd_phase_death_mid_share_t', 'rd_phase_death_late_share_t'
) }}
{{ phase_row('CT',
features.get('rd_phase_kill_early_share_ct', 0), features.get('rd_phase_kill_mid_share_ct', 0), features.get('rd_phase_kill_late_share_ct', 0),
features.get('rd_phase_death_early_share_ct', 0), features.get('rd_phase_death_mid_share_ct', 0), features.get('rd_phase_death_late_share_ct', 0),
'rd_phase_kill_early_share_ct', 'rd_phase_kill_mid_share_ct', 'rd_phase_kill_late_share_ct',
'rd_phase_death_early_share_ct', 'rd_phase_death_mid_share_ct', 'rd_phase_death_late_share_ct'
) }}
</div>
</div>
<div class="bg-gray-50 dark:bg-slate-700/30 rounded-xl p-4 border border-gray-100 dark:border-slate-600">
@@ -1000,54 +1091,7 @@ document.addEventListener('DOMContentLoaded', function() {
const phaseCanvas = document.getElementById('phaseChart');
if (phaseCanvas) {
const ctxPhase = phaseCanvas.getContext('2d');
new Chart(ctxPhase, {
type: 'bar',
data: {
labels: ['Early', 'Mid', 'Late'],
datasets: [
{
label: 'Kills',
data: [
{{ features.get('rd_phase_kill_early_share', 0) }},
{{ features.get('rd_phase_kill_mid_share', 0) }},
{{ features.get('rd_phase_kill_late_share', 0) }}
],
backgroundColor: 'rgba(124, 58, 237, 0.55)'
},
{
label: 'Deaths',
data: [
{{ features.get('rd_phase_death_early_share', 0) }},
{{ features.get('rd_phase_death_mid_share', 0) }},
{{ features.get('rd_phase_death_late_share', 0) }}
],
backgroundColor: 'rgba(148, 163, 184, 0.55)'
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
suggestedMax: 1,
ticks: {
callback: (v) => `${Math.round(v * 100)}%`
}
}
},
plugins: {
legend: { display: true, position: 'bottom' },
tooltip: {
callbacks: {
label: (ctx) => `${ctx.dataset.label}: ${(ctx.parsed.y * 100).toFixed(1)}%`
}
}
}
}
});
phaseCanvas.remove();
}
const weaponTop = JSON.parse({{ (features.get('rd_weapon_top_json', '[]') or '[]') | tojson }});