Closed christianjro closed 7 months ago
Name | Link |
---|---|
Latest commit | 2113637433b30268ff791465a76b49b123c1464c |
Latest deploy log | https://app.netlify.com/sites/luckyparking/deploys/660797aed13d790008da9270 |
Deploy Preview | https://deploy-preview-631--luckyparking.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Description
Problem: As a developer, I want the route paths to be dynamic, so that URLs can be used to personalize or specific what to render in particular views.
Solution:
Used React Router to create dynamic routes for single mode and comparative mode use of the website. I also created a custom hook
useCitationSearchParams
to handle the logic of setting, retrieving, and deleting search query parameters.In single mode:
place_name
andplace_type
parameters are set in the URL. I decided to keep it this way because the citation data filters (data category and date preset) are still the default selections.single-search-visualization.tsx
component.citation-explorer.tsx
, theplace_name
is obtained from the URL and is passed down to theSingleSearch
component (as asavedQuery
) and ultimately to theGeocoder
component. I updated theGeocoder
component to behave in the following way: if it recognizes that it’s receiving a savedQuery, it will automatically select theGeocoder
result and pass it to thecitation-explorer
via a callback function. This way, we can use asavedQuery
string to obtain a Geocoder result with all the necessary properties.single-search-visualization.tsx
component.In comparative mode:
comparative_mode
parameter is added to the URL when a user enters comparative mode.citation-explorer.tsx
component.visualization_mode
parameter is added to the URL.category
parameter will be added to the URL.citation-explorer.tsx
, theisSingleSearchMode
state variable will be set based on whether or not it finds thecompare_mode
parameter in the URL.ComparativeSearch
component asregion1SavedQuery
andregion2SavedQuery
variables. To differentiate regions, I added the id property on the Geocoder component. This way when the onSelect callback function is called, the proper region is assigned.Related Issues
Resolves #620
Testing
Updated Testing Coverage
Checklist