From cfff7120e43e0aa9593252924cc59be9c8d667d2 Mon Sep 17 00:00:00 2001 From: jack rosenberg <56937175+jackrosenberg@users.noreply.github.com> Date: Thu, 26 Jun 2025 16:43:01 +0200 Subject: [PATCH] fix(xp-bar): don't show attribute if it's 0 (@jackrosenberg) (#6664) Only show accPenalty if it's relevant. Still need to build and test :) ### Description ### Checks - [ ] Adding quotes? - [ ] Make sure to include translations for the quotes in the description (or another comment) so we can verify their content. - [ ] Adding a language? - Make sure to follow the [languages documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/LANGUAGES.md) - [ ] Add language to `packages/contracts/src/schemas/languages.ts` - [ ] Add language to exactly one group in `frontend/src/ts/constants/languages.ts` - [ ] Add language json file to `frontend/static/languages` - [ ] Adding a theme? - Make sure to follow the [themes documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/THEMES.md) - [ ] Add theme to `packages/contracts/src/schemas/themes.ts` - [ ] Add theme to `frontend/src/ts/constants/themes.ts` - [ ] Add theme css file to `frontend/static/themes` - Also please add a screenshot of the theme, it would be extra awesome if you do so! - [ ] Adding a layout? - [ ] Make sure to follow the [layouts documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/LAYOUTS.md) - [ ] Add layout to `packages/contracts/src/schemas/layouts.ts` - [ ] Add layout json file to `frontend/static/layouts` - [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. Closes # --- frontend/src/ts/elements/xp-bar.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/ts/elements/xp-bar.ts b/frontend/src/ts/elements/xp-bar.ts index 6404b5872..51565e125 100644 --- a/frontend/src/ts/elements/xp-bar.ts +++ b/frontend/src/ts/elements/xp-bar.ts @@ -322,7 +322,7 @@ async function animateXpBreakdown( if (skip) return; - if (isSafeNumber(breakdown.accPenalty)) { + if (isSafeNumber(breakdown.accPenalty) && breakdown.accPenalty > 0) { await Misc.sleep(delay); total -= breakdown.accPenalty; void flashTotalXp(total); @@ -331,7 +331,7 @@ async function animateXpBreakdown( if (skip) return; - if (isSafeNumber(breakdown.incomplete)) { + if (isSafeNumber(breakdown.incomplete) && breakdown.incomplete > 0) { await Misc.sleep(delay); total += breakdown.incomplete; void flashTotalXp(total);