Skip to content

Filter out stations without location from map#1309

Merged
annavik merged 4 commits into
mainfrom
fix/filter-deployments
May 19, 2026
Merged

Filter out stations without location from map#1309
annavik merged 4 commits into
mainfrom
fix/filter-deployments

Conversation

@annavik
Copy link
Copy Markdown
Member

@annavik annavik commented May 19, 2026

Summary

List of Changes

  • Filter out stations without location from stations map
  • Show tip about configure location for stations
  • Present undefined location value labels with "n/a"

Detailed Description

Screenshots

Before:
Screenshot 2026-05-19 at 10 40 03

After:
Screenshot 2026-05-19 at 10 39 25

Summary by CodeRabbit

Release Notes

  • New Features

    • Added guidance message to help users configure location coordinates when deployments are not visible on the map.
  • Improvements

    • Map now intelligently filters and displays only deployments with valid coordinates.
    • Adjusted minimum zoom level for improved map interaction experience.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for antenna-ssec ready!

Name Link
🔨 Latest commit 9c880bf
🔍 Latest deploy log https://app.netlify.com/projects/antenna-ssec/deploys/6a0c24c2e9c1ee0008a8b1a0
😎 Deploy Preview https://deploy-preview-1309--antenna-ssec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for antenna-preview ready!

Name Link
🔨 Latest commit 9c880bf
🔍 Latest deploy log https://app.netlify.com/projects/antenna-preview/deploys/6a0c24c25f9388000844c17f
😎 Deploy Preview https://deploy-preview-1309--antenna-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 61 (🔴 down 4 from production)
Accessibility: 89 (no change from production)
Best Practices: 92 (🔴 down 8 from production)
SEO: 92 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

This PR enhances the deployments map to validate location data and guide users toward configuration. The minimum map zoom is increased, coordinate filtering prevents invalid markers from rendering, and a conditional tip with a configuration link appears when deployments lack locations but are editable. The summary and deployment-details-info components integrate these changes by passing the project ID and handling optional coordinates.

Changes

Deployment map location validation

Layer / File(s) Summary
Map configuration and messaging strings
ui/src/design-system/map/config.ts, ui/src/utils/language.ts
MIN_ZOOM constant increased from 1 to 2. New STRING.MESSAGE_CONFIGURE_LOCATION enum and corresponding English translation ("Configure location for stations to see them on the map.") support conditional help messaging.
DeploymentsMap component: coordinate filtering and conditional tip
ui/src/pages/project/summary/deployments-map.tsx
DeploymentsMap now accepts projectId prop, filters out deployments without both latitude and longitude before creating MarkerPosition items, and conditionally renders a linked FormMessage tip when no valid markers exist but at least one deployment is updateable. Component is wrapped in a flex column layout.
Component integration: Summary and deployment-details-info
ui/src/pages/project/summary/summary.tsx, ui/src/pages/deployment-details/deployment-details-info.tsx
Summary explicitly passes projectId and deployments to DeploymentsMap via expanded props. Deployment-details-info conditionally outputs latitude/longitude as string only when the coordinate value is truthy, otherwise passes undefined.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • mihow

Poem

