Create a weather dashboard application that displays weather information for different cities. The app should demonstrate understanding of Next.js fundamentals, data manipulation, and component architecture.
-
City Overview Page (
/app/page.js
)- Display a grid of city weather cards
- Each card should show:
- City name
- Current temperature
- Weather condition (Sunny, Rainy, etc.)
- Min/Max temperature
- Last updated timestamp
-
City Detail Page (
/app/cities/[cityId]/page.js
)- Show detailed weather information including:
- Hourly forecast (next 24 hours)
- Wind speed and direction
- Humidity
- Pressure
- Visibility
- Interactive temperature graph
- Show detailed weather information including:
-
Favorites System (
/app/components/FavoriteManager.js
)- Allow users to mark cities as favorites
- Implement client-side storage using localStorage
- Create a separate favorites view
-
Unit Converter Component (
/app/components/UnitConverter.js
)- Toggle between Celsius and Fahrenheit
- Store user preference
- Update all temperature displays accordingly
// /app/data/weatherData.js
export const weatherData = [
{
cityId: "NYC",
name: "New York",
current: {
temp: 22,
condition: "Partly Cloudy",
humidity: 65,
windSpeed: 12,
pressure: 1015,
visibility: 10
},
hourly: [
{
time: "12:00",
temp: 22,
condition: "Partly Cloudy"
},
{
time: "13:00",
temp: 23,
condition: "Sunny"
},
// ... more hourly data
],
forecast: {
maxTemp: 25,
minTemp: 18,
sunrise: "06:30",
sunset: "20:15"
}
},
{
cityId: "LON",
name: "London",
current: {
temp: 18,
condition: "Rainy",
humidity: 75,
windSpeed: 15,
pressure: 1012,
visibility: 8
},
hourly: [
{
time: "12:00",
temp: 18,
condition: "Rainy"
},
{
time: "13:00",
temp: 19,
condition: "Cloudy"
},
// ... more hourly data
],
forecast: {
maxTemp: 20,
minTemp: 15,
sunrise: "05:45",
sunset: "21:00"
}
}
]
- Use Next.js 14 with App Router
- Implement a responsive layout using Tailwind CSS
- Use client-side state management (React Context or similar)
- Create custom hooks for data manipulation
- Implement error boundaries
- Add loading states and skeletons
- Use proper TypeScript types (optional but recommended)
-
WeatherCard (
/app/components/WeatherCard.js
)- Reusable component for displaying weather information
- Should handle different weather conditions
- Include loading state
-
Graph Component (
/app/components/TemperatureGraph.js
)- Display temperature trends
- Include tooltips for data points
- Handle different time ranges
-
Layout Component (
/app/components/Layout.js
)- Include header with navigation
- Implement responsive sidebar for favorites
- Add footer with unit toggle
-
Component Architecture
- Proper component composition
- State management approach
- Code reusability
-
Next.js Features
- Effective use of App Router
- Dynamic routes implementation
- Loading and error states
-
Data Handling
- State updates and propagation
- Local storage implementation
- Unit conversion logic
-
UI/UX Implementation
- Responsive design
- Interactive elements
- Loading states and transitions
- Error handling
-
Code Quality
- Clean code principles
- TypeScript usage (if chosen)
- Comments and documentation