add table to reviews tooltip

This commit is contained in:
Damien Elmes 2020-07-16 13:25:13 +10:00
parent 1e48188c14
commit 0c1d5ae5a4

View File

@ -224,47 +224,40 @@ export function renderReviews(
const day = dayLabel(i18n, d.x0!, d.x1!); const day = dayLabel(i18n, d.x0!, d.x1!);
const totals = totalsForBin(d); const totals = totalsForBin(d);
const dayTotal = valueLabel(sum(totals)); const dayTotal = valueLabel(sum(totals));
let buf = `<div>${day}: ${dayTotal}</div>`; let buf = `<table><tr><td>${day}</td><td align=right>${dayTotal}</td></tr>`;
const lines = [ const lines = [
[ [
darkerGreens(1), darkerGreens(1),
`${i18n.tr(i18n.TR.STATISTICS_COUNTS_MATURE_CARDS)}: ${valueLabel( i18n.tr(i18n.TR.STATISTICS_COUNTS_MATURE_CARDS),
totals[0] valueLabel(totals[0]),
)}`,
], ],
[ [
lighterGreens(1), lighterGreens(1),
`${i18n.tr(i18n.TR.STATISTICS_COUNTS_YOUNG_CARDS)}: ${valueLabel( i18n.tr(i18n.TR.STATISTICS_COUNTS_YOUNG_CARDS),
totals[1] valueLabel(totals[1]),
)}`,
], ],
[ [
blues(1), blues(1),
`${i18n.tr(i18n.TR.STATISTICS_COUNTS_LEARNING_CARDS)}: ${valueLabel( i18n.tr(i18n.TR.STATISTICS_COUNTS_LEARNING_CARDS),
totals[2] valueLabel(totals[2]),
)}`,
], ],
[ [
reds(1), reds(1),
`${i18n.tr(i18n.TR.STATISTICS_COUNTS_RELEARNING_CARDS)}: ${valueLabel( i18n.tr(i18n.TR.STATISTICS_COUNTS_RELEARNING_CARDS),
totals[3] valueLabel(totals[3]),
)}`,
], ],
[ [
oranges(1), oranges(1),
`${i18n.tr(i18n.TR.STATISTICS_COUNTS_EARLY_CARDS)}: ${valueLabel( i18n.tr(i18n.TR.STATISTICS_COUNTS_EARLY_CARDS),
totals[4] valueLabel(totals[4]),
)}`,
],
[
"grey",
`${i18n.tr(i18n.TR.STATISTICS_RUNNING_TOTAL)}: ${valueLabel(
cumulative
)}`,
], ],
["grey", i18n.tr(i18n.TR.STATISTICS_RUNNING_TOTAL), valueLabel(cumulative)],
]; ];
for (const [colour, text] of lines) { for (const [colour, label, detail] of lines) {
buf += `<div><span style="color: ${colour};">■</span>${text}</div>`; buf += `<tr>
<td><span style="color: ${colour};"></span>${label}</td>
<td align=right>${detail}</td>
</tr>`;
} }
return buf; return buf;
} }