Skip to content

Make tour page weather section dynamic#8

Open
RuntaoZhuge wants to merge 3 commits into
mainfrom
claude/dynamic-tour-weather-section-011CUcf65p87dT48khiNEDJV
Open

Make tour page weather section dynamic#8
RuntaoZhuge wants to merge 3 commits into
mainfrom
claude/dynamic-tour-weather-section-011CUcf65p87dT48khiNEDJV

Conversation

@RuntaoZhuge

Copy link
Copy Markdown
Contributor
  • 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

- 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>
@netlify

netlify Bot commented Oct 30, 2025

Copy link
Copy Markdown

Deploy Preview for ailurowander ready!

Name Link
🔨 Latest commit c168da9
🔍 Latest deploy log https://app.netlify.com/projects/ailurowander/deploys/6902e64519293b0008c3ecdf
😎 Deploy Preview https://deploy-preview-8--ailurowander.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 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>
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