Skip to content

Update google-maps-search extension #17775

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

chrismessina
Copy link
Contributor

@chrismessina chrismessina commented Mar 12, 2025

Description

A significant update to the Google Maps extension, including support for AI Tools.

Screencast

2025-03-11.18.02.59.CleanShot.mp4

Changelog

Added

  • Added integration of Google Places API (which requires an API key)
  • Added "Copy Coordinates URL" feature that makes it easy to get coordinates for a location (#16136)
  • Added improved sorting options for nearby places (by proximity, rating, and price)
  • Added preference for unit system (imperial or metric)
  • Added persistent search settings via LocalStorage for better user experience
  • Added support for saving and removing recent searches
  • Added AI Tools to search places, get addresses and place details, and to show results on a map (works with @location)
  • Added dedicated utility files for better code organization:
    • use-geocoding.ts hook for centralized geocoding logic
    • validation.ts for form input validation
    • api-helpers.ts for standardized API request handling
    • storage-helpers.ts for robust LocalStorage operations
    • location-helpers.ts for location data handling
    • formatting.ts with comprehensive formatting utilities

Changed

  • Improved toast messages with clearer instructions and error handling
  • Consolidated place type management by creating ./src/types
  • Enhanced UI with better accessibility and more consistent icons
  • Improved distance calculation and formatting with proper unit system support
  • Optimized performance for place search results rendering
  • Improved autofill support and UI text (#5511) (#5690)
  • Improved type safety throughout the codebase:
    • Replaced any types with proper type definitions
    • Enhanced StorageValue type with recursive JSON-serializable definition
    • Added type predicates for runtime validation
  • Standardized error handling across all API requests and storage operations
  • Improved code formatting and organization with consistent style

Fixed

  • Fixed empty callback functions in navigation flow
  • Fixed issue with place details not loading correctly in some cases
  • Resolved inconsistent behavior when switching between search types

Checklist

- Fix linting issues: Remove empty arrow function and improve TypeScript types
- Fixed AI evals,
- Big changes including integration of the Google Places API and the addition of AI tools.
- Merge branch \'contributions/merge-1741737528976\'
- Pull contributions
- Big changes including integration of the Google Places API and the addition of AI tools.
- Added info about getting an API key
- ## [2.0] - 2025-03-07
- Initial commit
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: google-maps-search Issues related to the google-maps-search extension OP is contributor The OP of the PR is a contributor of the extension labels Mar 12, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Mar 12, 2025

Thank you for your contribution! 🎉

🔔 @ratoru @aeither @klaussner @krsntn you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

You can expect an initial review within five business days.

@chrismessina chrismessina marked this pull request as draft March 12, 2025 00:50
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Major update to the Google Maps Search extension adding Google Places API integration, AI tools, and enhanced search functionality with improved UI components.

  • Missing {PR_MERGE_DATE} template string in the latest CHANGELOG.md entry title ## [2.0] - 2025-03-11
  • launchCommand in travel-home.tsx needs to be wrapped in a try-catch block per Raycast guidelines
  • Since this PR has tools in package.json, it should also include ai with evals (already present)
  • Deeply nested navigation logic in nearby-places-search-form.tsx could be simplified to improve maintainability
  • Missing validation for radius input and error handling in search submission for nearby places functionality

💡 (3/5) Reply to the bot's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

30 file(s) reviewed, 60 comment(s)
Edit PR Review Bot Settings | Greptile

- Fix build errors and improve type safety
- Fixing @greptile-apps messages and improving code maintainability.
@LitoMore
Copy link
Contributor

As I mentioned in the Slack thread, could you please change the file name cases back?

Also, updating so many irrelevant files is not good for reviewers to review your code.

I appreciate your work and understanding.

@chrismessina
Copy link
Contributor Author

As I mentioned in the Slack thread, could you please change the file name cases back?

I've done that in 54dd7df (#17775).

Also, updating so many irrelevant files is not good for reviewers to review your code.

Can you clarify what you mean by "irrelevant"?

@chrismessina chrismessina marked this pull request as ready for review March 13, 2025 19:51
@LitoMore
Copy link
Contributor

LitoMore commented Mar 13, 2025

Can you clarify what you mean by "irrelevant"?

Files or code that are not relevant to the current work content. But I just realized your current PR updated most of the code. Then it should be fine.

Sorry for confusing you, in this case I think it's reasonable to change everything to camelCase.

@chrismessina
Copy link
Contributor Author

But I just realized your current PR updated most of the code. Then it should be fine.

Right — this is a major (breaking) update, integrating the Google Places API. I basically rewrote the whole thing (or at least directed Claude to do so!).

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This PR continues to improve the Google Maps Search extension with significant code organization and error handling enhancements.

  • Duplicate files with different naming conventions (e.g., nearbyPlacesSearchForm.tsx and nearby-places-search-form.tsx) should be consolidated to follow kebab-case convention
  • Several files have inconsistent error handling - recommend standardizing on showFailureToast from @raycast/utils throughout
  • The default search radius in unit-conversions.ts (50km/31mi) seems unusually large and should be reduced
  • The getUnitSystemForApi and getTravelModeForApi functions in unit-conversions.ts use unsafe type casting to unknown
  • Consider adding input validation for negative numbers in unit conversion functions

60 file(s) reviewed, 65 comment(s)
Edit PR Review Bot Settings | Greptile

- refactor: improve type system organization and remove redundancies
- refactor: improve type system organization and remove redundancies
@andreaselia
Copy link
Contributor

andreaselia commented Apr 26, 2025

Hey @chrismessina 👋

Awesome improvements! 🔥

CleanShot 2025-04-26 at 23 18 25@2x

What's going on here? I guess because of the rename and then rename again it may have kept the old files? 😄

@chrismessina
Copy link
Contributor Author

Hey @chrismessina 👋

Awesome improvements! 🔥

Thanks! :)

What's going on here? I guess because of the rename and then rename again it may have kept the old files? 😄

Yeah, I'm confused about this — and couldn't figure out how to clean it up! It seems like the files have been renamed successfully, but Git is confused about them.

What do you suggest?

@andreaselia
Copy link
Contributor

@chrismessina the easiest and quickest solution I can think of is moving the files to a directory outside of Git so it counts as deleting them, commit it, and then put the correct files back, and then another commit after that. What do you think?

@chrismessina
Copy link
Contributor Author

@chrismessina the easiest and quickest solution I can think of is moving the files to a directory outside of Git so it counts as deleting them, commit it, and then put the correct files back, and then another commit after that. What do you think?

I'll give it a try...!

@chrismessina chrismessina marked this pull request as draft April 28, 2025 18:33
- Add TODO
- Markdown linting
- Re-adding files to fix Git issues.
- Pull contributions
- Trying to reset renamed files status.
- Pull contributions
@chrismessina
Copy link
Contributor Author

@andreaselia ok, I discovered the root of the issue... I needed to run this command:

npx @raycast/api@latest pull-contributions

That revealed the files that were not appearing locally and I was able to remove them. Should be set for review now!

@chrismessina chrismessina marked this pull request as ready for review April 29, 2025 01:01
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

Based on the latest changes since the previous reviews, here's my summary of the key updates:

Major update to the Google Maps Search extension focusing on improved error handling, code organization, and type safety across utility functions and components.

  • Improved error handling in src/utils/apiHelpers.ts with detailed stack traces and standardized API request handling using showFailureToast
  • Enhanced storage utilities in src/utils/storageHelpers.ts with comprehensive type validation and batch operations support
  • Added new src/utils/mapRenderer.ts for handling static map generation with proper error handling and URL length limits
  • Added robust form validation in src/components/nearbyPlacesSearchForm.tsx with proper type checking and error messages
  • Improved distance calculations and unit conversions with proper constant definitions and type safety in src/utils/unitConversions.ts

The changes show good progress in standardizing error handling and improving type safety throughout the codebase. The focus has been on making the utilities more robust and maintainable.

38 file(s) reviewed, 26 comment(s)
Edit PR Review Bot Settings | Greptile

- Linted!
- Add type safety, error handling and improve formatting based on greptile comments
@chrismessina
Copy link
Contributor Author

Arggh, this is killing me! How do I get rid of these kabob files??

@LitoMore
Copy link
Contributor

LitoMore commented Apr 29, 2025

Hi @chrismessina. You can use GitHub's VS Code Web Editor to delete them. Simply press the . key on this page to open the editor.

@andreaselia
Copy link
Contributor

andreaselia commented Apr 29, 2025

Hey @chrismessina, I've deleted the kebab files. I think there may be a small bug with the publish script at the moment which makes it a little more difficult to delete files from git locally when using it.

@andreaselia andreaselia self-assigned this Apr 30, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This PR continues to enhance the Google Maps Search extension with improved code organization and error handling.

  • Improved error handling in findNearbyPlaces.ts and searchPlaces.ts with proper showFailureToast implementation and API key validation
  • Added new mapRenderer.ts utility with support for multiple places, colored markers, and URL length handling
  • Improved type safety in locationHelpers.ts with function overloading for formatLocation and consistent parameter naming
  • Consolidated storage operations in storageHelpers.ts with enhanced type validation and batch operations
  • Added comprehensive unit conversion constants and improved type safety in unitConversions.ts

The changes show good progress in standardizing error handling and improving type safety across the codebase.

60 file(s) reviewed, 25 comment(s)
Edit PR Review Bot Settings | Greptile

@pernielsentikaer
Copy link
Collaborator

I'm also getting errors with Find Nearby Places, can you see if you can figure out what's going on @chrismessina

11:20:44 Geocoding place: "xxx 8920 Randers"
11:20:44 Geocoding "xxx, 8920 Randers" without bias
11:20:44 Error during geocoding for address xxx, 8920 Randers: AxiosError: Request failed with status code 403
    at settle (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:25527:16)
    at /Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:25544:11
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at Axios.request (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:21990:45)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async geocodeAddress (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26173:22)
    at async geocodePlace (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26271:20)
    at async getSearchLocation (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26387:24)
    at async /Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26337:32
    at async Object.handleSubmit (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26990:22)
    at async /Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:6367:24
    at async /Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:19:5483 {
  code: 'ERR_BAD_REQUEST',
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [Function (anonymous)],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 10000,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',<…>
11:20:44 Geocoding failed for "xxx, 8920 Randers", trying search API instead
11:20:44 Error searching for places: AxiosError: Request failed with status code 403
    at settle (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:25527:16)
    at /Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:25544:11
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at Axios.request (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:21990:45)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async searchPlaces (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26046:22)
    at async geocodePlace (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26290:27)
    at async getSearchLocation (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26387:24)
    at async /Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26337:32
    at async Object.handleSubmit (/Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:26990:22)
    at async /Users/pernielsentikaer/.config/raycast/extensions/google-maps-search/findNearbyPlaces.js:6367:24
    at async /Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:19:5483 {
  code: 'ERR_BAD_REQUEST',
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [Function (anonymous)],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 10000,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyL<…>
11:20:44 No results found for "xxx, 8920 Randers"
´``

Are we missing something here @chrismessina 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Extension extension fix / improvement Label for PRs with extension's fix improvements extension: google-maps-search Issues related to the google-maps-search extension OP is contributor The OP of the PR is a contributor of the extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants