annavik / websustainability

https://websustainability.io
3 stars 0 forks source link

Filter settings as search params #12

Closed annavik closed 10 months ago

annavik commented 11 months ago

Making filter settings part of URL search params. This will make the filtering stay if page is reloaded. Also it will make it possible to share links with pre defined filtering.

Fixes https://github.com/annavik/websustainability/issues/10

Example:

Screenshot 2023-12-09 at 12 03 26
netlify[bot] commented 11 months ago

Deploy Preview for ws4u ready!

Name Link
Latest commit 7b24d5b7f273b61f50b35716750246c9ac883dc0
Latest deploy log https://app.netlify.com/sites/ws4u/deploys/65747f70235bd60008e89ab1
Deploy Preview https://deploy-preview-12--ws4u.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

c0ldbear commented 11 months ago

I did a small test where I added more of every option of the filters and got this URL: http://localhost:5173/?category=3&category=4&effort=1&effort=2&impact=3&impact=2&tag=content&tag=ideation&tag=kpis&tag=performance&tag=reporting and it looks like this: image Maybe we could group it somehow instead? Like, if I have multiple options for impact, we could maybe group it like impact={2,3} ? What do you think?

annavik commented 11 months ago

I did a small test where I added more of every option of the filters and got this URL: http://localhost:5173/?category=3&category=4&effort=1&effort=2&impact=3&impact=2&tag=content&tag=ideation&tag=kpis&tag=performance&tag=reporting and it looks like this: image Maybe we could group it somehow instead? Like, if I have multiple options for impact, we could maybe group it like impact={2,3} ? What do you think?

Yes good point, would be nice to keep URL:s more compact and readable! :)

It is not the standard way for browser search params (link), but added some special handling for us so we can also use comma separated lists of values.

c0ldbear commented 11 months ago

Ah, I didn't know that - cool! :) If it already was in the standard way, maybe we should keep it as that then? I do like the comma better but maybe it is better to do the standard way? What do you think?

annavik commented 10 months ago

Ah, I didn't know that - cool! :) If it already was in the standard way, maybe we should keep it as that then? I do like the comma better but maybe it is better to do the standard way? What do you think?

Yes I also like the more compact way, I think it was a nice idea! Let's keep it (but we also support the standard way) :)