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: add explore page Category and Network filters #882

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Sekhmet
Copy link
Member

@Sekhmet Sekhmet commented Oct 16, 2024

Summary

This PR adds ability to filter by Network and Category on explore page.

Closes: https://github.com/snapshot-labs/workflow/issues/213

@bonustrack original issue calls for multi-selection on category, but API only supports single category filter, do we want to implement it with multi-selection (would also require changes on the API).

How to test

  1. Go to http://localhost:8080/#/explore
  2. Try different filters.

Screenshots

image

@bonustrack
Copy link
Member

@Sekhmet No, we don't need to support multiple category selection.

@bonustrack
Copy link
Member

Looks good, is it possible to sort network by name and have the possibility to search within the dropdown? Currently it's hard to find a specific network. Also if we have the counter of space for each networks I would remove network with 0 spaces.

@Sekhmet
Copy link
Member Author

Sekhmet commented Oct 16, 2024

We don't have counter right now, we would need to fetch that info first, for now just ported it to combobox.

@wa0x6e
Copy link
Contributor

wa0x6e commented Oct 16, 2024

IMG_1415

  • On mobile, the "network" dropdown looks very narrow, maybe we could use another width than the input. Moreover, if we have selected something long from the "Category", like investment, it will make the network input shrink more, and the combobox will have an horizontal scroll
  • When clicking on the "Network" input, on dev console mobile emulation, it show right-click menu (seems like this is also the case on master). This behavior is not present if clicking on the dropdown caret icon, and is not on the headless-ui demo either

Screenshot 2024-10-16 at 19 44 37

On mobile, it has 2 different behaviors:

  • When focus is out of the combobox (touch somewhere blank on the page), touching on the input will select all text
  • When focus is on the combobox (select something in the combobox), touching the input again will not select all text, but place the cursor at the selected touch point.

@wa0x6e
Copy link
Contributor

wa0x6e commented Oct 16, 2024

All other combobox are missing the label now

Screenshot 2024-10-16 at 19 55 01

With DevTools it looks like when you select text right-click menu is triggered automatically.
This happens on all websites, we can prevent it on initial click by delaying it
to next frame, but if you click again it will be triggered anyway.

Not sure if this is worth keeping, it doesn't cause real-world issues AFAIK.
@Sekhmet
Copy link
Member Author

Sekhmet commented Oct 17, 2024

When clicking on the "Network" input, on dev console mobile emulation, it show right-click menu (seems like this is also the case on master). This behavior is not present if clicking on the dropdown caret icon, and is not on the headless-ui demo either

This happens because we select text on focus, I added workaround so it will skip initial click, but if you click it again it will still happen. It's just what dev emulation does, if you go to other website and select some text (with keyboard shortcut) it will pop up as well.

@bonustrack
Copy link
Member

This is not looking good, can we have the width of the input dynamic based on the label and have the dropdown width based on the content?
image

@Sekhmet
Copy link
Member Author

Sekhmet commented Oct 21, 2024

We would need to grow this input using JS because CSS can't do that, is that okay?

@bonustrack
Copy link
Member

Hum, what you can't do with CSS exactly?

@Sekhmet
Copy link
Member Author

Sekhmet commented Oct 21, 2024

So I assume if we select longer option input should grow with it:
image

But it's not possible with CSS alone as it's input:
https://css-tricks.com/auto-growing-inputs-textareas/

@bonustrack
Copy link
Member

  • Let's remove "query" on the text telling there is no results, and align it to left
  • Make the input auto growing
  • Use a fixed width for the dropdown
  • Truncate text so network name are always in 1 line

@Sekhmet
Copy link
Member Author

Sekhmet commented Oct 21, 2024

Are we sure about left-align?
image

Doesn't look good to me.

@bonustrack
Copy link
Member

Ok let's keep text-center but change text to No results found

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.

3 participants