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

Implementation of filters in custom search modal. #1560

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

vivekjain23
Copy link
Contributor

@vivekjain23 vivekjain23 commented May 15, 2024

Description of change

  • Added facet filter on search bar.

Links to any relevant issues

fixes https://github.com/iotaledger/iota/issues/1438

Type of change

  • Enhancement (a non-breaking change which adds functionality)

Change checklist

Tick the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own changes
  • I have made sure that added/changed links still work
  • I have commented my code, particularly in hard-to-understand areas

@vivekjain23 vivekjain23 marked this pull request as ready for review May 17, 2024 11:15
@lucas-tortora lucas-tortora marked this pull request as draft May 17, 2024 11:29
@lucas-tortora lucas-tortora marked this pull request as ready for review May 17, 2024 11:29
src/utils/searchConstant.ts Outdated Show resolved Hide resolved
src/theme/Footer/index.tsx Outdated Show resolved Hide resolved
src/theme/DocItem/Layout/index.tsx Outdated Show resolved Hide resolved
@jlvandenhout
Copy link
Collaborator

Just as a consideration, since we already have to change the search component provided by @docusaurus/theme-search-algolia anyway to support dynamic selection of facets to filter. We could also use the UI components provided by instantsearch, which supports facet filters out of the box. Basically the steps would be to swizzle the SearchBar component, like we already have to do anyway, like described here, build the UI using the Instantsearch components and style it so it matches the rest of the Wiki (which we also need to look at anyway for the rebrand).

@lucas-tortora lucas-tortora marked this pull request as draft June 7, 2024 12:00
@jlvandenhout
Copy link
Collaborator

The search query is cleared when the filter is changed in the search modal. This differs from the behavior on the search page, where it just updates the search results. I'd prefer if we can get the search modal to behave the same as the search page.

@lucas-tortora lucas-tortora marked this pull request as draft July 16, 2024 12:26
@lucas-tortora lucas-tortora marked this pull request as ready for review July 16, 2024 12:27
Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 31482b1

✅ Preview: https://iota-wiki-k32uxfydr-iota1.vercel.app

@lucas-tortora
Copy link
Collaborator

The search query is cleared when the filter is changed in the search modal. This differs from the behavior on the search page, where it just updates the search results. I'd prefer if we can get the search modal to behave the same as the search page.

@vivekjain23 , could you look into this, please? It's been 2 weeks since this comment

@jlvandenhout
Copy link
Collaborator

I have tried to solve it, but my React knowledge is too limited, unfortunately.

@jlvandenhout
Copy link
Collaborator

After using the filter for a while, I also think we should make the selection behavior a bit different. Have the "all" filter still select everything, but as soon as you select individual items, I think it is more convenient to clear everything except the one selected item on the first individual selection.

Something like:

All is selected:

x All
x A
x B
x C

User selects B:

  All
  A
x B
  C

User selects A too:

  All
x A
x B
  C

@vivekjain23
Copy link
Contributor Author

After using the filter for a while, I also think we should make the selection behavior a bit different. Have the "all" filter still select everything, but as soon as you select individual items, I think it is more convenient to clear everything except the one selected item on the first individual selection.

Something like:

All is selected:

x All
x A
x B
x C

User selects B:

  All
  A
x B
  C

User selects A too:

  All
x A
x B
  C

Yupp, thanks for the suggestion. I have implemented it

@lucas-tortora lucas-tortora marked this pull request as draft July 22, 2024 12:50
@lucas-tortora lucas-tortora marked this pull request as ready for review July 22, 2024 12:50
Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: fbdf425

✅ Preview: https://iota-wiki-8qorj3t6g-iota1.vercel.app

@lucas-tortora lucas-tortora marked this pull request as draft July 30, 2024 14:57
@lucas-tortora lucas-tortora marked this pull request as ready for review July 30, 2024 14:57
Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 1ddf1d7

✅ Preview: https://iota-wiki-77vw3bp9s-iota1.vercel.app

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want this? I think in most cases the search filter state should revert again 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you make this tsx? Will make it easier for us to migrate to the new docs

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you swizzle this in ts please?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we automate this somehow? We will never maintain it

@Dr-Electron
Copy link
Collaborator

Btw there is also still a bug, if there is only 1 search result for example, the footer is not at the bottom of the page

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.

5 participants