feat: Add Nearby Places Locator#305
Conversation
jubnl
left a comment
There was a problem hiding this comment.
Front-end calls a new route /api/maps/nearby but this route does not currently exists, and the PR doesn't include the new backend route
|
I've changed the target to dev as we are changing the backend architecture. Can you please seek the conflict and resolve them ? I'd be happy to review your pr afterwards |
jubnl
left a comment
There was a problem hiding this comment.
Hey, I just checked the entire PR. In addition to the comments I made, can you please add translations for all supported languages instead of just German and English ?
| const [savingFileTypes, setSavingFileTypes] = useState<boolean>(false) | ||
|
|
||
| // Nearby places settings | ||
| const ALL_NEARBY_CATEGORIES = ['food', 'attractions', 'shopping', 'nightlife', 'outdoors', 'transport', 'services', 'accommodation'] |
There was a problem hiding this comment.
ALL_NEARBY_CATEGORIES defined inside AdminPage function body means that this is recreated on every render. Should be a module-level constant
| accommodation: { keywords: ['accommodation', 'hotel', 'hostel', 'lodging', 'unterkunft'], icon: 'BedDouble', color: '#0ea5e9', name: 'Accommodation' }, | ||
| }; | ||
|
|
||
| function resolveNearbyCategoryId(type: string): number | null { |
There was a problem hiding this comment.
resolveNearbyCategoryId runs a DB query on every nearby search, should be cached or moved outside
| reverse: (lat: number, lng: number, lang?: string) => apiClient.get('/maps/reverse', { params: { lat, lng, lang } }).then(r => r.data), | ||
| resolveUrl: (url: string) => apiClient.post('/maps/resolve-url', { url }).then(r => r.data), | ||
| nearby: (lat: number, lng: number, type: string, radius?: number, lang?: string) => | ||
| apiClient.post(`/maps/nearby?lang=${lang || 'en'}`, { lat, lng, type, radius }).then(r => r.data), |
There was a problem hiding this comment.
lang passed as query param despite being a POST, Should be in the request body or use params option like other API calls
This pull request introduces a new "Find Nearby" feature that allows users to search for and add places of interest near a selected location. The implementation includes a new modal for browsing nearby places, API integration, UI enhancements, and localization support. Additionally, admin settings are added to configure the categories and search parameters for this feature.
Nearby Places Feature Implementation:
NearbyPlacesModalcomponent that allows users to search for and add nearby places by category, with support for loading states, error handling, and multi-language labels.PlaceInspectorcomponent, including a new "Find Nearby" action button (with a radar icon) that appears when latitude and longitude are available. [1] [2] [3]mapsApiwith a newnearbymethod to fetch nearby places from the backend.Localization and UI Texts:
Admin Configuration:
These changes collectively add a user-friendly way to discover and add nearby places, with customizable settings and full localization support.