This commit is contained in:
Sean Edmunds
2025-04-15 20:21:25 -05:00
parent 2e72b76e95
commit 78dec160b6
34 changed files with 225 additions and 466 deletions

View File

@@ -2,6 +2,7 @@ import { Group, Stack, Text } from '@mantine/core';
import { useCommonHooks } from 'hooks';
import { useEffect, useState } from 'react';
import { textClasses } from 'styles';
import type { CurrentWeather as CW } from 'types';
function Header({
greet,
@@ -11,7 +12,15 @@ function Header({
weather,
basicWeather,
openWeatherModal,
}: any) {
}: {
greet: string;
date: string;
current: CW;
setCurrent: (current: CW) => void;
weather: any;
basicWeather: any;
openWeatherModal: () => void;
}) {
const [time, setTime] = useState(new Date());
const { isMobile, currentUser, fixDigits } = useCommonHooks();
@@ -25,7 +34,7 @@ function Header({
useEffect(() => {
if (weather !== undefined && basicWeather !== undefined) {
setCurrent({
icon: weather.features[0]?.properties.icon?.replace('medium', 'large') || '',
icon: weather.features[0]?.properties.icon?.replace('medium', 'large') ?? '',
textDescription: weather.features[0]?.properties.textDescription,
temperature: Math.round(
(weather.features[0]?.properties.temperature.value * 9) / 5 + 32,
@@ -37,7 +46,7 @@ function Header({
(basicWeather.properties.minTemperature.values[0].value * 9) / 5 + 32,
),
precipitation:
weather.features[0]?.properties.precipitationLastHour.value || 'N/A',
weather.features[0]?.properties.precipitationLastHour.value ?? 'N/A',
humidity: Math.round(weather.features[0]?.properties.relativeHumidity.value),
heatIndex:
basicWeather.properties.heatIndex?.values[0].value === null
@@ -128,17 +137,17 @@ function Header({
>
<Text
component='h2'
mr={4}
className={textClasses.dateTime}
classNames={textClasses}
mr={4}
>
{current.temperature}°F
</Text>
<Text
mb={6}
className={textClasses.dateTime}
classNames={textClasses}
fz={14}
mb={6}
>
{current.highTemp}°F/{current.lowTemp}°F
</Text>