Skip to content

feat: added share button - #150

Merged
raven-wing merged 4 commits into
Problematy:mainfrom
raven-wing:share_button
Feb 5, 2026
Merged

raven-wing merged 4 commits into
Problematy:mainfrom
raven-wing:share_button

Conversation

@raven-wing

@raven-wing raven-wing commented Feb 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added a share button in location details to share or copy a location link with confirmation notifications.
  • Internationalization

    • Added English, Polish, and Ukrainian translations for share label and copy success/failure messages.
  • UI

    • Updated location details layout to place the share action alongside existing controls.
  • Tests

    • Added tests validating the share/copy flow and success notifications.

@coderabbitai

coderabbitai Bot commented Feb 5, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@raven-wing has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Adds a ShareLocationButton to the marker popup that builds a share URL from place.metadata.uuid, tries navigator.share with clipboard fallback, shows toast notifications, updates LocationDetailsBox layout to include share + report actions, adds i18n keys (en/pl/ua), and adds tests for share behavior.

Changes

Cohort / File(s) Summary
Share Location UI & logic
src/components/MarkerPopup/LocationDetails.jsx
Adds ShareLocationButton; constructs share URL from place.metadata.uuid; attempts navigator.share, falls back to navigator.clipboard.writeText; shows toast.success / toast.error; updates LocationDetailsBox layout to render share + report actions and adds propTypes.
Localization
src/locales/en/map.json, src/locales/pl/map.json, src/locales/ua/map.json
Adds keys shareLocation, linkCopied, linkCopyFailed to English, Polish, and Ukrainian locales; minor JSON reformatting to allow new entries.
Tests
tests/MarkerPopup/LocationDetailsBox.test.jsx
Adds tests for the share button: verifies rendered share control, mocks navigator.clipboard.writeText, asserts copied URL contains locationId/UUID and that toast.success is called; uses async utilities (fireEvent, waitFor).

Sequence Diagram(s)

sequenceDiagram
  participant User as "User"
  participant UI as "LocationDetailsBox\n(ShareLocationButton)"
  participant WebAPI as "Navigator\n(Web Share API)"
  participant Clipboard as "Navigator.clipboard"
  participant Toast as "Toast"

  rect rgba(200,230,255,0.5)
  User->>UI: Click "Share"
  UI->>WebAPI: attempt navigator.share({ url })
  alt Web Share succeeds
    WebAPI-->>UI: resolved
    UI->>Toast: toast.success("shared")
  else Web Share unavailable or fails
    WebAPI--xUI: error / unsupported
    UI->>Clipboard: navigator.clipboard.writeText(url)
    alt Clipboard succeeds
      Clipboard-->>UI: resolved
      UI->>Toast: toast.success("link copied")
    else Clipboard fails
      Clipboard--xUI: error
      UI->>Toast: toast.error("copy failed")
    end
  end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I found a link and gave it a click,
If Web Share listens, sharing's quick.
If not, I copy to the board with flair,
A toast sings out: "Link copied!" — joy in the air.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: added share button' directly matches the main changes in the PR, which adds a ShareLocationButton component with share/copy functionality across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/components/MarkerPopup/LocationDetails.jsx`:
- Around line 224-239: In handleShare, guard and handle failures from the
Clipboard API: before calling navigator.clipboard.writeText check
navigator.clipboard exists, wrap each writeText call in try/catch and on failure
call toast.error(t('linkCopyFailed')) (and optionally log the error), while
preserving the existing toast.success(t('linkCopied')) on success; update all
locale files (add 'linkCopyFailed' key to en, ua, pl) so translations exist.
Ensure references are to handleShare, navigator.share,
navigator.clipboard.writeText, place.metadata.uuid, toast, and t.

Comment thread src/components/MarkerPopup/LocationDetails.jsx
@sonarqubecloud

sonarqubecloud Bot commented Feb 5, 2026

Copy link
Copy Markdown

@raven-wing
raven-wing merged commit dd111a7 into Problematy:main Feb 5, 2026
5 checks passed
@raven-wing
raven-wing deleted the share_button branch February 5, 2026 10:39
problematy-releaser Bot pushed a commit that referenced this pull request Feb 5, 2026
# [1.5.0](1.4.0...1.5.0) (2026-02-05)

### Features

* added share button ([#150](#150)) ([dd111a7](dd111a7))
@problematy-releaser

Copy link
Copy Markdown

🎉 This PR is included in version 1.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

1 participant