Repository navigation
Show level badges on the ranked leaderboard and clan member lists #5764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
53b26e0
Show player levels and the XP each game earns
iiamlewis 6ff9abf
Strip Lit's comment markers in the badge tests as nodes, not by regex
iiamlewis c91fed6
Merge branch 'main' into player-levels-ui
iiamlewis 0ef94ba
Harden player levels UI from PR review
iiamlewis 23be312
Merge branch 'main' into player-levels-ui
iiamlewis b899cb0
Address review on player levels: unverified games, off-screen reveals…
iiamlewis 216851d
Rename the first-win XP line to first game of the day
iiamlewis a9c27cb
Recognise the new subscriber XP boosts: +25% / +50% / +100%
iiamlewis 399acf7
feat: stamp player levels onto the lobby roster
iiamlewis 0e2d49c
feat: show level badges in the lobby list and player panel
iiamlewis 696786d
feat: level badges on the ranked leaderboard and clan member lists
iiamlewis 5f83874
Stack the XP reveal's counter and level progress on a narrow bar
iiamlewis 6a758f1
Show the XP a past game earned under its summary card
iiamlewis 2edf46b
perf: carry the roster's level badge as one packed integer
iiamlewis adf5447
Merge roster-levels (packed level badge) into leaderboard-levels
iiamlewis f6bf428
perf: draw a full lobby's level badges over a few frames
iiamlewis 460e8cf
Merge roster-levels (staggered badge fill) into leaderboard-levels
iiamlewis c93e4b0
Merge main: src/core split into engine, engine-api and shared packages
iiamlewis 0a960f1
Merge player-levels-ui: src/core split into packages
iiamlewis 59a8e74
Merge roster-levels: src/core split into packages
iiamlewis c1f80da
Merge remote-tracking branch 'origin/main' into player-levels-ui
iiamlewis d1ae378
Point the XP popup test at EventBus's new home in @openfront/shared
iiamlewis 88a6c74
Merge player-levels-ui: bring the branch up to date with main
iiamlewis 735f76d
Merge remote-tracking branch 'origin/roster-levels' into leaderboard-…
iiamlewis 1271d1f
Merge main: lazy-loaded homepage modals
iiamlewis 5fec34e
fix: tolerate malformed row level fields; stagger list badges; let na…
iiamlewis 1f01c85
Honour "hide my level" on the roster badge; own badge after a refresh
iiamlewis 812cc15
Address review on the player levels UI
iiamlewis c1b833f
Merge player-levels-ui (review fixes)
iiamlewis cd55b4b
Merge roster-levels (review fixes)
iiamlewis 0111c2c
Merge main (#5726 and #5778 landed)
iiamlewis 31b1adf
Merge roster-levels (main sync)
iiamlewis 021c072
Merge origin/main into leaderboard-levels
iiamlewis 5b34dae
Merge origin/main into leaderboard-levels
iiamlewis 1596c6b
Merge branch 'main' into leaderboard-levels
Celant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import { html, nothing, type TemplateResult } from "lit"; | ||
| import "./LevelBadge"; | ||
|
|
||
| /** | ||
| * A row's level fields as the API sends them on leaderboard and clan member | ||
| * rows: all three present for a player with progress, all absent otherwise | ||
| * (no progress yet, or progression switched off). The schema drops a | ||
| * malformed field on its own, so a row can also arrive with only some. | ||
| */ | ||
| export interface LevelFields { | ||
| level?: number; | ||
| prestige?: number; | ||
| legend?: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * The row's badge, or undefined unless all three fields are present: with | ||
| * one dropped as malformed the row shows no badge rather than a guessed one. | ||
| */ | ||
| function rowBadge(row: LevelFields): Required<LevelFields> | undefined { | ||
| const { level, prestige, legend } = row; | ||
| if (level === undefined || prestige === undefined || legend === undefined) { | ||
| return undefined; | ||
| } | ||
| return { level, prestige, legend }; | ||
| } | ||
|
|
||
| /** True when the row carries a level to draw. */ | ||
| export function hasLevel(row: LevelFields): boolean { | ||
| return rowBadge(row) !== undefined; | ||
| } | ||
|
|
||
| /** | ||
| * True when the row has prestiged at least once or is a Legend. The ranked | ||
| * leaderboard badges only these players, so that the badge stays rare enough | ||
| * there to mean something and the board doesn't get cluttered; clan member | ||
| * lists and the lobby roster badge anyone with a level. | ||
| */ | ||
| export function isPrestigedOrLegend(row: LevelFields): boolean { | ||
| const badge = rowBadge(row); | ||
| return badge !== undefined && (badge.legend || badge.prestige > 0); | ||
| } | ||
|
|
||
| /** | ||
| * The level badge in front of a name in a list, or — when `show` is false — | ||
| * an empty slot of the same width so names stay lined up with the rows that | ||
| * do have one. With `reserveSlot` false (no row in the list has a badge), | ||
| * renders nothing at all, so lists look unchanged until levels appear. | ||
| * Badges are `stagger`ed: a page of them arriving at once is drawn over a | ||
| * few frames (see LevelBadgeFill). | ||
| */ | ||
| export function levelBadgeSlot( | ||
| row: LevelFields, | ||
| show: boolean, | ||
| reserveSlot: boolean, | ||
| size = 24, | ||
| ): TemplateResult | typeof nothing { | ||
| const badge = show ? rowBadge(row) : undefined; | ||
| if (badge !== undefined) { | ||
| return html`<level-badge | ||
| stagger | ||
| class="shrink-0" | ||
| .level=${badge.level} | ||
| .prestige=${badge.prestige} | ||
| ?legend=${badge.legend} | ||
| size=${size} | ||
| ></level-badge>`; | ||
| } | ||
| if (!reserveSlot) return nothing; | ||
| return html`<span | ||
| class="shrink-0" | ||
| style="width:${size}px;height:${size}px" | ||
| aria-hidden="true" | ||
| data-level-slot | ||
| ></span>`; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.