Skip to content

feat: enable split map view with unlock viewport and sync zoom - #701

Merged
lixun910 merged 1 commit into
mainfrom
xli-enable-split-map-view
Jun 10, 2026
Merged

lixun910 merged 1 commit into
mainfrom
xli-enable-split-map-view

Conversation

@lixun910

@lixun910 lixun910 commented Jun 9, 2026 •

Copy link
Copy Markdown
Collaborator
  • enable split map view
  • show 'unlock viewport' and 'sync zoom' option in legend component

Summary by CodeRabbit

Release Notes

  • Bug Fixes / Improvements
    • Refined legend panel toggle behavior for improved user interaction
    • Enhanced legend display in split-map mode - secondary map now shows only the toggle control
    • Improved legend panel styling and header visibility handling

@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR initializes the Kepler UI state's activeSidePanel field to null and refactors CustomMapLegendPanel to derive legend visibility from centralized props rather than local state, with updated split-map rendering that shows only the toggle button on secondary panes.

Changes

Legend Panel State Management and Rendering

Layer / File(s) Summary
Default Kepler UI state initialization
packages/kepler/src/KeplerSlice.ts
Kepler UI state construction adds uiState.activeSidePanel: null as a default field.
Legend panel state derivation and split-map rendering
packages/kepler/src/components/CustomMapLegendPanel.tsx
Component imports are updated to remove useState, and SplitPaneLegend refactors to derive isActive from props.mapControls.mapLegend.active instead of local state. Toggle callback is updated to invoke onToggleMapControl('mapLegend'). Split-map configurations now render only the toggle button on secondary panes and the full OriginalMapLegendPanel on the primary pane. Inline CSS selectors for hiding the draggable legend header are tightened.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • sqlrooms/sqlrooms#563: Updates split-map legend panel rendering and panel behavior using similar mapIndex-based logic and split-viewport-aware rendering.

Suggested reviewers

  • ilyabo

Poem

🐰 A legend once held its own state,
But now it's derived—how first-rate!
Split maps show toggle alone,
While the primary keeps all its own,
State flows down, and headers abate! 📜✨

🚥 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 describes enabling split map view with unlock viewport and sync zoom features, which aligns with the PR objectives and the file changes updating legend panel behavior for split-map configurations.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 xli-enable-split-map-view

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 and usage tips.

@lixun910
lixun910 requested a review from ilyabo June 9, 2026 06:08

@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.

🧹 Nitpick comments (2)
packages/kepler/src/components/CustomMapLegendPanel.tsx (2)

14-88: 💤 Low value

Consider adding JSDoc documentation.

As per coding guidelines, public exports in packages/ should be documented. Consider adding JSDoc to describe the component's purpose, props, and split-view behavior.

