Skip to content

feat: Add 'copy link' button and remove all params from url bar - #1560

Closed
arielvino wants to merge 6 commits into
mainfrom
Add-'copy-link'-button-and-remove-all-params-from-URL-bar
Closed

feat: Add 'copy link' button and remove all params from url bar#1560
arielvino wants to merge 6 commits into
mainfrom
Add-'copy-link'-button-and-remove-all-params-from-URL-bar

Conversation

@arielvino

Copy link
Copy Markdown
Collaborator

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

image image image

arielvino added 2 commits May 15, 2026 16:47
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)
@arielvino
arielvino requested a review from AvivAbachi as a code owner May 15, 2026 14:25
@arielvino arielvino linked an issue May 15, 2026 that may be closed by this pull request
Comment thread src/layout/header/shareUrl.test.ts Fixed
@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

@arielvino arielvino changed the title Add 'copy link' button and remove all params from url bar feat: Add 'copy link' button and remove all params from url bar May 15, 2026
…ring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@arielvino

Copy link
Copy Markdown
Collaborator Author

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:

"https://s3.amazonaws.com"

@arielvino

Copy link
Copy Markdown
Collaborator Author

@AvivAbachi
Does applitools have per-branch baseline?
My changes here conflicting with #1565 because both change the page screenshot (my changes added a button to header, while yours changed the main menu order).
So do I need to wait till #1565 is merged?

@AvivAbachi

Copy link
Copy Markdown
Collaborator

is need to be a pre-branch, you can work on it.

@arielvino arielvino linked an issue May 17, 2026 that may be closed by this pull request
@NoamGaash

Copy link
Copy Markdown
Member

it has per-branch baseline, and I'm not sure why but your changes are reported as changes to the HEAD branch (instead of the branch name), so something is off.
image

@claude do we have an hard coded setting for APPLITOOLS_BRANCH_NAME or something? Maybe we should make an issue or PR for it. Seems like pr #1528 got compared against the changes that were approved in this pull request

@claude

claude Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Claude Code is working…

I'll analyze this and get back to you.

View job run

1 similar comment
@claude

claude Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Claude Code is working…

I'll analyze this and get back to you.

View job run

@arielvino arielvino closed this May 19, 2026
@arielvino
arielvino deleted the Add-'copy-link'-button-and-remove-all-params-from-URL-bar branch May 19, 2026 13:24
@arielvino

Copy link
Copy Markdown
Collaborator Author

@NoamGaash
Claude failed with invalid branch name (because it includes ' apparently).
That may be the reason for the applitools issue too.

I renamed the branch and it automatically closed the PR.
I opened another one, and will see what happen.

@NoamGaash

NoamGaash commented May 19, 2026

Copy link
Copy Markdown
Member

Interesting!
I'll open a support ticket for the Applitools bug. It's nice to see bigger companies (Anthropic) has similar bugs

@arielvino

Copy link
Copy Markdown
Collaborator Author

@NoamGaash
It was only my guess about applitools. ..
The real applitools issue found and is unrelated.

Only claude has this bug.

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.

4 participants