Skip to content

feat(web): anchor the composer settings sheet to the clicked value button - #1627

Open
KorenKrita wants to merge 1 commit into
tiann:mainfrom
KorenKrita:feat/composer-anchored-settings-section
Open

feat(web): anchor the composer settings sheet to the clicked value button#1627
KorenKrita wants to merge 1 commit into
tiann:mainfrom
KorenKrita:feat/composer-anchored-settings-section

Conversation

@KorenKrita

Copy link
Copy Markdown
Contributor

Problem

Since #1475 the composer shows [model] and [effort] value buttons whose captions are the current values. Clicking either one opened the same full settings sheet as the gear, always rendered from the top in the fixed order Model → Effort → Permission → other. So clicking Effort never took you to Effort — you landed on the Model section and had to scroll past every model row to reach the control you asked for. The label on the button promised a specific destination the sheet did not deliver.

Changes

HappyComposer gains a settingsSection state ('model' | 'effort' | null) that anchors the open sheet:

  • model button expands only the Model area (including the Cursor variant drill-down).
  • effort button expands only the Effort / Reasoning-effort area.
  • gear keeps the full sheet (null anchor).
  • Clicking the other value button while the sheet is open switches sections in place rather than closing, so model → effort is one click.
  • Clicking the gear over an anchored sheet expands it to the full sheet.
  • Re-clicking the same trigger still closes, preserving the feat(web): composer model/effort value buttons and first-class permission (part of #1438) #1475 toggle-close behaviour.

Implementation notes:

  • The section gating happens on sheet-local flags derived inside the overlays memo (sheetModelSettings, sheetEffortSettings, …), so the section-divider conditions keep working and a single visible area never renders a leading, trailing, or orphaned divider.
  • handleGearToggle is a zero-arg wrapper for the DOM onClick consumer, so a MouseEvent can never leak into the section parameter.
  • modelValueOpen / effortValueOpen now highlight only while their own area is expanded, instead of both lighting up whenever the sheet was open.
  • dismissSettings clears the anchor along with the sheet and the Cursor drill-down, so no stale anchor can survive a dismissal.

Unchanged: the outside-click dismissal exemption for all three triggers, Pi's mid-turn control liveness (configurationControlsDisabled, #1442), the Cursor variant drill-down flow, and narrow-viewport behaviour (value buttons hidden, gear opens the full sheet).

Testing

  • web: 2558 tests pass, bunx tsc --noEmit clean.
  • Updated HappyComposer.modelEffortButtons coverage: anchored open from each value button (asserting the other sections stay collapsed), in-place section switching, gear opening the full sheet, and the gear expanding an already-anchored sheet.

…'s section

The model/effort value buttons and the gear all opened the identical full
settings sheet from the top, so clicking Effort still landed on the Model
section. Anchor the open instead: the model button expands only the Model
area (incl. Cursor variant drill-down), the effort button only the
Effort/Reasoning area, and the gear keeps the full sheet. Clicking the other
value button while open switches sections in place; clicking the gear over
an anchored sheet expands it to the full sheet; re-clicking the same trigger
closes (preserves the tiann#1475 toggle-close behavior).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • None.

Questions

  • None.

Summary

  • Review mode: initial. No reportable issues found in the latest full diff. Residual coverage risk: the added tests do not exercise effort → model, full-sheet → anchored transitions, or Cursor drill-down followed by gear expansion.

Testing

  • Not run (automation). At review time, the GitHub integration check passed; test and pr-review were pending.

HAPI Bot

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant