-
Notifications
You must be signed in to change notification settings - Fork 13
Create facilities tab & display text search results #237
Conversation
bf31713
to
de75e16
Compare
6de75f1
to
12ed908
Compare
Looking at this now |
Weird! I wonder if I set up the click handlers incorrectly. I tested staging and it's not happening there. |
Turns out the correct function signature is:
Adjusted it in 1a05bab |
It is a bit frustrating to loose scroll state on the search results. When navigating back from the details view. Have we done any scroll restoration on other projects that could possibly apply here? This react-router document talks about the issue but does not include a general solution for our issue. https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md |
Make sense. I haven't ever worked on it; the nearest thing to this is the parcel cards sidebar in GARP for which we declined to try to set up scroll restoration. I'm happy to look into it, but I wonder if it'd make sense as a new card? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the design of this solution and it is working well. I made a few small suggestions inline.
There is one usability/inconsistency issue that we may need to consider. There are currently two ways to get to the search results:
- Clicking the "Search" button on the Search tab.
- Clicking the "Facilities" tab.
If you run a search, click back to the search tab, change one of the filters, then click back to the "Facilities" tab you are now in a kind of inconsistent state. We may want to consider one of the following changes to make sure the state of the two tabs are always consistent. - Disable the facilities tab (make it inaccessible) until a search has been run
- Make clicking on the facilities tab trigger a search if the search options have changed
- Remove the search button and always have the results on facilities tab match the search fields
I think making a click on the facilities tab trigger the search if the options have changed is the most natural given the current behavior. Do you have opinions or other ideas?
@@ -40,8 +38,7 @@ | |||
"build": "react-scripts build", | |||
"test": "CI=1 react-scripts test", | |||
"lint": "eslint src/ --ext .js --ext .jsx", | |||
"eject": "react-scripts eject", | |||
"deploy": "npm run build && firebase deploy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good that we are removing this legacy deploy command, but we should consider documenting in the commit message why we making this change that is unrelated to CSV processing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note: I have not changed this yet but I will update the commit message when squashing and rebasing before I merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated commit is
6fd1a9b
|
||
const stringArray = [ | ||
[ | ||
'hello', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider including one of our pathological hex strings in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I added the problematic one in 5c02862
<label | ||
htmlFor={SEARCH_TERM_INPUT} | ||
> | ||
Search results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider changing this label to "Filter results" to distinguish search, which takes place on the "Search" tab, from narrowing the list with a text filter. We may want to carry this renaming through to code constants too, i.e. SEARCH_TERM_INPUT
-> FILTER_TERM_INPUT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. 42bbd93 renames these from using searchTerm
to using filterText
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced the "Search" text with "Filter" in the adjusted last commit here.
|
||
const SEARCH_TERM_INPUT = 'SEARCH_TERM_INPUT'; | ||
|
||
const makeFacilityListHeightPercentageString = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my 1680x1050 screen there is some whitespace between the scrolling results list and the footer. If I shrink the browser window height the whitespace goes away. I looks like the conditional styling set up by this function may be the reason. Is there a way we can make sure that the scrolling area always fills the container?
How would you feel about dumping any existing facilities data altogether when the state of the filters on the search tab changes? That'd also solve an inconsistency between prior data and the new filters before "search" has been clicked. |
I think that is a good idea in general, but what would the facilities tab say at that point? If it reverts to the "No facilities were found for that search" message we are in the same situation. |
Interesting. Maybe we just don't show the tab at all if there are no facilities in the state to display? I'll try it out locally to see how that works. |
9a189ee creates a new "no facilities to display" state for the sidebar tab so that it will look like this when there's nothing to show: In addition, I updated the application state to clear facilities data when any of the search filters change and to drop the markers from the map when the facilities data is cleared. For the latter, I kept the layer around, but just replace the data with an empty geojson feature collection so that no markers will show. |
#250 is for scroll restoration It occurred to me that we may be able to find an infinite scroll library that supports scroll restoration innately. That would also solve potential performance problems if the list of search results was in the thousands. |
- add an order_by('name') clause to the queryset in all_contributors to sort the results so they'll display alphabetically by name in the client Connects #227
- remove papaparse library - create utility function for generating CSV row strings in order to circumvent a bug whereby JSON.parse would occasionally cast OAR ID shas into numbers - add tests for CSV parsing function - rename app from "redpanda" to "open apparel registry" in package.json - drop legacy "npm deploy" script from package.json
cd088df
to
38881b9
Compare
Rebased this on develop & squashed. |
Looking at this now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks and works well. Thanks for working through the issues. I made just one small text suggestion.
<label | ||
htmlFor={SEARCH_TERM_INPUT} | ||
> | ||
Search results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, must have forgot to update this. Will make this change before merging. |
- create facilities tab for displaying a text list of facilities - add free text search field to search on name, and country name fields - add functionality to download a CSV of facilities filtered by free text search - update Redux actions to handle toggling & displaying the facilities tab and storing the free text search value - adjust application HTML element hierarchy & style sheet in order to - prevent the enter app from scrolling vertically - enable select components to scroll vertically when necessary
38881b9
to
b9d88e6
Compare
Thanks for your help with this! |
Overview
This PR adds a facilities list tab which will display a list of text search results as depicted below when the facilities results return from a search of the API. I also added a free text search which currently searches on the
name
address
andcountry_name
fields to narrow down the list of visible results, as well as a "Download CSV" functionality which downloads a list of CSV items.Additionally, this PR also:
NaN
to the CSVpackage.json
from "redpanda" (which was the legacy name?) to "open apparel registry"Connects #209
Connects #227
Connects #127
Connects #123
Demo
CSV:
facilities.csv.txt
No results for a search:
Notes
I made #244 for the map interactions because it will need some dedicated thought about how to handle the various possible kinds of interaction.
Testing
./scripts/update
./scripts/test
and verify that everything passes./scripts/resetdb
/auth/register
/contribute
/profile/:id/
/lists
/lists/:id