Fix/exercise UI match ingredients#1235
Open
Sahasra0108 wants to merge 4 commits intowger-project:masterfrom
Open
Fix/exercise UI match ingredients#1235Sahasra0108 wants to merge 4 commits intowger-project:masterfrom
Sahasra0108 wants to merge 4 commits intowger-project:masterfrom
Conversation
…Icon filter popup, language dropdown, and localStorage support
| const [t, i18n] = useTranslation(); | ||
| const [inputValue, setInputValue] = React.useState(""); | ||
| const [searchEnglish, setSearchEnglish] = useState<boolean>(true); | ||
| const defaultLanguageFilter = i18n.language === LANGUAGE_SHORT_ENGLISH |
Member
There was a problem hiding this comment.
since this is basically the same as the IngredientLanguageFilter, I would suggest renaming that to something like SearchLanguageFilter, putting it somewhere in core and using it both in the ingredient and this search
| * Search for exercises by name using the exerciseinfo endpoint | ||
| */ | ||
| export const searchExerciseTranslations = async (name: string, languageCode: string = ENGLISH_LANGUAGE_CODE, searchEnglish: boolean = true): Promise<Exercise[]> => { | ||
| export const searchExerciseTranslations = async (name: string, languageCode: string = ENGLISH_LANGUAGE_CODE, searchEnglish: boolean = true, exactMatch: boolean = false): Promise<Exercise[]> => { |
Member
There was a problem hiding this comment.
we should pass the language filter like in searchIngredient(I'm just trying to make both look and work as similarly as possible)
|
|
||
| const adapter = new ExerciseAdapter(); | ||
| return data.results.map((item: unknown) => adapter.fromJson(item)); | ||
| const exercises = data.results.map((item: unknown) => adapter.fromJson(item)); |
Member
There was a problem hiding this comment.
sorry, the issue probably wasn't clear. If the exact match flag is set, we filter by name with name, otherwise with name__search like before. We should not do any matching client side
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
vs fulltext search (name__search=foo)
Related Issue(s)
Related to wger-project/wger#2279 (implements React part of exercise search UI improvements)
Screenshots
1. Filter popup with Language dropdown and Exact match toggle
2. Fuzzy search (Exact match OFF) - shows multiple results
3. Exact match ON - shows only exact result


4. Filter panel hidden - grid expands to full width
5. Filter panel visible
Please check that the PR fulfills these requirements