Skip to content

feat: add close button to the draw panel - #515

Merged
bdjulbic merged 3 commits into
mainfrom
fix/draw-map-panel-close-button
Apr 6, 2026
Merged

bdjulbic merged 3 commits into
mainfrom
fix/draw-map-panel-close-button

Conversation

@bdjulbic

@bdjulbic bdjulbic commented Apr 3, 2026 •

Copy link
Copy Markdown
Collaborator

Add close button to the draw panel
Screenshot 2026-04-03 at 14 34 15

Summary by CodeRabbit

  • New Features
    • Added a close (X) overlay button to the map draw panel for easier dismissal when active.
    • Map drawing controls can now be hidden or shown reliably based on control state.
    • The app now uses a customized map draw panel so these behaviors are applied consistently.

@coderabbitai

coderabbitai Bot commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a memoized CustomMapDrawPanel factory that wraps the existing MapDrawPanel, conditionally hides it based on mapControls.mapDraw.show, overlays a close button when active to toggle the draw control, and registers the custom factory in KeplerInjector to replace the default.

Changes

Cohort / File(s) Summary
Custom MapDrawPanel Factory
packages/kepler/src/components/CustomMapDrawPanel.tsx
New CustomMapDrawPanelFactory that calls MapDrawPanelFactory, returns a memoized React.FC<MapDrawPanelProps>, returns null when mapControls.mapDraw.show is false, renders the original panel inside a positioned container, and overlays a ghost close Button when mapDraw.active to call props.onToggleMapControl('mapDraw'). Copies MapDrawPanelFactory.deps and sets displayName.
Dependency Injection Registration
packages/kepler/src/components/KeplerInjector.tsx
Imports MapDrawPanelFactory and local CustomMapDrawPanelFactory and appends the replacement recipe [MapDrawPanelFactory, CustomMapDrawPanelFactory] to defaultRecipes so the injector registers the custom factory.

Sequence Diagram(s)

sequenceDiagram
  participant Injector as KeplerInjector
  participant Factory as CustomMapDrawPanelFactory
  participant Panel as MapDrawPanel (wrapped)
  participant AppState as MapControls State
  participant User as User

  Injector->>Factory: register replacement (MapDrawPanelFactory → CustomMapDrawPanelFactory)
  Factory->>Panel: instantiate wrapped component with props
  Panel->>AppState: read `mapControls.mapDraw.show` and `mapControls.mapDraw.active`
  alt draw control hidden
    Panel-->>User: render nothing (null)
  else draw control visible
    Panel-->>User: render MapDrawPanel UI
    alt draw active
      User->>Panel: click Close button
      Panel->>Panel: preventDefault & stopPropagation
      Panel->>AppState: call `onToggleMapControl('mapDraw')`
      AppState-->>Panel: updated `mapControls` triggers re-render
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ilyabo
  • lixun910

Poem

🐰 I wrap the draw with nimble paws,
An X appears to halt the cause,
Factories swapped with gentle hop,
Injector hums — the changes drop,
Hoppity code, the map applause!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add close button to the draw panel' accurately reflects the main change: adding a close button to the draw panel via a custom wrapper component.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 fix/draw-map-panel-close-button

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.

@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 the current code and only fix it if needed.

Inline comments:
In `@packages/kepler/src/components/CustomMapDrawPanel.tsx`:
- Around line 44-56: The close Button is icon-only and lacks an accessible name;
update the Button element in CustomMapDrawPanel (the Button wrapping XIcon) to
include an explicit accessible name such as aria-label="Close" (or a localized
string) and mark the decorative XIcon as aria-hidden="true" so screen readers
announce the button purpose; keep the existing onClick handler
(onToggleMenuPanel) intact.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 46b5a87a-a05e-4065-8c91-f0dbde702f26

📥 Commits

Reviewing files that changed from the base of the PR and between 0e74352 and 35436f4.

📒 Files selected for processing (2)
  • packages/kepler/src/components/CustomMapDrawPanel.tsx
  • packages/kepler/src/components/KeplerInjector.tsx

Comment thread packages/kepler/src/components/CustomMapDrawPanel.tsx

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.

Pull request overview

Adds a custom override of Kepler’s map draw panel to include a close affordance, integrated via the existing Kepler injector recipe system.

Changes:

  • Register a MapDrawPanelFactory override in the Kepler injector.
  • Introduce CustomMapDrawPanelFactory that wraps the upstream draw panel and conditionally renders a close (X) button.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/kepler/src/components/KeplerInjector.tsx Wires MapDrawPanelFactory to a custom replacement factory in defaultRecipes.
packages/kepler/src/components/CustomMapDrawPanel.tsx Wraps the upstream draw panel and adds a close button when the draw control is active.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/kepler/src/components/CustomMapDrawPanel.tsx
Comment thread packages/kepler/src/components/CustomMapDrawPanel.tsx Outdated
@bdjulbic
bdjulbic merged commit 8e5a15a into main Apr 6, 2026
5 checks passed
@bdjulbic
bdjulbic deleted the fix/draw-map-panel-close-button branch April 6, 2026 11:31
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.

3 participants