Skip to content

feat: open the Style panel only when explicitly requested - #1775

Merged
giswqs merged 2 commits into
mainfrom
feat/explicit-style-panel-open
Aug 8, 2026
Merged

feat: open the Style panel only when explicitly requested#1775
giswqs merged 2 commits into
mainfrom
feat/explicit-style-panel-open

Conversation

@giswqs

@giswqs giswqs commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

  • The Style panel no longer auto-expands when a layer is selected, so picking layers in the Layers panel stops resizing the workspace unexpectedly.
  • Added an "Open Style panel" item to each layer's menu, which selects that layer and expands the Style panel through a new openRequest prop wired from DesktopShell.
  • Updated the first-map tutorial to match the new behavior.

Test plan

  • pre-commit run --files <changed paths> (includes the full npm build, eslint, oxfmt)
  • npm run test:frontend
  • Select layers in the Layers panel and confirm the Style panel stays on its rail
  • Use "Open Style panel" from a layer's menu and confirm the panel expands with that layer selected, in both the shared right-sidebar and standalone layouts

Summary by CodeRabbit

  • New Features

    • Added an “Open Style panel” action to each layer’s actions menu.
    • Selecting this action opens the Style panel for the chosen layer.
  • Bug Fixes

    • The Style panel no longer opens unexpectedly when switching layers.
  • Documentation

    • Updated the styling tutorial to reflect the new panel-opening workflow.

Selecting a layer no longer pops the Style panel open over the map, which
made the workspace jump around during ordinary layer picking. The panel now
expands only from the new "Open Style panel" item in a layer's menu.
Copilot AI lite review requested due to automatic review settings August 8, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2c3d5842-d0fd-426b-b8fe-74e27ff29df1

📥 Commits

Reviewing files that changed from the base of the PR and between b4a1ea3 and 06a4988.

📒 Files selected for processing (3)
  • apps/geolibre-desktop/src/components/layout/DesktopShell.tsx
  • apps/geolibre-desktop/src/components/panels/LayerPanel.tsx
  • apps/geolibre-desktop/src/components/panels/StylePanel.tsx

📝 Walkthrough

Walkthrough

Layer actions now select a layer and explicitly request Style panel opening. DesktopShell passes request counters to StylePanel instances. StylePanel no longer expands automatically on layer selection. Localization and tutorial text describe the updated interaction.

Changes

Style panel opening flow

Layer / File(s) Summary
Layer action and shell wiring
apps/geolibre-desktop/src/components/panels/LayerPanel.tsx, apps/geolibre-desktop/src/components/layout/DesktopShell.tsx
Layer actions select a layer and request Style panel opening. DesktopShell increments and passes the request counter to relevant panel instances.
Explicit StylePanel expansion
apps/geolibre-desktop/src/components/panels/StylePanel.tsx, apps/geolibre-desktop/src/i18n/locales/en.json, docs/tutorials/first-map.md
StylePanel expands when openRequest changes. The localization string and tutorial describe explicit opening.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LayerPanel
  participant DesktopShell
  participant StylePanel
  LayerPanel->>LayerPanel: select layer
  LayerPanel->>DesktopShell: invoke onOpenStylePanel
  DesktopShell->>DesktopShell: increment stylePanelOpenRequest
  DesktopShell->>StylePanel: pass openRequest
  StylePanel->>StylePanel: expand on openRequest change
Loading

Possibly related PRs

Suggested reviewers: craun718

Poem

A rabbit selects a layer with care,
Then asks the Style panel to appear.
The shell sends one request along,
The panel opens when it belongs.
“Hop into styling!” sings the hare.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: Style panel expansion now occurs only when explicitly requested.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/explicit-style-panel-open

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🔍 Cloudflare PR preview

Item Value
Site https://359a979f.geolibre-preview.pages.dev
Demo app https://359a979f.geolibre-preview.pages.dev/demo/
Commit 06a4988

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🔍 GitHub Pages PR preview

Item Value
Site https://opengeos.org/pages-preview/GeoLibre/pr-1775/
Demo app https://opengeos.org/pages-preview/GeoLibre/pr-1775/demo/
Commit 06a4988

Note

