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): enable advanced research #463

Merged
merged 22 commits into from
Apr 11, 2024

Conversation

Piv94165
Copy link
Contributor

@Piv94165 Piv94165 commented Mar 27, 2024

What

  • Add an advanced search page for searching EntryNodes with filters (example: is:root ancestor:en:ghee dairy or descendant:en:dairy language:fr not(language):fr), full-text-search.

Possible evolutions

  • Adding more filters (is:modified property:vegan:en:no not(property):description:en)
  • Support unions

Screenshot

advanced-research-V3.mp4

@Piv94165 Piv94165 requested a review from a team as a code owner March 27, 2024 08:06
@Piv94165 Piv94165 changed the title feat(frontend) : Enable advanced research feat(frontend): enable advanced research Mar 27, 2024
@Piv94165 Piv94165 linked an issue Mar 27, 2024 that may be closed by this pull request
Copy link
Contributor

@eric-nguyen-cs eric-nguyen-cs left a comment

Choose a reason for hiding this comment

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

UI looks good but I think there may be some logic to update concerning the state

<FiltersArea
setCurrentPage={setCurrentPage}
setQ={setQ}
filters={entryNodeSearchResult?.filters ?? []}
Copy link
Contributor

Choose a reason for hiding this comment

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

This creates weird states: when you go and fetch a new search result, entryNodeSearchResult is set to undefined so the filters are reset during that time
You may want to use placeholderData and isPlaceholderData for this: https://tanstack.com/query/latest/docs/framework/react/guides/migrating-to-v5#removed-keeppreviousdata-in-favor-of-placeholderdata-identity-function

Copy link
Contributor

Choose a reason for hiding this comment

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

The language selection seems super slow... Maybe modifying how the states are handled as suggested in other comments may help

/>
<MultipleSelectFilter
label="Translated into"
filterValue={chosenLanguagesCodes}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why you do not pass the setFilterValue function to this component whereas you do that in other places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, the filterValue state in the MultipleSelectFilter component is updated based on the response from the backend. However, MultipleSelectFilter only updates the query (Q) sent to the backend. Upon reflection, I realize that both filterValue and setFilterValue from FilterInput should be maintained as component states rather than passed as props.

alice.juan and others added 7 commits April 1, 2024 11:05
* feat(frontend): make language selection for translations more intuitive (#461)

The PR modifies the translations section of the edit entry page:

* Changes "All languages" terminology to "Fallback translations" (fixes #458)
* Adds an info alert if "en" (English) or "xx" (Fallback translations) is not the main language for an entry (fixes #457)
/ Fixes the fact that the alert message about changing the display name of a language appears even if the language had no translations and we add the first one (fixes #459)
* Adds a "Show all existing translations" checkbox to see all the languages that currently have translations, with their translations Adds a possibility to "pin" languages to select them (so they stay in local storage and appear at the top for each entry), and a possibility to hide (unselect) these languages easily (with an icon next to their title)
* Modifies the selection of new languages: I removed the "number of languages shown" button that had to be clicked to add a language, and created a "Show another language" button at the bottom of the section. Also, the dialog is now an autocomplete instead of a select, and you just type the languages that you want to add and see languages that are not selected, instead of seeing all current languages and being able to remove them. The autocomplete with the options is also automatically focused when opening the dialog.
* Adds vite-plugin-svgr to easily import svg files in React

---------

Co-authored-by: Charles Perier <charlesperier@Charless-Laptop.local>

* feat: add property filter to search API (#456)

* feat: add property filter to search API

* chore: generate SDK

* chore: Add info banners on the frontend (#473)

* docs: add info banners

* refactor: delete unnecessary components

* fix: add line break

* improve search results, and few other improvements

* show translations instead of translated languages

---------

Co-authored-by: Charles Perier <charlesperier@Charless-Laptop.local>
Co-authored-by: Eric Nguyen <ericnguyen.developper@gmail.com>
Comment on lines 6 to 7
// filterValue: string;
// setFilterValue: Dispatch<SetStateAction<string>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// filterValue: string;
// setFilterValue: Dispatch<SetStateAction<string>>;

Comment on lines 15 to 16
// filterValue,
// setFilterValue,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// filterValue,
// setFilterValue,

@Piv94165 Piv94165 merged commit 20ca2e4 into main Apr 11, 2024
7 checks passed
@Piv94165 Piv94165 deleted the piv94165/frontend-advanced-research-merge branch April 11, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Frontend : Advanced search page
4 participants