Skip to content

Commit e72253a

Browse files
committed
fix: handle legacy pbs in friendlist frontend (show less details)
1 parent d6233f3 commit e72253a

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

frontend/src/ts/pages/friends.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ function updatePendingConnections(): void {
181181
<td class="actions">
182182
<button class="accepted" aria-label="accept" data-balloon-pos="up">
183183
<i class="fas fa-check fa-fw"></i>
184-
</button>
184+
</button>
185185
<button class="rejected" aria-label="reject" data-balloon-pos="up">
186186
<i class="fas fa-times fa-fw"></i>
187-
</button>
187+
</button>
188188
<button class="blocked" aria-label="block" data-balloon-pos="up">
189189
<i class="fas fa-shield-alt fa-fw"></i>
190190
</button>
@@ -304,7 +304,7 @@ function buildFriendRow(entry: Friend): HTMLTableRowElement {
304304
entry.streak?.maxLength,
305305
"longest streak",
306306
)}" data-balloon-pos="up">
307-
${formatStreak(entry.streak?.length)}
307+
${formatStreak(entry.streak?.length)}
308308
</span></td>
309309
<td class="small"><span aria-label="${
310310
top15?.details
@@ -318,7 +318,7 @@ function buildFriendRow(entry: Friend): HTMLTableRowElement {
318318
}<div class="sub">${top60?.acc ?? "-"}</div></span></td>
319319
<td class="actions">
320320
${actions}
321-
321+
322322
</td>
323323
</tr>`;
324324

@@ -367,14 +367,25 @@ function formatPb(entry?: PersonalBest):
367367
details: "",
368368
};
369369

370-
result.details = [
370+
const details = [
371371
`${getLanguageDisplayString(entry.language)}`,
372372
`${result.wpm} wpm`,
373-
`${result.acc} acc`,
374-
`${result.raw} raw`,
375-
`${result.con} con`,
376-
`${dateFormat(entry.timestamp, "dd MMM yyyy")}`,
377-
].join("\n");
373+
];
374+
375+
if (entry.acc) {
376+
details.push(`${result.acc} acc`);
377+
}
378+
if (entry.raw) {
379+
details.push(`${result.raw} raw`);
380+
}
381+
if (entry.consistency) {
382+
details.push(`${result.con} con`);
383+
}
384+
if (entry.timestamp) {
385+
details.push(`${dateFormat(entry.timestamp, "dd MMM yyyy")}`);
386+
}
387+
388+
result.details = details.join("\n");
378389

379390
return result;
380391
}

0 commit comments

Comments
 (0)