GitHub Pages built this preview successfully, but its serving edge returned HTTP 403 when checked. The links may still be propagating.

Comment thread apps/geolibre-desktop/src/components/panels/StylePanel.tsx Outdated
Comment thread apps/geolibre-desktop/src/components/panels/LayerPanel.tsx Outdated
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • StylePanel.tsx (~1019-1024, comment posted): the new openRequest effect calls setIsCollapsed(false) unconditionally, without the autoCollapse guard the removed selectedLayerId effect had. In the standalone layout, LayerPanel's "Open Style panel" item stays clickable while the notebook is open (LayerPanel's own auto-collapse doesn't include notebookOpen), so using it there forces the Style panel open over the notebook and the panel never re-collapses automatically afterward. High confidence — traced through both effects and the render-time autoCollapse/layoutOptions wiring in DesktopShell.tsx. This is masked in the shared-sidebar layout by SharedSidebar's forceBuiltinCollapsed, so it only reproduces in the standalone right-rail layout.
  • LayerPanel.tsx (~3370-3378, comment posted): the "Open Style panel" menu item is shown even when the Style panel is hidden via Settings (stylePanelVisible: false), in which case the click is a silent no-op — the request is dropped and isn't replayed even if the panel becomes visible later, since StylePanel's previousOpenRequest ref seeds from the current value at mount. Medium confidence, low severity (non-default setting).

Security

  • None found.

Performance

  • None found; the change only touches a small counter/ref and a couple of useCallback/useEffect hooks.

Quality

  • No automated test covers the new openRequest/auto-expand interaction (or the auto-collapse-vs-explicit-open conflict above), so the regression wouldn't be caught by npm run test:frontend. Low confidence this is required — the repo doesn't appear to unit-test StylePanel/LayerPanel/DesktopShell component wiring generally.
  • The rest of the diff (i18n string, tutorial doc wording, prop threading) is clean and consistent with the stated intent.

CLAUDE.md

  • No violations noted: en.json is the only locale touched, which matches the documented convention that non-English catalogs may lag and are not required per PR (tests/i18n-catalogs.test.ts only reports coverage, doesn't fail on missing keys).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/geolibre-desktop/src/components/panels/LayerPanel.tsx`:
- Around line 3370-3378: Gate the style-panel DropdownMenuItem in LayerPanel
behind the current StylePanel visibility state used by DesktopShell, so it is
hidden or disabled when stylePanelVisible is false. Update the item around
selectLayer and onOpenStylePanel, preserving normal selection and opening
behavior when the panel is mounted.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d9bed045-aa34-46a6-8bf3-e92f47dbf568

📥 Commits

Reviewing files that changed from the base of the PR and between 1578884 and b4a1ea3.

📒 Files selected for processing (5)
  • apps/geolibre-desktop/src/components/layout/DesktopShell.tsx
  • apps/geolibre-desktop/src/components/panels/LayerPanel.tsx
  • apps/geolibre-desktop/src/components/panels/StylePanel.tsx
  • apps/geolibre-desktop/src/i18n/locales/en.json
  • docs/tutorials/first-map.md

Comment thread apps/geolibre-desktop/src/components/panels/LayerPanel.tsx Outdated
- Gate the Style panel's open-request effect on `autoCollapse`, so a request
  made while the notebook or a story-map presentation owns the workspace can
  no longer force the panel open over them. The `autoCollapse` effect acts
  only on transitions, so such an expand would have stuck until the notebook
  was closed and reopened.
- Hide the "Open Style panel" menu item when the Style panel is hidden
  (Settings → "Show Style panel"). The panel is not mounted then, so the
  request was dropped rather than queued and the item did nothing.
@giswqs
giswqs enabled auto-merge (squash) August 8, 2026 13:23
@giswqs
giswqs merged commit 7642906 into main Aug 8, 2026
32 checks passed
@giswqs
giswqs deleted the feat/explicit-style-panel-open branch August 8, 2026 13:25
onOpenStylePanel();
}}
>
<Palette className="me-2 h-3.5 w-3.5" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor icon-consistency nit: Palette is already used a few lines below (and in this same layer's menu) for "Open Style Manager" (line ~3757). Elsewhere in the app the Style panel itself is always represented by SlidersHorizontal (the shared-rail tab in DesktopShell.tsx, and the collapsed-rail icon in StylePanel.tsx). Reusing Palette here makes two different actions in the same context menu look identical, and misses the icon users already associate with the Style panel.

Suggested change
<Palette className="me-2 h-3.5 w-3.5" />
<SlidersHorizontal className="me-2 h-3.5 w-3.5" />

(SlidersHorizontal would need to be added to the lucide-react import list in this file.)

Confidence: medium — this is a UX/consistency nit, not a functional bug.

Comment on lines +1019 to +1031
// An explicit request (Layers → "Open Style panel") expands the panel from its
// rail. Skipped while `autoCollapse` holds it closed (the notebook or a
// story-map presentation owns the workspace), so a request made there cannot
// pop Style back open over them: the `autoCollapse` effect below acts only on
// transitions, so an expand that slipped through would stick until the
// notebook was closed and reopened. The request is still consumed so it does
// not fire later.
const previousOpenRequest = useRef(openRequest);
useEffect(() => {
const previous = previousSelectedLayerId.current;
previousSelectedLayerId.current = selectedLayerId;
if (
!autoCollapse &&
selectedLayerId &&
selectedLayerId !== previous &&
layers.some((candidate) => candidate.id === selectedLayerId)
) {
setIsCollapsed(false);
}
}, [autoCollapse, layers, selectedLayerId, setIsCollapsed]);
if (openRequest === previousOpenRequest.current) return;
previousOpenRequest.current = openRequest;
if (!autoCollapse) setIsCollapsed(false);
}, [autoCollapse, openRequest, setIsCollapsed]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The "Open Style panel" menu item in LayerPanel is only hidden/disabled based on layoutOptions.stylePanelVisible — it stays enabled while autoCollapse is true for another reason (notebook open, story-map presenting, panelsCollapsed, etc., depending on the render mode). In that state this effect still consumes the request (previousOpenRequest.current = openRequest) but skips the setIsCollapsed(false), so clicking the menu item does nothing visible and gives no feedback that the request was dropped.

