Make tour page weather section dynamic#8
Open
RuntaoZhuge wants to merge 3 commits into
Open
Conversation
- Created new /api/weather endpoint that fetches climate data based on city - Integrated Open-Meteo API for geocoding and historical weather data - Added fallback city coordinates for 13 common Chinese destinations - Added fallback climate data for 8 major cities when API is unavailable - Updated BestTravelTime component to dynamically fetch weather from API - Weather data now automatically loads based on tour.destination from database - Improved error handling with graceful fallbacks to static data The weather section is now fully dynamic and picks city data from the tour destination field in the database, while maintaining reliability through intelligent fallback mechanisms. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for ailurowander ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Added extractPrimaryCity() function to parse multi-city destinations - Intelligently matches against known cities (handles "Hong Kong", etc.) - Falls back to first word for unknown multi-city strings - Now correctly handles destinations like "Beijing Xi'an Leshan Mount Emei Chengdu" - Tested with various multi-city combinations Fixes issue where weather API failed with multi-city destination strings from the database. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added a dedicated optional weatherCity field to the Tour schema, giving admins precise control over which city's weather to display, independent of the multi-city destination field. Changes: - Added weatherCity field to Tour and TourFormData interfaces - Updated tour create/edit forms with new weatherCity input field - Added English and Chinese translations for weather city labels - Updated tour create and update API endpoints to handle weatherCity - Modified BestTravelTime component to prioritize weatherCity over destination - Falls back to destination if weatherCity is not specified Benefits: - Admins can now specify exact city for weather (e.g., "Beijing" for "Beijing Xi'an Leshan Mount Emei Chengdu" tours) - Backward compatible - existing tours work with destination fallback - Optional field - no validation required - Multi-language support included 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The weather section is now fully dynamic and picks city data from the tour destination field in the database, while maintaining reliability through intelligent fallback mechanisms.
🤖 Generated with Claude Code