Skip to content

Conversation

mohyware
Copy link
Collaborator

This is a draft PR as I am still working on it.
This implements the ability to prefill the Molecule component from a URL, as @erwanp suggested, so researchers can share a spectrum with others through a direct link.
I will also add a Share button that generates a URL with the current filled data to make sharing easier.

2025-03-13.11-59-21.mp4

Resolves: #203

Copy link

vercel bot commented Mar 13, 2025

@mohyware is attempting to deploy a commit to the Main Team on Vercel.

A member of the Team first needs to authorize it.

@erwanp
Copy link
Collaborator

erwanp commented Mar 14, 2025

This is excellent. How is the URL prefilled? I assume you wrote it manually.

What would be even more user friendly is that the URL updates automatically as you click on the buttons on the interface. Is that something possible?

@mohyware
Copy link
Collaborator Author

Yeah, I can do that. I was thinking of adding a share button that generates a link based on the currently filled components, so the URL remains clean if the user just wants to share the site without their data. But I can do this as you prefer.

@erwanp
Copy link
Collaborator

erwanp commented Mar 15, 2025

Both work; choose what you think is best

@mohyware mohyware force-pushed the feat/prefill-components branch from 30ee58d to a66c9d1 Compare March 16, 2025 01:47
@mohyware
Copy link
Collaborator Author

I have implemented the version with the button. However, the second approach can be achieved by commenting this line as shown in this video.
If any entered value is invalid or not present in the URL, it will default to the predefined value.

Untitled.mp4

@mohyware mohyware marked this pull request as ready for review March 16, 2025 04:42
@erwanp
Copy link
Collaborator

erwanp commented Mar 16, 2025

@minouHub @dcmvdbekerom any idea on whether

  1. the changes in the interface should immediatly be reflected in the URL
  2. or only when pressing the "Share" button ?
    (see @mohyware 's video above)

I'm in favor of the 1st one (URL parameters are visible): as a user it gives me confidence that the changes in the interface have indeed been reflected in the URL

@minouHub
Copy link
Collaborator

minouHub commented Mar 16, 2025

I think we should take what Youtube is doing.

Example

You want to share the highlights of yesterday's rugby match (France-Ecosse):
https://youtu.be/tB4JGQlZeb0?si=2rix3Fcu8SInBfax
You want to share only the try of Louis Bielle-Biarrey
https://youtu.be/tB4JGQlZeb0?si=2rix3Fcu8SInBfax&t=214

Long story short: 2. only when pressing the "Share" button

@erwanp
Copy link
Collaborator

erwanp commented Mar 16, 2025

In Airtable; another well-supported app used by millions of users; whenever you adjust Filters/Groups in an interface; the URL changes, and it makes it extremelly easy to share the current page with the current setting by simply copy-pasting the URL (no need to even have a Share button). I personnally this workflow a lot.

@mohyware
Copy link
Collaborator Author

Removed the button, keeping only the first approach. This PR is now ready for review.

Copy link
Collaborator

@erwanp erwanp left a comment

Choose a reason for hiding this comment

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

approved for me !

@manbhav234
Copy link
Contributor

@mohyware @erwanp
Even though the solution provided by @mohyware works, it is not the cleanest solution. It will be very difficult to maintain it with a lot of manual updates if the form grows in the future. Also, if we add more forms inside the app in the future, we will have to manually write the url sync code for that form as well.
I have worked out a much simpler, cleaner and easy to maintain solution to implement this feature. I am linking to a PR that would showcase the changes made - #736

@mohyware mohyware added 🚀 enhancement New feature or request 🏡 frontend frontend related stuff labels May 21, 2025
@arunavabasucom arunavabasucom added the 👍 P2 second level priority label May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement New feature or request 🏡 frontend frontend related stuff 👍 P2 second level priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefill components from url ?
5 participants