diff --git a/dashboard/src/components/dashboard/Header.jsx b/dashboard/src/components/dashboard/Header.jsx index 6a56fc9..45cc8b4 100644 --- a/dashboard/src/components/dashboard/Header.jsx +++ b/dashboard/src/components/dashboard/Header.jsx @@ -16,6 +16,14 @@ import { Haze, Moon, Monitor, + Wind, + Droplets, + ThermometerSun, + ThermometerSnowflake, + Sunrise, + Sunset, + AlertTriangle, + Umbrella, } from "lucide-react"; import { useScroll } from "@/contexts/ScrollContext"; import { useTheme } from "@/components/theme/ThemeProvider"; @@ -26,6 +34,12 @@ import { TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { Alert, AlertDescription } from "@/components/ui/alert"; const CraftsIcon = () => (
+
+ +
+ +
+ High + {Math.round(weather.main.temp_max)}°F +
+
+
+ + +
+ +
+ Low + {Math.round(weather.main.temp_min)}°F +
+
+
+ + +
+ +
+ Humidity + {weather.main.humidity}% +
+
+
+ + +
+ +
+ Wind + {Math.round(weather.wind.speed)} mph +
+
+
+ + +
+ +
+ Sunrise + {formatTime(weather.sys?.sunrise)} +
+
+
+ + +
+ +
+ Sunset + {formatTime(weather.sys?.sunset)} +
+
+
+
+ + {forecast && ( +
+
+ {forecast.map((day, index) => ( + +
+ + {new Date(day.dt * 1000).toLocaleDateString('en-US', { weekday: 'short' })} + + {getWeatherIcon(day.weather[0].id, new Date(day.dt * 1000), true)} +
+ + {Math.round(day.main.temp_max)}° + + + {Math.round(day.main.temp_min)}° + +
+
+ {day.rain?.['3h'] > 0 && ( +
+ + {day.rain['3h'].toFixed(2)}" +
+ )} + {day.snow?.['3h'] > 0 && ( +
+ + {day.snow['3h'].toFixed(2)}" +
+ )} + {!day.rain?.['3h'] && !day.snow?.['3h'] && ( +
+ + 0" +
+ )} +
+
+
+ ))} +
+
+ )} +
+ ); + const formatDate = (date) => date.toLocaleDateString("en-US", { weekday: "short", @@ -125,6 +277,15 @@ const Header = () => { day: "numeric", }); + const formatTimeDisplay = (date) => { + const hours = date.getHours(); + const minutes = String(date.getMinutes()).padStart(2, "0"); + const seconds = String(date.getSeconds()).padStart(2, "0"); + const period = hours >= 12 ? "PM" : "AM"; + const displayHours = hours % 12 || 12; + return `${displayHours}:${minutes}:${seconds} ${period}`; + }; + return ( { )} > - {" "} +

@@ -158,14 +319,32 @@ const Header = () => { {weather?.main && ( <>
-
- {getWeatherIcon(weather.weather[0]?.id, currentTime)} -
-

- {Math.round(weather.main.temp)}° F -

-
-
+ + +
+ {getWeatherIcon(weather.weather[0]?.id, currentTime)} +
+

+ {Math.round(weather.main.temp)}° F +

+
+ {weather.alerts && ( + + )} +
+
+ + {weather.alerts && ( + + + + {weather.alerts[0].event} + + + )} + + +
)} @@ -183,7 +362,7 @@ const Header = () => {

- {formatTime(currentTime)} + {formatTimeDisplay(currentTime)}