Skip to content

feat: loading indicator, gray-tile fix, polygon click-to-zoom#60

Merged
madhavcodez merged 1 commit intomainfrom
feat/loading-and-map-polish
Apr 15, 2026
Merged

feat: loading indicator, gray-tile fix, polygon click-to-zoom#60
madhavcodez merged 1 commit intomainfrom
feat/loading-and-map-polish

Conversation

@madhavcodez
Copy link
Copy Markdown
Contributor

What this does

Three related map-polish fixes: no more gray tiles on first load, a loading indicator during fetches, and smooth zoom into any damage polygon you click.

1. Gray-tile fix (InvalidateSizeHandler)
Leaflet measures the container once on mount, and if the container is still being laid out that measurement is wrong, giving you a map of gray squares until you resize the window. Now we run map.invalidateSize() 100ms after mount AND install a ResizeObserver so tiles re-measure correctly on every sidebar toggle and window resize — the fix covers the full lifecycle, not just the initial paint.

2. Loading indicator
A thin pulsing blue bar flashes across the top of the map whenever /locations or /image-pairs is in flight, so the UI feels responsive during larger fetches instead of appearing frozen.

3. Polygon click-to-zoom
Click any damage polygon (red, orange, yellow, green) and the map smoothly flies to its centroid at zoom 18 over 0.8s. The popup with classification details still opens alongside.

How to verify

  • Hard-refresh → tiles render immediately, no gray patches. Toggle the sidebar or resize the window → still no gray.
  • Pan to a new area → thin blue bar flashes on the top edge for a moment.
  • Click any colored polygon → smooth 0.8s fly-to at zoom 18, popup opens.

Closes #42
Closes #57
Closes #46

Install InvalidateSizeHandler that runs map.invalidateSize() 100ms
after mount and watches for container size changes via ResizeObserver,
so tiles render correctly on initial load, sidebar toggles, and window
resizes.

Render a thin pulsing blue bar at the top of the map while either
/locations or /image-pairs is in flight so the UI feels responsive
during larger fetches.

Make damage polygons clickable: onClick fires map.flyTo(centroid,
zoom=18) with a 0.8s animation so users can drill into any building
from the overview.

Closes #42
Closes #57
Closes #46
@madhavcodez madhavcodez self-assigned this Apr 14, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontend Ready Ready Preview, Comment Apr 14, 2026 3:57pm

@madhavcodez madhavcodez merged commit 20f3f18 into main Apr 15, 2026
2 checks passed
@madhavcodez madhavcodez deleted the feat/loading-and-map-polish branch April 15, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant