fix(friendlist): handle legacy pbs in friendlist frontend (show less details) (@wradion) (#7296)

### Description

Show less details for legacy PBs in the friendlist.

### Checks

- [x] Check if any open issues are related to this PR; if so, be sure to
tag them below.
- [x] Make sure the PR title follows the Conventional Commits standard.
(https://www.conventionalcommits.org for more info)
- [x] Make sure to include your GitHub username prefixed with @ inside
parentheses at the end of the PR title.

---------

Co-authored-by: Miodec <13181393+Miodec@users.noreply.github.com>
Co-authored-by: Miodec <jack@monkeytype.com>
This commit is contained in:
wRadion 2026-01-05 18:00:13 +01:00 committed by GitHub
parent 785619c5e2
commit 2dc99e9e70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 18 deletions

View file

@ -181,10 +181,10 @@ function updatePendingConnections(): void {
<td class="actions">
<button class="accepted" aria-label="accept" data-balloon-pos="up">
<i class="fas fa-check fa-fw"></i>
</button>
</button>
<button class="rejected" aria-label="reject" data-balloon-pos="up">
<i class="fas fa-times fa-fw"></i>
</button>
</button>
<button class="blocked" aria-label="block" data-balloon-pos="up">
<i class="fas fa-shield-alt fa-fw"></i>
</button>
@ -304,7 +304,7 @@ function buildFriendRow(entry: Friend): HTMLTableRowElement {
entry.streak?.maxLength,
"longest streak",
)}" data-balloon-pos="up">
${formatStreak(entry.streak?.length)}
${formatStreak(entry.streak?.length)}
</span></td>
<td class="small"><span aria-label="${
top15?.details
@ -318,7 +318,7 @@ function buildFriendRow(entry: Friend): HTMLTableRowElement {
}<div class="sub">${top60?.acc ?? "-"}</div></span></td>
<td class="actions">
${actions}
</td>
</tr>`;
@ -367,14 +367,25 @@ function formatPb(entry?: PersonalBest):
details: "",
};
result.details = [
const details = [
`${getLanguageDisplayString(entry.language)}`,
`${result.wpm} wpm`,
`${result.acc} acc`,
`${result.raw} raw`,
`${result.con} con`,
`${dateFormat(entry.timestamp, "dd MMM yyyy")}`,
].join("\n");
];
if (isSafeNumber(entry.acc)) {
details.push(`${result.acc} acc`);
}
if (isSafeNumber(entry.raw)) {
details.push(`${result.raw} raw`);
}
if (isSafeNumber(entry.consistency)) {
details.push(`${result.con} con`);
}
if (isSafeNumber(entry.timestamp)) {
details.push(`${dateFormat(entry.timestamp, "dd MMM yyyy")}`);
}
result.details = details.join("\n");
return result;
}

16
pnpm-lock.yaml generated
View file

@ -3800,8 +3800,8 @@ packages:
base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
baseline-browser-mapping@2.9.11:
resolution: {integrity: sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==}
baseline-browser-mapping@2.9.10:
resolution: {integrity: sha512-2VIKvDx8Z1a9rTB2eCkdPE5nSe28XnA+qivGnWHoB40hMMt/h1hSz0960Zqsn6ZyxWXUie0EBdElKv8may20AA==}
hasBin: true
basic-auth-connect@1.0.0:
@ -3999,8 +3999,8 @@ packages:
caniuse-lite@1.0.30001715:
resolution: {integrity: sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==}
caniuse-lite@1.0.30001762:
resolution: {integrity: sha512-PxZwGNvH7Ak8WX5iXzoK1KPZttBXNPuaOvI2ZYU7NrlM+d9Ov+TUvlLOBNGzVXAntMSMMlJPd+jY6ovrVjSmUw==}
caniuse-lite@1.0.30001761:
resolution: {integrity: sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==}
canvas-confetti@1.5.1:
resolution: {integrity: sha512-Ncz+oZJP6OvY7ti4E1slxVlyAV/3g7H7oQtcCDXgwGgARxPnwYY9PW5Oe+I8uvspYNtuHviAdgA0LfcKFWJfpg==}
@ -12997,7 +12997,7 @@ snapshots:
base64-js@1.5.1: {}
baseline-browser-mapping@2.9.11: {}
baseline-browser-mapping@2.9.10: {}
basic-auth-connect@1.0.0: {}
@ -13134,8 +13134,8 @@ snapshots:
browserslist@4.28.0:
dependencies:
baseline-browser-mapping: 2.9.11
caniuse-lite: 1.0.30001762
baseline-browser-mapping: 2.9.10
caniuse-lite: 1.0.30001761
electron-to-chromium: 1.5.267
node-releases: 2.0.27
update-browserslist-db: 1.2.3(browserslist@4.28.0)
@ -13263,7 +13263,7 @@ snapshots:
caniuse-lite@1.0.30001715: {}
caniuse-lite@1.0.30001762: {}
caniuse-lite@1.0.30001761: {}
canvas-confetti@1.5.1: {}