Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): Automatically open download modal when filter queries are present (on the main mod page) #3133

Merged

Conversation

Awakened-Redstone
Copy link
Contributor

Adds an option to open the download modal with a preselected version and loader.

This is a QoL, while https://modrinth.com/[type]/[id]/version/latest?version=<game_version>&loader=<loader> exists, the download modal has a much more intuitive and friendlier UI, showing the latest release, beta and alpha separate and offering a link to the Modrinth App

The link format is similar to the existing alternative
https://modrinth.com/[type]/[id]?version=<game_version>&loader=<loader>

  • version is the game version
  • loader is the platform
    Both are optional, with at least one being required to open the modal on page load
    If version or loader are not a valid option for the project the modal will not open

@Awakened-Redstone
Copy link
Contributor Author

This is marked as draft as I think this may need discussion/feedback from the Modrinth team and possibly changes to the queries used

@Awakened-Redstone Awakened-Redstone changed the title feat: Automatically open download modal when filter queries are present (on the main mod page) feat(frontend): Automatically open download modal when filter queries are present (on the main mod page) Jan 9, 2025
@Geometrically
Copy link
Member

LGTM @Prospector

@Awakened-Redstone
Copy link
Contributor Author

Awakened-Redstone commented Jan 9, 2025

I was a bit unsure on how the query could be done to provide the data the modal
My first try was taking a json, but the separate queries feels better, and is consistent with the ones for [type]/[id]/version/latest

I'll set it as ready for review now

@Awakened-Redstone Awakened-Redstone marked this pull request as ready for review January 9, 2025 14:56
Copy link
Member

@Prospector Prospector left a comment

Choose a reason for hiding this comment

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

I think this is good, but I feel like some part of the URL should be clearer that it's opening the download modal? Maybe require a #download URL fragment which, on its own, opens the download modal but then can be filtered with the query params?

@Awakened-Redstone
Copy link
Contributor Author

Awakened-Redstone commented Jan 9, 2025

The other option I had considered was passing a JSON, like ?download={"version":"1.21.4","loader":"fabric"}, but that is less friendly and uncommon to pass as a query

I also wanted to mention I did make it so you can't open the modal without preselected values on purpose, as I don't see a reason to open automatically the modal without a preset version or loader.
For me, if you aren't using it to more quickly let the user download a version, like a selected one from your docs, than I think you should send to the main mod page, where they can see about the mod and click the download button.

This is my opinion, but if the Modrinth team and/or community think that an option to just open the modal should be part of this feature I will do it.

@Prospector
Copy link
Member

true, but someone could have all the information on their own website or something so the Modrinth page might be redundant. I think the main thing would be it should just say download somewhere in the URL to indicate it's for opening the download UI

@Awakened-Redstone
Copy link
Contributor Author

true, but someone could have all the information on their own website or something so the Modrinth page might be redundant. I think the main thing would be it should just say download somewhere in the URL to indicate it's for opening the download UI

You have a point, I have update the code.

I made the query filters independent of the modal now as it allows them to be used for more than just the download modal in the future, and allows for presetting the values without opening the modal, allowing someone to read the mod page.

@Prospector
Copy link
Member

nice, yeah that's a good idea! One more idea I had was maybe it should fill the URL automatically as you use the page? Like if you open the download modal it adds the hash and if you start selecting version/loader it gets added to the parameters? If you wanna do that it'd be cool but otherwise I think it's fine to merge as-is

@Prospector Prospector merged commit 316fe72 into modrinth:main Jan 10, 2025
1 check failed
@Awakened-Redstone
Copy link
Contributor Author

oh, I should have posted a comment that I was working on it >.<

@Awakened-Redstone
Copy link
Contributor Author

not the end of the world, can always make it another PR

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

Successfully merging this pull request may close these issues.

3 participants