Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: simplify props related to configuring basemap layers #476

Merged
merged 3 commits into from
Aug 24, 2024

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Aug 19, 2024

Follow-up per #475 (comment) & #473 (and working towards a stable release to support MapAndLabel in Planx!)

Key changes:

  • Introduces basemap prop with enum values "OSVectorTile" (default) | "OSRaster" | "MapboxSatellite" | "OSM"
    • Therefore deprecating disableVectorTiles and applySatelliteStyle
  • Simplifies all OS API key props into osApiKey (across map and address-autocomplete components)
    • Therefore deprecating osVectorTilesApiKey, osFeaturesApiKey, osPlacesApiKey
  • Updates osCopyright default string to no longer use our license number 🙈
  • Refactors os-layers.ts (renaming file to layers.ts since now OSM & Mapbox too) & adds more complete test coverage

Copy link

netlify bot commented Aug 19, 2024

Deploy Preview for oslmap ready!

Name Link
🔨 Latest commit 200c7d9
🔍 Latest deploy log https://app.netlify.com/sites/oslmap/deploys/66c3656a5e95a60008008139
😎 Deploy Preview https://deploy-preview-476--oslmap.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

source.getUrls()?.forEach((url) => expect(url).toMatch(/api.os.uk/));
});

it.skip("loads MapboxSatellite basemap when a Mapbox access token is provided", async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

See @todo comment in layers.ts - can't quite figure out how to set a custom property on a VectorLayer specifically! Not throwing any openlayer type errors, but also not coming through in the layer markup.

Feature working as expected, just relying on name for test-ability!

Copy link
Contributor

Choose a reason for hiding this comment

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

Tricky one! I'd try logging out getAllLayers() and check we're not falling back to OSM here for some reason related to our testing setup. Sure you've tried this! Happy to take a closer look if this still doesn't narrow things down.

@jessicamcinchak jessicamcinchak marked this pull request as ready for review August 19, 2024 15:46
@jessicamcinchak jessicamcinchak requested a review from a team August 19, 2024 15:46
Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

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

A few small comments / suggestions!

src/components/my-map/index.ts Show resolved Hide resolved
src/components/my-map/index.ts Show resolved Hide resolved
src/components/my-map/layers.ts Show resolved Hide resolved
source.getUrls()?.forEach((url) => expect(url).toMatch(/api.os.uk/));
});

it.skip("loads MapboxSatellite basemap when a Mapbox access token is provided", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tricky one! I'd try logging out getAllLayers() and check we're not falling back to OSM here for some reason related to our testing setup. Sure you've tried this! Happy to take a closer look if this still doesn't narrow things down.

@jessicamcinchak
Copy link
Member Author

Going to merge this one as-is for an 1.0.0-alpha pre-release - it's the consumer-facing props that we want! We can still keep improving test coverage and tweaking layer definitions in the background without changing props now.

@jessicamcinchak jessicamcinchak merged commit 8311b80 into main Aug 24, 2024
5 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/refactor-basemap-props branch August 24, 2024 10:46
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.

2 participants