feat: Add 'copy link' button and remove all params from url bar - #1560
feat: Add 'copy link' button and remove all params from url bar#1560arielvino wants to merge 6 commits into
Conversation
Replaces the automatic URL↔state sync with an explicit Share button in
the header that builds a shareable link on demand and copies it to the
clipboard. The URL is never polluted with params during normal navigation.
- Remove the useEffect that continuously wrote SearchContext state back
into the address bar (the main source of the "mostly broken" URL sync)
- Add ShareButton (extracted to its own file) with a link icon, tooltip
showing the URL to be copied, and a ✓ confirmation on click
- Build page-aware URLs: each route declares only the params it actually
uses (e.g. /gaps gets timestamp+operator+line+route, /map gets only
its datetime, homepage gets nothing)
- Capture URL params synchronously via useMemo before stripping them,
exposed through InitialUrlParamsContext so lazy-loaded pages can read
them reliably even after the address bar has been cleaned up
- Apply incoming URL params on top of existing session storage so shared
links always restore the correct state regardless of prior session
- Fix /gaps_patterns not restoring startDate/endDate and operatorId from
shared links
- Fix /map not restoring its timestamp from shared links
- Fix /operator clearing lineNumber/routeKey on mount (removed the
setSearch reset that wiped cross-page state)
- Add share_link translation key (he/en/ar/ru)
…ring sanitization' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
The feature doesn't work on the preview server - as the base URL is: "https://s3.amazonaws.com/noam-gaash.co.il/25923276675/open-bus/1904" but the generated share link became: |
|
@AvivAbachi |
|
is need to be a pre-branch, you can work on it. |
|
it has per-branch baseline, and I'm not sure why but your changes are reported as changes to the @claude do we have an hard coded setting for |
|
I'll analyze this and get back to you. |
1 similar comment
|
I'll analyze this and get back to you. |
|
@NoamGaash I renamed the branch and it automatically closed the PR. |
|
Interesting! |
|
@NoamGaash Only claude has this bug. |


Description
Added a button that copy the url to the current page with all ui-state params to clipboard.
It use SearchState params when exists - and manually add params that not tracked in the shared state when needed.
The generated url does NOT contain the language code - which means the page will be loaded on the recipient's machine in the language that was defined there.
(For new users - the PR #1558 once approved will make the site auto detect local language)
The URL bar now show cleanly without any params on any page.
The gaps page still link with params to the singleLineMap - but those params are strriped from the URL after being proccessed.
Translation to all 4 languages was added (though the Russian and Arabic are here are AI generated, a speaker should verify those).
screenshots