@@ -42,24 +42,18 @@ export default function RestaurantPermitMap() {
4242 const [ currentYearData , setCurrentYearData ] = useState ( [ ] )
4343 const [ year , setYear ] = useState ( 2026 )
4444
45- const currentUrl = `/map-data/?year=${ year } `
45+ const yearlyDataEndpoint = `/map-data/?year=${ year } `
4646
47- const totalPermits = currentYearData . reduce (
48- ( acc , curr ) => acc + curr . num_permits ,
49- 0
50- )
51- const maxNumPermits = Math . max ( ...currentYearData . map ( ( c ) => c . num_permits ) )
52-
53- const communityAreaDict = Object . fromEntries (
54- currentYearData . map ( ( d ) => [ d . name , d ] )
55- )
56-
57- // Get values for community areas
5847 useEffect ( ( ) => {
59- fetch ( currentUrl )
48+ fetch ( )
6049 . then ( ( res ) => res . json ( ) )
61- . then ( ( data ) => setCurrentYearData ( data ) )
62- } , [ currentUrl ] )
50+ . then ( ( data ) => {
51+ /**
52+ * TODO: Fetch the data needed to supply to map with data
53+ */
54+ } )
55+ } , [ yearlyDataEndpoint ] )
56+
6357
6458 function getColor ( pcntPermits ) {
6559 if ( pcntPermits > .5 )
@@ -73,21 +67,14 @@ export default function RestaurantPermitMap() {
7367 }
7468
7569 function setAreaInteraction ( feature , layer ) {
76- const thisAreaData = communityAreaDict [ feature . properties . community ] ,
77- numPermits = thisAreaData . num_permits ,
78- pcntPermits = numPermits / maxNumPermits
79- layer . setStyle ( {
80- color : "#000000" ,
81- weight : 1 ,
82- fillOpacity : 0.7 ,
83- fillColor : getColor ( pcntPermits )
84- } )
85- layer . on ( "mouseover" , ( ) => {
86- layer . bindPopup ( `
87- <strong>${ feature . properties . community } </strong><br />
88- Year: ${ year } <br />
89- Restaurant permits: ${ thisAreaData . num_permits }
90- ` )
70+ /**
71+ * TODO: use the methods below to:
72+ * 1) shade each area according to how many permits it had in a year
73+ * 2) display a popup with area details during user interaction
74+ */
75+ layer . setStyle ( )
76+ layer . on ( "" , ( ) => {
77+ layer . bindPopup ( "" )
9178 layer . openPopup ( )
9279 } )
9380 }
@@ -96,11 +83,11 @@ export default function RestaurantPermitMap() {
9683 < >
9784 < YearSelect filterVal = { year } setFilterVal = { setYear } />
9885 < p className = "fs-4" >
99- Restaurant permits issued this year: { totalPermits || "0" }
86+ Restaurant permits issued this year: { /* TODO: display this value */ }
10087 </ p >
10188 < p className = "fs-4" >
10289 Maximum number of restaurant permits in a single area:
103- { " " + ( maxNumPermits || "0" ) }
90+ { /* TODO: display this value */ }
10491 </ p >
10592 < MapContainer
10693 id = "restaurant-map"
0 commit comments