Fix #134: Cosmetic title replaces clickable username on leaderboard #137
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "typosaurus/ticket-134"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #134.
Plan
Implementation Plan: Fix leaderboard username squeeze when a title is equipped
Root Cause
In
devplacepy/static/css/game.css, the leaderboard row uses flex layout. The username link (.game-lb-name) hasflex: 1; min-width: 0, making it shrink to zero when the total row width is exceeded. The title (.game-lb-title) hasflex-shrink: 0, so it never shrinks. When a long title like "Serial Refactorer" is present, the username collapses to ~1 pixel, becoming invisible (only an ellipsis shown).Change Summary
Restructure the leaderboard row in the JavaScript template (
GameFarm.js) and update corresponding CSS (game.css) so that the username and title are stacked vertically inside a flex column container, rather than competing on the same horizontal line.Specifically:
<a class="game-lb-name">and the optional<span class="game-lb-title">in a newdivwith a classgame-lb-name-group..game-lb-name-groupis a flex column (no gap), the name link retains clickable styling, and the title is a small italic line below the name.Files to Modify
devplacepy/static/js/GameFarm.js– lines 370–374Change the template literal to wrap the name and title in a container.
devplacepy/static/css/game.css– lines 224–271Update
.game-lb-row,.game-lb-name,.game-lb-titlerules to accommodate the new structure.Remove the conflicting
flex: 1; min-width: 0from.game-lb-name.Add
.game-lb-name-groupstyling.Optional but recommended:
tests/e2e/game/index.py– add a new test case that equips a title and asserts the username link is visible and clickable.Detailed Steps
Step 1: Modify the JavaScript template (
GameFarm.js)Current (lines 370–374):
New:
Step 2: Update CSS (
game.css)Remove or replace the following:
.game-lb-name(line 244–254): changeflex: 1→ remove flex properties, keep link styling (font-weight: 600,text-decoration: none, etc.). Addwhite-space: nowrap; overflow: hidden; text-overflow: ellipsis;so that if the username itself is very long it still truncates, but it will now have a minimum width via its container..game-lb-title(line 266–271): removeflex-shrink: 0;because it's no longer a direct child of the row. Keepfont-style: italic; color: var(--accent);and adddisplay: block;(orinline-block) andfont-size: 0.75rem;to appear on a second line.Add new rule:
Adjust
.game-lb-row(line 224): no changes needed; stilldisplay: flex; align-items: center; gap: var(--space-sm);.Adjust
.game-lb-rank,.game-lb-level,.game-lb-score: they keep theirflex-shrink: 0and fixed widths.Step 3: Update E2E test (optional but recommended)
Add a test in
tests/e2e/game/index.pythat:href, and that the title text is also visible.Example:
Place this test after
test_leaderboard_panel_populates(line 290).Verification (Definition of Done)
pip install -e '.[dev]' -q && python -m pytest tests/(If any pre-existing failures occur, they are unrelated to this change; no new failures are introduced.)
test_leaderboard_shows_username_and_title(if added) passes./game.The above plan addresses the root CSS conflict without altering backend logic or the data schema. It ensures the username link always remains clearly visible and functional, even with the longest currently defined titles (e.g., "Serial Refactorer" at ~15 characters).
Opened automatically by Typosaurus.