Skip to content

[Enhancement] UX: Display polygon coordinates in modal #157

Open
manishpatel00 wants to merge 2 commits intomeshery-extensions:masterfrom
manishpatel00:feat/coordinates-modal
Open

[Enhancement] UX: Display polygon coordinates in modal #157
manishpatel00 wants to merge 2 commits intomeshery-extensions:masterfrom
manishpatel00:feat/coordinates-modal

Conversation

@manishpatel00
Copy link
Copy Markdown
Contributor

Description

PR fixes #148

When a user finishes designing a polygon, the coordinates are now displayed in a modal overlay on top of the canvas — making them immediately visible instead of being hidden below the fold.

Changes

  • New file site/src/components/ShapeBuilder/CoordinatesModal.js
    Self-contained modal component with copy button, close button, and
    two actions — "Done" and "Clear & Start Over"

  • Updated site/src/components/ShapeBuilder/index.js
    Added modalOpen state and wired modal to all shape-completion
    triggers (Close Shape button, double-click, Enter/Esc keys).
    Added "View Coordinates" button to re-open modal after dismissal.

  • Updated site/src/pages/index.js
    Passes theme prop to <ShapeBuilder /> for dark/light mode support

How It Works

  1. User draws a polygon and closes it (any method)
  2. Modal automatically opens showing normalized SVG coordinates
  3. Inline Copy button copies coordinates with visual confirmation
  4. Done dismisses the modal — shape stays on canvas
  5. Clear & Start Over resets the canvas entirely
  6. Clicking the dark overlay also closes the modal
  7. View Coordinates button lets user re-open the modal anytime

Before

light mode

Screen.Recording.2026-04-11.at.7.25.09.PM.mov

After

dark mode

Screen.Recording.2026-04-11.at.7.34.46.PM.mov

Signed commits

  • Yes, I signed my commits.

When a user finishes designing a polygon (via Close Shape, double-click,
Enter, or Esc), the normalized SVG coordinates are now displayed in a
focused modal overlay on the canvas instead of being shown in the textbox
below where they can easily be missed.

Modal features:
- Inline copy button with 'Copied' feedback
- 'Done' action to dismiss and keep shape
- 'Clear & Start Over' action to reset canvas
- Overlay click-to-close for quick dismissal
- 'View Coordinates' button to re-open modal after close
- Full keyboard and screen-reader accessibility
- Dark/light theme support

The fallback textarea is retained for accessibility and non-JS contexts.

Fixes meshery-extensions#148

Signed-off-by: MANISH KUMAR <146671113+manishpatel00@users.noreply.github.com>
The 'View Coordinates' button text was invisible in dark mode because
MUI's outlined variant inherits text color from the background theme.

Fixed by explicitly setting:
- color: "#00B39F" (Meshery brand color)
- borderColor: "#00B39F"
- Hover state with subtle background tint

Button now clearly visible in both light and dark themes.

Signed-off-by: MANISH KUMAR <146671113+manishpatel00@users.noreply.github.com>
@manishpatel00 manishpatel00 changed the title Feat/coordinates modal [Enhancement] UX: Display polygon coordinates in modal (#148) Apr 11, 2026
@manishpatel00 manishpatel00 changed the title [Enhancement] UX: Display polygon coordinates in modal (#148) [Enhancement] UX: Display polygon coordinates in modal Apr 11, 2026
@github-actions
Copy link
Copy Markdown

🚀 Preview deployment for PR #157

🌐 Preview URL: https://meshery-extensions.github.io/shape-builder/pr-preview/pr-157/

This preview is updated automatically when commits are pushed to this PR.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] UX: Display polygon coordinates in a modal

1 participant