feat(dashboard): show per-chip question counts in filter row
Previously only the 'all' chip showed a count (all · N). The operator had to click each chip to see how many questions were in each category. Now every chip shows its own count: all · 5 @operator · 2 @peer · 3 @agentname · 1 This lets the operator see the distribution at a glance and navigate directly to whichever category has pending items without guessing.
This commit is contained in:
parent
6f0b176778
commit
9ab08cef5b
1 changed files with 11 additions and 4 deletions
|
|
@ -1863,13 +1863,20 @@ window.marked = marked;
|
|||
b.addEventListener('click', () => setQuestionsFilter(value));
|
||||
return b;
|
||||
};
|
||||
// Count pending questions per filter value so each chip shows its
|
||||
// own hit count — the operator can see "operator · 2 / peer · 3"
|
||||
// at a glance without clicking through each tab.
|
||||
const operatorCount = allPending.filter((q) => !q.target).length;
|
||||
const peerCount = allPending.filter((q) => !!q.target).length;
|
||||
const agentCount = (name) => allPending.filter(
|
||||
(q) => q.asker === name || q.target === name).length;
|
||||
filterRow.append(
|
||||
mkChip('all', `all · ${allPending.length}`),
|
||||
mkChip('operator', '@operator'),
|
||||
mkChip('peer', '@peer'),
|
||||
mkChip('all', `all · ${allPending.length}`),
|
||||
mkChip('operator', `@operator · ${operatorCount}`),
|
||||
mkChip('peer', `@peer · ${peerCount}`),
|
||||
);
|
||||
for (const name of Array.from(participants).sort()) {
|
||||
filterRow.append(mkChip('agent:' + name, '@' + name));
|
||||
filterRow.append(mkChip('agent:' + name, `@${name} · ${agentCount(name)}`));
|
||||
}
|
||||
|
||||
// Evict resolved/cancelled questions from the row cache.
|
||||
|
|
|
|||
Loading…
Reference in a new issue