Open
Conversation
…rMap file to react components. update fetch with loading & error states. setup utils and skeletons for UI
…let Popup. update React components. UI WIP
… for error & loading page.
…apLegend for more context on data. add community name to max num of year
…ounting, add svg to error page. update bootstrap class on permit info headlines
…s. update h4 to h2 in legend
…resolve possible / by 0 error.
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.
Overview
Updated map/serializers.py to fetch proper shape of data. updated test to verify correct permit counts. Broke out map/static/js/RestaurantPermitMap.js to React components and util functions. Updated MapContainer to have popup and color based on yearly permits. Added Legend to add additional context to map data.
Demo
Click to expand: Screenshots below
home pageLoading Screen

Error Screen

Popup

Notes
I decided to break up the main RestaurantPermitMap into smaller components based on the philosophy of React thinking in React. The utils folder houses functions what help calculate and shape the data for easier look up for the map container.
Opportunity for improvements
Click to expand: Additional thoughts and ramblings
Testing Instructions
Click to expand: Instructions on setting up locally
Development requires a local installation of [Docker](https://docs.docker.com/get-started/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/). These are the only two system-level dependencies you should need.Once you have Docker and Docker Compose installed, build the application containers from the project's root directory:
docker compose buildLoad in the data:
docker compose run --rm app python manage.py loaddata map/fixtures/restaurant_permits.json map/fixtures/community_areas.jsonAnd finally, run the app:
docker compose upThe app will log to the console, and you should be able to visit it at http://localhost:8000/
Use this command to run tests:
docker compose -f docker-compose.yml -f tests/docker-compose.yml run --rm app