🗺️ Coordinates now bloom in sunlight clear,
A map that shows what matters here.
When stations drift in empty space,
A helpful nudge points to the place!
Rabbit hops through data true,
Locations shine in vibrant view. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: filtering out stations without location from the map display.
Description check ✅ Passed The description includes a summary and list of changes with before/after screenshots, but lacks required sections like Related Issues, How to Test, and Checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/filter-deployments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/src/pages/deployment-details/deployment-details-info.tsx`:
- Line 99: The component currently uses truthy checks like
value={deployment.latitude ? `${deployment.latitude}` : undefined} which treats
valid 0 coordinates as missing; update these checks (for deployment.latitude and
the other coordinate fields at the same block/lines 103-105) to explicitly test
for null/undefined (e.g. deployment.latitude != null ? `${deployment.latitude}`
: undefined or use String(deployment.latitude) with a nullish coalescing
fallback) so that 0 is preserved and only null/undefined render as missing.

In `@ui/src/pages/project/summary/deployments-map.tsx`:
- Around line 21-27: The filter currently uses truthy OR and drops valid zero
coordinates and allows one-sided coordinates; update the filtering on the
deployments array to require both latitude and longitude be present by using an
AND check and null/undefined-safe comparisons (e.g., check deployment.latitude
!= null && deployment.longitude != null) so 0 values are preserved, then
construct MarkerPosition(deployment.latitude, deployment.longitude) as before;
apply the same change to the second occurrence around the block that builds
marker tips (the other filter at lines referencing deployments and
MarkerPosition).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0d89010c-21fd-4920-a9d3-18c6e02bfee6

📥 Commits

Reviewing files that changed from the base of the PR and between aeb57c1 and 9c880bf.

📒 Files selected for processing (5)
  • ui/src/design-system/map/config.ts
  • ui/src/pages/deployment-details/deployment-details-info.tsx
  • ui/src/pages/project/summary/deployments-map.tsx
  • ui/src/pages/project/summary/summary.tsx
  • ui/src/utils/language.ts

<InputValue
label={translate(STRING.FIELD_LABEL_LATITUDE)}
value={`${deployment.latitude}`}
value={deployment.latitude ? `${deployment.latitude}` : undefined}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve 0 latitude/longitude when formatting values.

Line 99 and Lines 103-105 use truthy checks, so valid 0 coordinates are rendered as missing (n/a).

Proposed fix
-              value={deployment.latitude ? `${deployment.latitude}` : undefined}
+              value={
+                deployment.latitude != null
+                  ? `${deployment.latitude}`
+                  : undefined
+              }
...
-              value={
-                deployment.longitude ? `${deployment.longitude}` : undefined
-              }
+              value={
+                deployment.longitude != null
+                  ? `${deployment.longitude}`
+                  : undefined
+              }

Also applies to: 103-105

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/src/pages/deployment-details/deployment-details-info.tsx` at line 99, The
component currently uses truthy checks like value={deployment.latitude ?
`${deployment.latitude}` : undefined} which treats valid 0 coordinates as
missing; update these checks (for deployment.latitude and the other coordinate
fields at the same block/lines 103-105) to explicitly test for null/undefined
(e.g. deployment.latitude != null ? `${deployment.latitude}` : undefined or use
String(deployment.latitude) with a nullish coalescing fallback) so that 0 is
preserved and only null/undefined render as missing.

Comment on lines +21 to +27
deployments
.filter((deployment) => deployment.latitude || deployment.longitude)
.map((deployment) => ({
position: new MarkerPosition(
deployment.latitude,
deployment.longitude
),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix coordinate filtering to require both coordinates and keep 0 values.

Line 22 currently uses truthy OR, which drops valid 0 lat/lng and still allows one-sided coordinates through. That can produce invalid markers and incorrect tip visibility.

Proposed fix
-      deployments
-        .filter((deployment) => deployment.latitude || deployment.longitude)
+      deployments
+        .filter(
+          (deployment) =>
+            deployment.latitude != null && deployment.longitude != null
+        )
         .map((deployment) => ({

Also applies to: 33-35

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/src/pages/project/summary/deployments-map.tsx` around lines 21 - 27, The
filter currently uses truthy OR and drops valid zero coordinates and allows
one-sided coordinates; update the filtering on the deployments array to require
both latitude and longitude be present by using an AND check and
null/undefined-safe comparisons (e.g., check deployment.latitude != null &&
deployment.longitude != null) so 0 values are preserved, then construct
MarkerPosition(deployment.latitude, deployment.longitude) as before; apply the
same change to the second occurrence around the block that builds marker tips
(the other filter at lines referencing deployments and MarkerPosition).

@annavik annavik merged commit f4fb6f1 into main May 19, 2026
7 checks passed
@annavik annavik deleted the fix/filter-deployments branch May 19, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant