Changement homepage

This commit is contained in:
Mathis 2025-04-13 21:16:31 +02:00
parent bc5107152b
commit 462fc28f2c

View File

@ -31,7 +31,8 @@ function EnhancedWeatherHome() {
const [currentTime, setCurrentTime] = useState(new Date()); const [currentTime, setCurrentTime] = useState(new Date());
const { user, token } = useAuth(); const { user, token } = useAuth();
const [ville, setVille] = useState("Paris, France"); const [ville, setVille] = useState("Paris, France");
const isDayTime = currentTime.getHours() > 6 && currentTime.getHours() < 20; const heure = currentTime.getHours();
const isDayTime = heure > 6 && heure < 20;
useEffect(() => { useEffect(() => {
const timer = setInterval(() => { const timer = setInterval(() => {
@ -80,34 +81,38 @@ function EnhancedWeatherHome() {
return date.toLocaleDateString("fr-FR", options); return date.toLocaleDateString("fr-FR", options);
}; };
const formatHeure = (h) => {
const heureFormatee = (h % 24).toString().padStart(2, "0"); // 0 00, 3 03, etc.
return `${heureFormatee}:00`;
};
const hourlyForecast = [ const hourlyForecast = [
{ {
time: "Maintenant", time: "Maintenant",
temp: infoMeteo.temperature+"°",
icon: <Cloud className="text-indigo-500" size={24} />,
},
{
time: "14:00",
temp: "22°", temp: "22°",
icon: <Cloud className="text-indigo-500" size={24} />, icon: <Cloud className="text-indigo-500" size={24} />,
}, },
{ {
time: "15:00", time: formatHeure(heure + 1),
temp: "22°",
icon: <Cloud className="text-indigo-500" size={24} />,
},
{
time: formatHeure(heure + 2),
temp: "22°", temp: "22°",
icon: <Sun className="text-yellow-500" size={24} />, icon: <Sun className="text-yellow-500" size={24} />,
}, },
{ {
time: "16:00", time: formatHeure(heure + 3),
temp: "21°", temp: "21°",
icon: <Sun className="text-yellow-500" size={24} />, icon: <Sun className="text-yellow-500" size={24} />,
}, },
{ {
time: "17:00", time: formatHeure(heure + 4),
temp: "20°", temp: "20°",
icon: <CloudRain className="text-blue-500" size={24} />, icon: <CloudRain className="text-blue-500" size={24} />,
}, },
{ {
time: "18:00", time: formatHeure(heure + 5),
temp: "19°", temp: "19°",
icon: <CloudRain className="text-blue-500" size={24} />, icon: <CloudRain className="text-blue-500" size={24} />,
}, },
@ -169,9 +174,6 @@ function EnhancedWeatherHome() {
<> <>
<div className="absolute top-10 right-14 w-20 h-20 rounded-full bg-gray-200 blur-lg opacity-70"></div> <div className="absolute top-10 right-14 w-20 h-20 rounded-full bg-gray-200 blur-lg opacity-70"></div>
<div className="absolute top-14 right-10 w-14 h-14 rounded-full bg-gray-900 blur-sm"></div> <div className="absolute top-14 right-10 w-14 h-14 rounded-full bg-gray-900 blur-sm"></div>
<div className="absolute top-20 left-1/4 w-2 h-2 rounded-full bg-white blur-none opacity-90"></div>
<div className="absolute top-40 left-1/3 w-1 h-1 rounded-full bg-white blur-none opacity-90"></div>
<div className="absolute top-14 left-1/2 w-2 h-2 rounded-full bg-white blur-none opacity-90"></div>
</> </>
)} )}
</div> </div>