Skip to content

Add a close button to the map panel footer #231

Closed

Description

@ToRvaLDz

Parent: trailhead mod: Claude Code function hooks for on-screen state, context and in-process guards

Goal

Add a close button to the map panel footer, on the same row as refresh, aligned to the right edge. Pressing it closes the panel.

Scope

  • Footer row: [ refresh ] updated <age> on the left, [ close ] pushed to the right (justifyContent="space-between" over the pane width), the age label still fitting in between.
  • The press runs $.ui.close({ id: PANE_ID }); the existing ui.close hook stops the timers as today. A close from this button counts as the person closing the panel, so the auto-open never fires again this session (as with the engine's own close mark).

Done when

  • The footer shows refresh on the left and close on the right edge, on terminal and desktop surfaces.
  • Pressing close closes the panel and stops its refreshes.
  • A mod test covers the press; the mod README footer description mentions the button.

Notes

Activity

  1. self-assigned this
    on Oct 13, 2026
  2. ToRvaLDz commented on Oct 13, 2026

    @ToRvaLDz
    OwnerAuthor

    PLAN

    Steps

    1. map-pane-view.ts: add a pure footerStatus(status, columns) that fits the footer status into what is left after the two buttons (refresh + close, each with BUTTON_CHROME, plus the gaps), with an ellipsis via the existing fit. Unit test in map-pane-view.test.ts (short status kept whole, long ⚠ <reason> · list from <age> cut to the room).
    2. map-pane.tsx: add closePane($): set paneAutoOpened to true, then $.ui.close({ id: PANE_ID }) (the existing ui.close hook stops the timers). The footer row becomes <Box width={cols} justifyContent="space-between"> holding <Box gap={1}>[refresh] <age></Box> on the left and <Button key="close" label="close"> on the right; the age text goes through footerStatus. A failed close is logged to debug like the other presses.
    3. map-pane-ui.test.ts (both surfaces): the footer shows refresh then close, in a space-between row over the pane width; pressing close removes the pane, no fetch follows (timer + turn.complete), and a later fullscreen band render never auto-opens it again. Update the two existing button-list assertions to end with close.
    4. hooks/mod/README.md: the footer sentence names the close button; the auto-open line counts a close press as the person closing it.

    Seams: footerStatus (pure, view), closePane (press handler), footer render.
    Files: plugins/trailhead/hooks/mod/map-pane-view.ts, map-pane.tsx, README.md, tests/map-pane-view.test.ts, tests/map-pane-ui.test.ts.
    TDD (seams): tests for footerStatus and the close press first, failing, then the implementation.

    Verification criteria

    • claude plugin test plugins/trailhead passes (all suites), claude plugin validate clean.
    • Footer: refresh + age on the left, close at the right edge, terminal and desktop.
    • Pressing close closes the pane, stops refreshes, and the auto-open does not fire again this session.
  3. ToRvaLDz commented on Oct 13, 2026

    @ToRvaLDz
    OwnerAuthor

    PLAN-REVIEW

    Reviewer: codex (one round). Concerns and resolution:

    • [blocking] The auto-open flag was set before the close succeeded. Resolved: closePane closes first and sets paneAutoOpened only after $.ui.close returns.
    • [blocking] openPane already sets the flag, so the close-time write may be redundant. Acknowledged: a shown pane normally already carries it; the write stays as the explicit "the person closed it" mark the ticket asks for (it also covers a pane up with the flag unset). The test asserts the observable behaviour (no auto-open after the press).
    • [blocking] An in-flight refresh after the close. Already handled: a refresh result is dropped when the pane closed meanwhile, and the ui.close hook stops the timers. The new test also advances past the timer and completes a turn after the press.
    • [non-blocking] Narrow widths: footerStatus clamps the room at zero before fit; a unit test covers a pane too narrow for the status.
    • [non-blocking] Layout arithmetic: centralised in footerStatus in the view module, next to BUTTON_CHROME.
    • [non-blocking] Right alignment: the mod test harness has no layout engine, so the test asserts the row props (width = pane columns, justifyContent: space-between) and the button order.
    • [non-blocking] Overlap with Switch maps from the panel by clicking one #229 and Keep the map panel through /clear and clear before work #230: both already landed on main; nothing to rebase.

    The plan stands with the close-then-flag order.

  4. ToRvaLDz commented on Oct 13, 2026

    @ToRvaLDz
    OwnerAuthor

    status: clean
    critical: 0 · warning: 1 · info: 2

    VERIFY

    Tests: claude plugin test plugins/trailhead 225 pass, 0 fail; claude plugin validate passes.

    Findings ledger

    • W1 · the auth-failure hint (run gh auth login) and the kept list's age were cut beside the buttons at the default 60 columns · fixed (e95ee1b, 7fdb1d2, 5e571ca): a status that does not fit beside the buttons moves whole to a row of its own under them; the three failure tests are back at the default width
    • I1 · closePane writes the auto-open flag after the close, partly duplicating the ui.close person branch · accepted: close-then-flag was the plan review's resolution (a failed close leaves the flag as it was); the mod-initiated close is not a person close, so the explicit write is needed
    • I2 · the layout test checks props only, and BUTTON_CHROME is terminal-only · accepted: the harness has no layout engine; on the desktop the buttons are native and space-between keeps close at the right edge, while the inline-or-below choice only decides where the status sits

    Goal check (backward from Done when)

    • Footer shows refresh left and close at the right edge on terminal and desktop: met (footer-row, width = pane columns, space-between; tested on both surfaces).
    • Pressing close closes the panel and stops its refreshes: met (pane removed, no fetch after the timer and a turn).
    • The press counts as the person closing it: met (no auto-open after a later fullscreen render).
    • A mod test covers the press; the README footer mentions the button: met.
  5. ToRvaLDz commented on Oct 13, 2026

    @ToRvaLDz
    OwnerAuthor

    Resolved. The Map pane footer now has refresh and the status on the left and a close button at the right edge, on terminal and desktop. Pressing close closes the panel, stops its refreshes, and counts as the person closing it, so the panel does not auto-open again this session. A status too long to sit beside the buttons (a gh failure reason with its hint and the kept list's age) moves whole to a row of its own under them.

    Commits: b92e028, 2a78736, 73e6ca5, 0f4c866, b39045d, e95ee1b, 7fdb1d2, 5e571ca. Files: plugins/trailhead/hooks/mod/map-pane.tsx, map-pane-view.ts, README.md, tests/map-pane-ui.test.ts, tests/map-pane-view.test.ts.

    Verification: 225 tests pass, claude plugin validate passes; review ledger in the VERIFY comment above (no open findings); guided UAT passed live (footer layout, close press, no auto-reopen).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

trailhead:buildtype: construct — discuss/plan/execute/verifytrailhead:map-198Tickets of map #198 (trailhead mod)trailhead:ticketa trailhead ticket

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions