From b1ed7f8eb433ea86ab7ef48ec9bf5619dedbd250 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Fri, 15 Aug 2025 08:31:42 +0000 Subject: [PATCH] Improve weather display with visual icons and modern styling Enhance the WeatherWidget component by introducing detailed weather condition icons and updating the card's background and text styling for a more modern and informative presentation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/RAXplX4 --- client/src/components/WeatherWidget.tsx | 150 +++++++++++++++++------- cookies.txt | 2 +- 2 files changed, 111 insertions(+), 41 deletions(-) diff --git a/client/src/components/WeatherWidget.tsx b/client/src/components/WeatherWidget.tsx index 8fb3d15..38586e6 100644 --- a/client/src/components/WeatherWidget.tsx +++ b/client/src/components/WeatherWidget.tsx @@ -1,5 +1,5 @@ import { useQuery } from "@tanstack/react-query"; -import { Cloud, CloudRain, Sun, CloudSnow, ThermometerSun } from "lucide-react"; +import { Cloud, CloudRain, Sun, CloudSnow, ThermometerSun, CloudDrizzle, Wind, Zap, Eye } from "lucide-react"; import { Card, CardContent } from "@/components/ui/card"; interface WeatherData { @@ -21,22 +21,53 @@ interface WeatherResponse { location: string; } -const WeatherIcon = ({ condition, size = 16 }: { condition: string; size?: number }) => { +const WeatherIcon = ({ condition, size = 20 }: { condition: string; size?: number }) => { const iconClass = `h-${Math.floor(size/4)} w-${Math.floor(size/4)}`; + const conditionLower = condition.toLowerCase(); - if (condition.includes('rain') || condition.includes('pluie')) { - return ; + // Conditions pluvieuses + if (conditionLower.includes('rain') || conditionLower.includes('pluie') || conditionLower.includes('shower')) { + if (conditionLower.includes('heavy') || conditionLower.includes('forte')) { + return ; + } + return ; } - if (condition.includes('snow') || condition.includes('neige')) { - return ; + + // Conditions neigeuses + if (conditionLower.includes('snow') || conditionLower.includes('neige') || conditionLower.includes('blizzard')) { + return ; } - if (condition.includes('cloud') || condition.includes('nuage')) { - return ; + + // Orages + if (conditionLower.includes('thunder') || conditionLower.includes('storm') || conditionLower.includes('orage')) { + return ; } - if (condition.includes('sun') || condition.includes('soleil') || condition.includes('clear')) { - return ; + + // Brouillard + if (conditionLower.includes('fog') || conditionLower.includes('mist') || conditionLower.includes('brouillard')) { + return ; } - return ; + + // Vent + if (conditionLower.includes('wind') || conditionLower.includes('vent')) { + return ; + } + + // Nuageux + if (conditionLower.includes('cloud') || conditionLower.includes('nuage') || conditionLower.includes('overcast')) { + if (conditionLower.includes('partly') || conditionLower.includes('partial')) { + return ; + } + return ; + } + + // Ensoleillé + if (conditionLower.includes('sun') || conditionLower.includes('soleil') || conditionLower.includes('clear') || conditionLower.includes('fair')) { + return ; + } + + // Par défaut + return ; }; export default function WeatherWidget() { @@ -48,13 +79,13 @@ export default function WeatherWidget() { if (isLoading) { return ( - +
- +
- Chargement météo... + Chargement météo...
@@ -69,40 +100,79 @@ export default function WeatherWidget() { const previousTemp = weather.previousYear?.maxTemperature; const location = weather.location || "Nancy"; + const tempDifference = currentTemp !== undefined && previousTemp !== undefined + ? currentTemp - previousTemp : 0; + return ( - - -
-
- - - {location.split(',')[0]} - + + +
+ {/* Icône et localisation */} +
+
+ +
+
+ + {location.split(',')[0]} + + + {weather.currentYear?.condition || 'Inconnu'} + +
-
-
- {currentTemp !== undefined ? `${Math.round(currentTemp)}°` : '--°'} + {/* Températures actuelles */} +
+
+
+ {currentTemp !== undefined ? `${Math.round(currentTemp)}°` : '--°'} +
+
+ Aujourd'hui +
+ {/* Comparaison avec l'an dernier */} {previousTemp !== undefined && ( -
- (l'an dernier: {Math.round(previousTemp)}°) -
+ <> +
+
+
+ {Math.round(previousTemp)}° +
+
+ Année dernière +
+
+ + )} + + {/* Différence */} + {currentTemp !== undefined && previousTemp !== undefined && ( + <> +
+
+ {tempDifference > 0 ? ( +
+ ↗ + +{Math.round(tempDifference)}° +
+ ) : tempDifference < 0 ? ( +
+ ↘ + {Math.round(tempDifference)}° +
+ ) : ( +
+ = + 0° +
+ )} +
+ )}
- - {currentTemp !== undefined && previousTemp !== undefined && ( -
- {currentTemp > previousTemp ? ( - ↑{Math.round(currentTemp - previousTemp)}° - ) : currentTemp < previousTemp ? ( - ↓{Math.round(previousTemp - currentTemp)}° - ) : ( - = - )} -
- )}
diff --git a/cookies.txt b/cookies.txt index b79335b..848ce08 100644 --- a/cookies.txt +++ b/cookies.txt @@ -2,4 +2,4 @@ # https://curl.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. -#HttpOnly_localhost FALSE / FALSE 1755332748 connect.sid s%3ATGkcy9eVr4-9HEcJjuFU9AZrRq4VYOLY.TsQjtj4uhpU1n9T1IDgVMkeiQAi8SdziEoQFRooTS8w +#HttpOnly_localhost FALSE / FALSE 1755333079 connect.sid s%3AbjMXkzE6NhLQi9NDEZUo7pvMFS4DXv9P.VCGzsu6itHxj7mQrVuphPXAS0qYDmuEdVRtZFRFvM5s