Skip to content

Commit 0b0ce53

Browse files
committed
filtering fixed
1 parent 30e7b54 commit 0b0ce53

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

frontend/src/components/HUDleftPoints.jsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ function LogoBlock() {
301301
return () => document.removeEventListener('mousedown', handleClickOutside);
302302
}, [showSortMenu]);
303303

304+
// NEW: dispatch filterchange event
305+
const handleApplyFilter = () => {
306+
const min = parseFloat(tempFilter.min);
307+
const max = parseFloat(tempFilter.max);
308+
window.dispatchEvent(new CustomEvent('filterchange', {
309+
detail: { min: isNaN(min) ? NaN : min, max: isNaN(max) ? NaN : max }
310+
}));
311+
setShowFilterModal(false);
312+
};
313+
314+
// NEW: reset filter AND dispatch
315+
const handleResetFilter = () => {
316+
setTempFilter({ min: '', max: '' });
317+
window.dispatchEvent(new CustomEvent('filterchange', {
318+
detail: { min: NaN, max: NaN }
319+
}));
320+
setShowFilterModal(false);
321+
};
322+
304323
return (
305324
<div
306325
className="boxwithpoints"
@@ -797,8 +816,8 @@ function LogoBlock() {
797816
theme={theme}
798817
tempFilter={tempFilter}
799818
setTempFilter={setTempFilter}
800-
applyTempFilter={tempFilter}
801-
resetTempFilter={setTempFilter}
819+
applyTempFilter={handleApplyFilter} // use handler
820+
resetTempFilter={handleResetFilter} // use handler
802821
/>
803822
</div>
804823
);

frontend/src/components/MapComponent.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export default function MapComponent() {
252252
const historicalData = await fetchHistoricalData(name);
253253

254254
// add once at top of click‐handler so you can reuse
255-
const popupOffset = [17, -25]; // x=0 (center), y=−45px (above marker)
255+
const popupOffset = [17, -32]; // x=0 (center), y=−45px (above marker)
256256

257257
if (historicalData.length === 0) {
258258
marker.bindPopup(`

0 commit comments

Comments
 (0)