diff --git a/src/pages/Map.css b/src/pages/Map.css
index 56e0564..736342f 100644
--- a/src/pages/Map.css
+++ b/src/pages/Map.css
@@ -9,6 +9,7 @@
background: transparent !important;
border: none !important;
box-shadow: none !important;
+ z-index: 4 !important;
}
/* Remove any default styles applied to popup content */
@@ -16,6 +17,7 @@
min-width: 0 !important; /* Remove max-width constraints */
background: transparent !important; /* Make the content background transparent */
margin: 0;
+ z-index: 3;
}
/* Hide the arrow of the popup */
diff --git a/src/pages/MapPage.tsx b/src/pages/MapPage.tsx
index d476e78..56cfe31 100644
--- a/src/pages/MapPage.tsx
+++ b/src/pages/MapPage.tsx
@@ -9,7 +9,7 @@ import MapDateSelections from '../components/MapDateSelections.js';
import WeatherStationProfile from '../components/WeatherStationProfile.js';
import Legends from '../components/Legends.js';
import "./Map.css"
-import { signal } from '@preact/signals-react'
+import { effect, signal } from '@preact/signals-react'
import { Dataset, datasets } from '../utils/datasets.js';
import { NtaProfileData, WeatherStationData } from '../types.js';
import { initializeView } from '../utils/datasets.js';
@@ -28,7 +28,7 @@ export const previousClickCor = signal<[number, number]>([0, 0])
export const clickedWeatherStationPopup = signal
(null)
export const clickedNeighborhoodPopup = signal(null)
export const clickedNeighborhoodInfo = signal<{
- code:string
+ code: string
boro: string,
nta: string
}>({
@@ -91,23 +91,42 @@ const MapPage = () => {
}, []);
+ // Debounce map resize to avoid excessive updates when profiles change
+ effect(() => {
+ const debounced = setTimeout(() => {
+ if (map?.value) {
+ console.log('resize')
+ map.value.resize()
+ }
+ const _ = isNeighborhoodProfileExpanded.value && isWeatherStationProfileExpanded.value
+ }, 100)
+
+ return () => clearTimeout(debounced)
+ })
return (
{/*
*/}
- {
- selectedDataset.value?.name === "Weather Stations" &&
- }
- {
- selectedDataset.value?.name !== "Weather Stations" &&
- }
-
-
+
+
+
+ {isNeighborhoodProfileExpanded.value && selectedDataset?.value?.name !== "Weather Stations" && (
+
+
+
+ )}
+ {isWeatherStationProfileExpanded.value && selectedDataset?.value?.name === "Weather Stations" && (
+
+
+
+ )}
+
+
);
};
diff --git a/src/utils/format.ts b/src/utils/format.ts
index 982b902..4ad5537 100644
--- a/src/utils/format.ts
+++ b/src/utils/format.ts
@@ -1,5 +1,5 @@
export const formatDateString = (dateString: string) => {
- if(dateString.length === 4){
+ if (dateString.length === 4) {
return dateString
}
@@ -16,4 +16,59 @@ export const boroughExpand = {
'BK': 'Brooklyn',
'QN': 'Queens',
'SI': 'Staten Island'
-}
\ No newline at end of file
+}
+
+interface BoroExtent {
+ center: [number, number];
+ zoom: number;
+ bounds?: [[number, number], [number, number]];
+ name: string;
+}
+
+export const BORO_EXTENTS: Record
= {
+ 'Staten Island': {
+ name: 'Staten Island',
+ center: [-74.1502, 40.5795],
+ zoom: 12,
+ bounds: [
+ [-74.2558, 40.4959],
+ [-74.0522, 40.6517]
+ ]
+ },
+ 'Brooklyn': {
+ name: 'Brooklyn',
+ center: [-73.9442, 40.6526],
+ zoom: 11.5,
+ bounds: [
+ [-74.0424, 40.5708],
+ [-73.8334, 40.7395]
+ ]
+ },
+ 'Queens': {
+ name: 'Queens',
+ center: [-73.7949, 40.7282],
+ zoom: 11.5,
+ bounds: [
+ [-73.9620, 40.5431],
+ [-73.7004, 40.8129]
+ ]
+ },
+ 'Manhattan': {
+ name: 'Manhattan',
+ center: [-73.9712, 40.7831],
+ zoom: 12,
+ bounds: [
+ [-74.0479, 40.6829],
+ [-73.9070, 40.8820]
+ ]
+ },
+ 'Bronx': {
+ name: 'Bronx',
+ center: [-73.8648, 40.8448],
+ zoom: 12,
+ bounds: [
+ [-73.9338, 40.7855],
+ [-73.7654, 40.9176]
+ ]
+ }
+};
\ No newline at end of file