-
Notifications
You must be signed in to change notification settings - Fork 23
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
Select only forager and freegan types by default #467
Comments
Hey, I'd like to be assigned this issue to work on. |
@frankgomezdev Welcome! I assigned you this issue, feel free to ask @wbazant (who recently refactored the type tree filter) if you have trouble finding where to make this change in the code. |
Sorry, I think I misunderstood what was being asked in this issue and it may be way over my skill level. You can reassign this to someone else. |
No problem! I'll try to provide some pointers, if you want to try to solve it you still can, or if anyone else wants to have a go they're welcome too. The app fetches types from the backend, here is an API definition: https://petstore.swagger.io/?url=https://raw.githubusercontent.com/falling-fruit/api/main/docs/openapi.yml#/Types/get_types . The default choice is populated after it loads in the fetchAndLocalizeTypes.fulfilled extraReducer here:
That extraReducer is still a place to populate the default choice of types, but it should become something like
categories: string[] and
|
Ok, I think I was missing the first part with the API and the filterSlice.js file. I did add the field into the LocalizedType and created a method in the TypesAccess but wasn't seeing the changes. So is the expected output when this change is made to only have forager and freegan selected in the tree filter on the left on load? Also, feel free to re-assign. |
To make sure you're putting in all the changes, you can follow the data step by step through the code base - in the browser's network tab you'll see the data fetched by Types where a list of categories intersects with ['forager', 'freegan'], e.g a dumpster or apple tree, should be selected by default, but e.g an oak tree should be unselected by default. |
Hey, back again! I'm going to take a little break because I've been working on this for a few hours now but so far I have:
I can follow the data and see the getTypes response using the browser's network tool and can confirm the categories property is there. This is the new method I created for TypesAccess in the The issue I'm having now is that when I update line 83 in filterSlice.js to something like: |
Neat, looks like you did a lot on this! The old code did
so I'm guessing after you add Then you'll also have a small bit of logic to update in
|
To match user expectations and the behavior of the current interfaces, the new
categories
property of each location type should be used to initialise the type tree filter with only types whosecategories
property contains eitherforager
orfreegan
. This should also be used as the default selection for deciding when to display the orange dot on the filter button in mobile view, which indicates that the current filter selection deviates from the default. Currently the default is that all types are selected.This is an early precursor to full categories support, see #383.
The text was updated successfully, but these errors were encountered: