Skip to content

Commit

Permalink
Merge pull request #8 from smdthiranjaya/dev
Browse files Browse the repository at this point in the history
Clean modification
  • Loading branch information
smdthiranjaya authored Apr 6, 2024
2 parents a634196 + 0344a73 commit 5d07086
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function App() {
// Use the Router component to enable routing within the app
<Router>
<Routes>
// Define the Routes for your application
<Route path="/" element={<WeatherPage />} />
{}
</Routes>
Expand Down
3 changes: 0 additions & 3 deletions src/components/MapComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const MapComponent = ({ weatherData }) => {
// Return JSX for rendering the map
return (
<MapContainer center={[7.8731, 80.7718]} zoom={8} style={{ height: "700px", width: "700px" }}>
// Add a TileLayer to the map with OpenStreetMap tiles
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
// Iterate over weatherData to create markers for each data point
{weatherData.map(({ id, city, lat, lng, temperature, humidity, airPressure, wind_speed, weatherDescriptions, observationTime, weatherIcons, isDay }) => {
const dynamicIcon = new L.Icon({
iconUrl: weatherIcons,
Expand All @@ -24,7 +22,6 @@ const MapComponent = ({ weatherData }) => {
// Render a Marker for each weather data point with a dynamic icon
return (
<Marker key={id} position={[lat, lng]} icon={dynamicIcon}>
// Display a Popup with weather and city details for each marker
<Popup>
<strong>{city} <img src={markerIcon} alt="weather icon" style={{ width: "20px" }} /> </strong><br /><br />
Daytime: {isDay ? 'Yes' : 'No'}<br />
Expand Down
5 changes: 1 addition & 4 deletions src/pages/WeatherPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const WeatherPage = () => {
};

fetchWeatherData();

// Set an interval to refresh weather data every 5 minutes
const interval = setInterval(fetchWeatherData, 300000);

Expand All @@ -111,7 +111,6 @@ const WeatherPage = () => {
// Render the WeatherPage component with weather statistics, map, and subscription form
return (
<div className="weather-page-container">
// Display the app logo and header
<div className="page-header">
<img src={logo} alt="Logo" className="logo" />
<h1>Geo 360 Live</h1>
Expand Down Expand Up @@ -144,11 +143,9 @@ const WeatherPage = () => {
<p><span role="img" aria-label="Average">🔍</span> Avg: {weatherStats.windSpeed.avg.toFixed(1)}</p>
</div>
</div>
// Display weather statistics and a map with weather data markers
<div className="weather-data" style={{ flex: 1 }}>
<MapComponent weatherData={weatherData} />
</div>
// Subscription form for weather updates
<div className="content-container" style={{ display: 'flex', justifyContent: 'space-between' }}>
<div className="weather-stats2">
<h2>Subscribe to Weather Updates</h2>
Expand Down

0 comments on commit 5d07086

Please sign in to comment.