feat(helpdesk): replace abstract driver bars with concrete reason texts
Cards now show plain-language reasons instead of abstract progress bars: '8 open, 3 critical', '↑4 more than resolved', '2 SLA breaches', 'Oldest ticket 12d'. Instantly understandable without knowing the scoring formula. Driver bars remain in the detail dialog for the full dimension breakdown. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -111,22 +111,29 @@ if (container) {
|
||||
|
||||
card.appendChild(metrics);
|
||||
|
||||
// Top drivers
|
||||
const drivers = customer.drivers || [];
|
||||
if (drivers.length > 0) {
|
||||
const driverSection = h('div', 'helpdesk-risk-card-drivers');
|
||||
for (const dr of drivers) {
|
||||
if (dr.dimension_score === null || dr.weighted_points <= 0) continue;
|
||||
const row = h('div', 'helpdesk-risk-card-driver');
|
||||
row.appendChild(h('span', 'helpdesk-risk-card-driver-label', dimLabel(dr.id)));
|
||||
const bar = h('div', 'helpdesk-risk-card-driver-bar');
|
||||
const fill = h('div', 'helpdesk-risk-card-driver-fill');
|
||||
fill.style.width = Math.min(100, dr.dimension_score) + '%';
|
||||
bar.appendChild(fill);
|
||||
row.appendChild(bar);
|
||||
driverSection.appendChild(row);
|
||||
// Why at risk — concrete facts
|
||||
const kpiOpen = kpis.open || 0;
|
||||
const kpiCritical = kpis.critical || 0;
|
||||
const kpiSla = kpis.sla_overdue || 0;
|
||||
const kpiNet = kpis.net_flow || 0;
|
||||
const kpiOldest = kpis.oldest_open_hours || 0;
|
||||
|
||||
const reasons = [];
|
||||
if (kpiOpen > 0) {
|
||||
let text = kpiOpen + ' ' + d('labelOpen', 'open');
|
||||
if (kpiCritical > 0) text += ', ' + kpiCritical + ' ' + d('labelCritical', 'critical');
|
||||
reasons.push(text);
|
||||
}
|
||||
if (kpiNet > 0) reasons.push('↑' + kpiNet + ' ' + d('labelMoreThanResolved', 'more than resolved'));
|
||||
if (kpiSla > 0) reasons.push(kpiSla + ' ' + d('labelSlaBreaches', 'SLA breaches'));
|
||||
if (kpiOldest > 168) reasons.push(d('labelOldestTicket', 'Oldest ticket') + ' ' + formatAge(kpiOldest));
|
||||
|
||||
if (reasons.length > 0) {
|
||||
const reasonList = h('ul', 'helpdesk-risk-card-reasons');
|
||||
for (const r of reasons) {
|
||||
reasonList.appendChild(h('li', '', '• ' + r));
|
||||
}
|
||||
card.appendChild(driverSection);
|
||||
card.appendChild(reasonList);
|
||||
}
|
||||
|
||||
// Click/keyboard to open detail
|
||||
|
||||
Reference in New Issue
Block a user