Skip to content

feat(website/matchers): add @format annotations to Location matcher#84

Merged
guitavano merged 1 commit into
mainfrom
guitavano/location-matcher
Jul 1, 2026
Merged

feat(website/matchers): add @format annotations to Location matcher#84
guitavano merged 1 commit into
mainfrom
guitavano/location-matcher

Conversation

@guitavano

@guitavano guitavano commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add @format map to Map.coordinates in website/matchers/location.ts so the Studio's existing MapField widget renders instead of a plain text input. The underlying string format (lat,lng,radius) is unchanged.
  • Add @format location on the Location interface itself (not per prop) so a future Studio widget can render city / regionCode / country as a cohesive picker rather than three loose text inputs.

No runtime change — matcher logic and expected data shapes are untouched. Existing configured values keep working.

Context

Today the location matcher exposes three fields (city, regionCode, country) that the admin has to fill by hand:

  • country: ISO 3166-1 alpha-2 (BR, US, ...) — known finite list from Cloudflare's cf-ipcountry.
  • regionCode: subdivision suffix from cf-region-code (e.g. SP for BR-SP).
  • city: free-text city name from cf-ipcity — encoding-sensitive, matched by string equality.

Free text inputs make it easy to typo values that will silently never match. This PR annotates the type so the Studio can render a purpose-built widget when one lands.

Widget rendering in the Studio is dispatched by schema.format in apps/mesh/src/web/components/sections-editor/schema-form.tsx — a follow-up PR on the Studio side will add the location case.

Test plan

  • Existing usages with Map.coordinates still accept lat,lng,radius strings unchanged.
  • Existing Location values (city / regionCode / country) round-trip through the CMS admin.
  • MapField renders on Map.coordinates in the Studio admin.
  • Location field falls back to default rendering until the Studio-side widget lands (no visible regression yet).

🤖 Generated with Claude Code


Summary by cubic

Add @Format map to Map.coordinates so the Studio renders the MapField widget instead of a text input, keeping the "lat,lng,radius" string format. Tag the Location interface with @Format location to enable a future unified picker for city/regionCode/country; no runtime changes.

Written for commit ff2b6cc. Summary will update on new commits.

Review in cubic

Wire up @Format map on Map.coordinates so the Studio renders MapField
(the widget already exists at schema-form.tsx). Also tag the Location
interface with @Format location so a future Studio widget can render
city/regionCode/country as a single friendly picker.

No runtime behavior change; existing lat,lng,radius string values are
preserved.
@guitavano
guitavano requested a review from a team July 1, 2026 13:23

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@guitavano
guitavano merged commit 7eb6f4b into main Jul 1, 2026
2 checks passed
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 5.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants