Let players reorder and hide sidebar panels (progress on #55) - #79
Merged
Conversation
Add a Panels block to the Settings panel: a show/hide checkbox and move up/down buttons per sidebar panel, plus a Reset Panel Layout button. The chosen order and visibility persist to localStorage under barony_panel_layout and are applied before first paint, alongside the existing open/closed state restore. Panels are reordered in the DOM rather than with CSS `order`, so keyboard tab order follows what is on screen; the now-redundant CSS order rules are dropped and the markup carries the default order instead, which also puts Run History back under Game Status as PLAYER_GUIDE describes. The order and visibility rules are pure functions in game-logic.js (resolvePanelOrder, movePanelInOrder, isPanelHidden), covered by 12 new cases in the Node suite. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Markup order is now load-bearing: it is what the page reads into DEFAULT_PANEL_ORDER, what Reset Panel Layout restores, and the keyboard tab order. Add GamePageSidebarLayoutTest to assert the documented default order, that every collapsible panel is one of the arrangeable ones, and that the Settings panel carries the layout controls. Reverting game.html fails the order and controls assertions. Also bring README and MVP into step: the sidebar feature list gains the new barony_panel_layout key, and MVP's sidebar bullet gains Run History (missing since that panel shipped) and the arranging behaviour. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
Self-review rubricScored against the diff and command output on head
Findings not covered by a rubric row
Backlog note#55 was the only open issue at triage time, so no other issue was deferred this cycle; the untested This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
and reordered by the player. A new Panels block in the Settings panel lists every sidebar
panel with a show/hide checkbox and ▲/▼ move buttons, plus a Reset Panel Layout button.
localStorageunderbarony_panel_layout(
{ order: [...], hidden: {...} }) and applied in the same pre-paint pass that already restoreseach panel's open/closed state, so a returning player is not shown the default sidebar first.
order, so keyboard tab order andscreen-reader reading order follow what is on screen. The four now-redundant
.game-sidebar > .section-* { order: N }rules are therefore removed and the markup carries thedefault order instead. As a side effect, a pre-existing ordering bug is fixed: the Run History
panel had no
orderrule, so it fell toorder: 0and rendered above Game Status, whichcontradicted
PLAYER_GUIDE.md. It now sits under Game Status as documented. Thearmiespanel'smarkup block is moved above
policyto preserve the order the deleted CSS rules expressed.explanatory tooltip) — hiding the panel that holds these controls would leave no way to bring the
other panels back. It can still be reordered.
buttons and checkboxes remain usable from the keyboard.
game-logic.js(
resolvePanelOrder,movePanelInOrder,isPanelHidden), matching the pattern already usedthere, and are exercised by 12 new cases in the Node suite.
resolvePanelOrderalso reconciles aremembered order against the panels actually present: unknown ids are dropped, duplicates
collapsed, and a panel added since the player last arranged the sidebar is inserted after the
panel it follows by default rather than sinking to the bottom.
PLAYER_GUIDE.mdgains an "Arranging the sidebar" section andCHANGELOG.mdan Unreleasedentry. The earlier changelog entry from PR Persist sidebar panel open/closed state across reloads #78, which stated that reordering and showing/hiding
were still open, is corrected.
Module(s) touched
web-clientonly. No backend change and no REST-contract change is made.Scope note on #55
Closes #Nis deliberately omitted: #55's remaining bullet — persisting the layout server-side,keyed to the authenticated account, so it follows a player across devices — is not addressed
here. That work spans both modules and the REST contract and is left for a follow-up cycle; #55 is
kept open for it. #55 was the only open issue at triage, so no other issue was deferred this cycle.
Verification
mvn testwas run locally in both modules:backend267 tests green,web-client14 testsgreen (the Thymeleaf
/gamerender tests confirm the reworked template still parses and serves).node --test web-client/src/test/js/) could not be run locally — no JSruntime is installed in this environment — so the 12 new pure-function cases are verified by the
CI job on this PR's head rather than locally.
game.html(checkbox/button handlers, DOMreordering, the
hiddenattribute) and the CSS have no automated coverage — CI compiles andrenders the page but cannot exercise clicks. A manual smoke test is recommended before merge.
Test plan
Backend Build and TestandWeb Client Build and Test(the latter includesnode --test web-client/src/test/js/)move a panel up and down, reload, and confirm the arrangement is restored; then use
Reset Panel Layout and confirm the default order (Game Status, Run History, Armies,
Change Policy, Settings) returns.
Progress on #55 (kept open for the server-side, per-account persistence bullet).
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).