📝 Suggested documentation
+/**
+ * Custom map legend panel factory that handles split-map rendering.
+ * In split-map mode, the secondary pane (mapIndex !== 0) displays only a toggle button,
+ * while the primary pane renders the full draggable legend panel.
+ * 
+ * `@param` MapControlTooltip - Tooltip component factory
+ * `@param` MapControlPanel - Control panel component factory  
+ * `@param` MapLegend - Legend component factory
+ * `@returns` Customized MapLegendPanel component
+ */
 export function CustomMapLegendPanelFactory(
   MapControlTooltip: ReturnType<typeof MapControlTooltipFactory>,
   MapControlPanel: ReturnType<typeof MapControlPanelFactory>,
   MapLegend: ReturnType<typeof MapLegendFactory>,
 ): ReturnType<typeof MapLegendPanelFactory> {
🤖 Prompt for 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.

In `@packages/kepler/src/components/CustomMapLegendPanel.tsx` around lines 14 -
88, Add JSDoc for the exported factory and resulting component: document
CustomMapLegendPanelFactory (describe it returns a customized MapLegendPanel
component), explain the props shape (MapLegendPanelProps & {mapIndex?: number;
isSplit?: boolean}), and note split-view behavior handled by SplitPaneLegend vs
primary pane rendering (including that it hides header via injected style and
delegates rendering to OriginalMapLegendPanel). Place JSDoc above the
CustomMapLegendPanelFactory declaration and also add a brief `@returns` and
`@example` or `@remarks` describing when SplitPaneLegend is used and what
mapIndex/isSplit/control props control.

Source: Coding guidelines


65-65: ⚡ Quick win

Extract duplicate inline style injection.

The same CSS rule is injected in both split and non-split rendering paths. This creates duplicate <style> elements in the DOM and violates DRY.

♻️ Proposed fix to extract the common style
+const LEGEND_HEADER_STYLE = `
+  .draggable-legend .map-control__panel-header:not(.map-control__panel-split-viewport-tools) { 
+    display: none !important; 
+  }
+`;
+
 const SplitPaneLegend = (
   props: MapLegendPanelProps & {mapIndex?: number; isSplit?: boolean},
 ) => {
   // ...
   return (
     <>
-      <style>{`.draggable-legend .map-control__panel-header:not(.map-control__panel-split-viewport-tools) { display: none !important; }`}</style>
+      <style>{LEGEND_HEADER_STYLE}</style>
       <OriginalMapLegendPanel {...props} />
     </>
   );
 };

 const CustomMapLegendPanel = (
   props: MapLegendPanelProps & {mapIndex?: number; isSplit?: boolean},
 ) => {
   if (props.isSplit) {
     return <SplitPaneLegend {...props} />;
   }

   return (
     <>
-      <style>{`.draggable-legend .map-control__panel-header:not(.map-control__panel-split-viewport-tools) { display: none !important; }`}</style>
+      <style>{LEGEND_HEADER_STYLE}</style>
       <OriginalMapLegendPanel {...props} />
     </>
   );
 };

Also applies to: 80-80

🤖 Prompt for 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.

In `@packages/kepler/src/components/CustomMapLegendPanel.tsx` at line 65,
Duplicate inline <style> injection for the rule `.draggable-legend
.map-control__panel-header:not(.map-control__panel-split-viewport-tools) {
display: none !important; }` is being added in both the split and non-split
render paths of CustomMapLegendPanel; extract that rule into a single shared
location (e.g., a top-level constant string or a single <style> rendered once at
the component root or move into the component stylesheet) and remove the
duplicate <style> injections from the two rendering branches so the rule is
injected only once.
🤖 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.

Nitpick comments:
In `@packages/kepler/src/components/CustomMapLegendPanel.tsx`:
- Around line 14-88: Add JSDoc for the exported factory and resulting component:
document CustomMapLegendPanelFactory (describe it returns a customized
MapLegendPanel component), explain the props shape (MapLegendPanelProps &
{mapIndex?: number; isSplit?: boolean}), and note split-view behavior handled by
SplitPaneLegend vs primary pane rendering (including that it hides header via
injected style and delegates rendering to OriginalMapLegendPanel). Place JSDoc
above the CustomMapLegendPanelFactory declaration and also add a brief `@returns`
and `@example` or `@remarks` describing when SplitPaneLegend is used and what
mapIndex/isSplit/control props control.
- Line 65: Duplicate inline <style> injection for the rule `.draggable-legend
.map-control__panel-header:not(.map-control__panel-split-viewport-tools) {
display: none !important; }` is being added in both the split and non-split
render paths of CustomMapLegendPanel; extract that rule into a single shared
location (e.g., a top-level constant string or a single <style> rendered once at
the component root or move into the component stylesheet) and remove the
duplicate <style> injections from the two rendering branches so the rule is
injected only once.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cfe4525c-5403-44b1-b1eb-b79e792a4bba

📥 Commits

Reviewing files that changed from the base of the PR and between f52b642 and 15fea9b.

📒 Files selected for processing (2)
  • packages/kepler/src/KeplerSlice.ts
  • packages/kepler/src/components/CustomMapLegendPanel.tsx

@ilyabo

ilyabo commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@lixun910
lixun910 merged commit 6ee09ac into main Jun 10, 2026
4 checks passed
@lixun910
lixun910 deleted the xli-enable-split-map-view branch June 10, 2026 05:23
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