This mirrors the previous auto-expand-on-select behavior, so it may be an accepted tradeoff, but now that opening the panel is an explicit user action (vs. an incidental side effect of selecting a layer), a silent no-op is more likely to read as a bug to users. Worth considering whether the menu item should be disabled/hidden while autoCollapse would swallow the request, or whether the effect should defer the expand until autoCollapse clears instead of dropping it.

Confidence: low-medium — plausible UX gap rather than a clear defect, since the surrounding comments suggest this drop is intentional.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Code review

Bugs: None found. The refactor from selection-based auto-expand to an explicit openRequest counter is sound — the effect correctly consumes the request even when autoCollapse blocks the expand (so it doesn't fire later), both StylePanel mount points receive the same openRequest prop, onOpenStylePanel is correctly gated to undefined in every place the panel could be unmounted (standalone and the SharedSidebar renderBuiltin path only calls its render prop when builtinVisible is true), and the new menu item only appears on real per-layer rows, not layer groups or the special Background row.

Security: None found. No new user input handling, injection surface, or secrets involved.

Performance: None found. The change replaces a layers.some(...) scan on every selection with a plain counter comparison — a slight improvement, not a regression.

Quality:

  • Low-medium confidence: the "Open Style panel" menu item stays clickable while autoCollapse is holding the panel closed for an unrelated reason (notebook open, story-map presenting, etc.), so clicking it silently does nothing with no user feedback — plausible UX gap now that opening is an explicit action rather than an incidental side effect. (StylePanel.tsx)
  • Medium confidence: the new menu item reuses the Palette icon, which is already used a few lines below in the same context menu for the unrelated "Open Style Manager" action; the app consistently uses SlidersHorizontal to represent the Style panel elsewhere (shared rail, collapsed rail tab). Using Palette here makes two different actions look identical. (LayerPanel.tsx)

CLAUDE.md: No violations found — the new string uses t() and only en.json was updated (per the i18n catalog test, non-English locales are allowed to be partial and fall back to English), and the tutorial doc was updated to match the new behavior.

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.

2 participants