@@ -40,37 +40,27 @@ export default function RestaurantPermitMap() {
4040 const [ currentYearData , setCurrentYearData ] = useState ( [ ] )
4141 const [ year , setYear ] = useState ( 2026 )
4242
43- const currentUrl = `/map-data/?year=${ year } `
43+ const yearlyDataEndpoint = `/map-data/?year=${ year } `
4444
45- const totalPermits = currentYearData . reduce (
46- ( acc , curr ) => acc + curr . num_permits ,
47- 0
48- )
49- const maxNumPermits = Math . max ( ...currentYearData . map ( ( c ) => c . num_permits ) )
50-
51- const communityAreaDict = Object . fromEntries (
52- currentYearData . map ( ( d ) => [ d . name , d ] )
53- )
54-
55- // Get values for community areas
5645 useEffect ( ( ) => {
57- fetch ( currentUrl )
46+ fetch ( )
5847 . then ( ( res ) => res . json ( ) )
59- . then ( ( data ) => setCurrentYearData ( data ) )
60- } , [ currentUrl ] )
48+ . then ( ( data ) => {
49+ /**
50+ * TODO: Fetch the data needed to supply to map with data
51+ */
52+ } )
53+ } , [ yearlyDataEndpoint ] )
6154
6255 function setAreaInteraction ( feature , layer ) {
63- const thisAreaData = communityAreaDict [ feature . properties . community ] ,
64- numPermits = thisAreaData . num_permits ,
65- pcntPermits = numPermits / maxNumPermits
66- layer . setStyle ( {
67- fillOpacity : pcntPermits ,
68- } )
69- layer . on ( "mouseover" , ( ) => {
70- layer . bindPopup ( `
71- <h3>${ feature . properties . community } </h3>
72- <p>Restaurant permits issued during ${ year } : ${ thisAreaData . num_permits } </p>
73- ` )
56+ /**
57+ * TODO: use the methods below to:
58+ * 1) shade each area according to how many permits it had in a year
59+ * 2) display a popup with area details during user interaction
60+ */
61+ layer . setStyle ( )
62+ layer . on ( "" , ( ) => {
63+ layer . bindPopup ( "" )
7464 layer . openPopup ( )
7565 } )
7666 }
@@ -79,11 +69,11 @@ export default function RestaurantPermitMap() {
7969 < >
8070 < YearSelect filterVal = { year } setFilterVal = { setYear } />
8171 < p className = "fs-4" >
82- Restaurant permits issued this year: { totalPermits || "0" }
72+ Restaurant permits issued this year: { /* TODO: display this value */ }
8373 </ p >
8474 < p className = "fs-4" >
8575 Maximum number of restaurant permits in a single area:
86- { " " + ( maxNumPermits || "0" ) }
76+ { /* TODO: display this value */ }
8777 </ p >
8878 < MapContainer
8979 id = "restaurant-map"
0 commit comments