Bug fix
All checks were successful
Deploy to production / build (push) Successful in 11s

This commit is contained in:
Sean Edmunds
2026-07-14 16:50:33 -05:00
parent 78d887de9a
commit b8eedde727
3 changed files with 37 additions and 18 deletions

View File

@@ -1,11 +1,18 @@
import { Box, Card, Group, Stack, Text } from '@mantine/core'; import { ActionIcon, Box, Card, Group, Stack, Text } from '@mantine/core';
import { FaArrowDown, FaArrowUp, FaLocationArrow, FaSun, FaWind } from 'react-icons/fa'; import { FaArrowDown, FaArrowUp, FaLocationArrow, FaSun, FaWind } from 'react-icons/fa';
import { FaX } from 'react-icons/fa6';
import { WiRain, WiSunrise, WiSunset } from 'react-icons/wi'; import { WiRain, WiSunrise, WiSunset } from 'react-icons/wi';
import { WeatherCodes } from 'types'; import { WeatherCodes } from 'types';
import WeatherFeaturePill from './WeatherFeaturePill'; import WeatherFeaturePill from './WeatherFeaturePill';
import WeatherIcon from './WeatherIcon'; import WeatherIcon from './WeatherIcon';
export default function ExtendedForecastDetails({ selectedDay }: { selectedDay: any }) { export default function ExtendedForecastDetails({
selectedDay,
setSelectedDay,
}: {
selectedDay: any;
setSelectedDay: (day: any) => void;
}) {
return ( return (
<Card <Card
h={'100%'} h={'100%'}
@@ -15,6 +22,7 @@ export default function ExtendedForecastDetails({ selectedDay }: { selectedDay:
backgroundColor: 'var(--mantine-color-background-0)', backgroundColor: 'var(--mantine-color-background-0)',
padding: '1rem', padding: '1rem',
borderRadius: '8px', borderRadius: '8px',
overflow: 'visible',
}} }}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@@ -22,17 +30,32 @@ export default function ExtendedForecastDetails({ selectedDay }: { selectedDay:
shadow='xl' shadow='xl'
p={0} p={0}
> >
<ActionIcon
pos={'absolute'}
top={-12}
right={-12}
style={{
borderRadius: '100%',
}}
onClick={() => {
setSelectedDay(undefined);
}}
>
<FaX />
</ActionIcon>
<Group <Group
w={'100%'} w={'100%'}
justify='center' justify='center'
bg={'var(--mantine-color-search-0)'} bg={'var(--mantine-color-search-0)'}
p={0} py={4}
mt={0} mt={0}
> >
<Text fz={'1.5rem'}> <Text fw={600} fz={'1.5rem'}>
{selectedDay.time.toLocaleDateString('en-US', { weekday: 'long' })} {selectedDay.time.toLocaleDateString('en-US', { weekday: 'long' })}
</Text> </Text>
<Text fz={'1.5rem'}>{selectedDay.time.toLocaleDateString()}</Text> <Text fw={600} fz={'1.5rem'}>
{selectedDay.time.toLocaleDateString()}
</Text>
</Group> </Group>
<Stack align='center' p={16}> <Stack align='center' p={16}>
<WeatherIcon size={'xl'} code={selectedDay.weatherCode} /> <WeatherIcon size={'xl'} code={selectedDay.weatherCode} />

View File

@@ -29,7 +29,7 @@ export default function WeatherGraphs({ hourly }: { hourly: Hourly | undefined }
return { return {
dewpoint: hourly.dew_point_2m?.[index].toFixed(0), dewpoint: hourly.dew_point_2m?.[index].toFixed(0),
isDaytime: hourly.is_day?.[index], isDaytime: hourly.is_day?.[index],
name: hourly.time[index], name: hourly.time[index].toLocaleString('en-us'),
startTime: hourly.time[index], startTime: hourly.time[index],
endTime: hourly.time[index + 1], endTime: hourly.time[index + 1],
probabilityOfPrecipitation: hourly.precipitation_probability?.[index], probabilityOfPrecipitation: hourly.precipitation_probability?.[index],
@@ -39,7 +39,6 @@ export default function WeatherGraphs({ hourly }: { hourly: Hourly | undefined }
}; };
}) })
.filter((hour: any) => hour.startTime > now && hour.startTime < later); .filter((hour: any) => hour.startTime > now && hour.startTime < later);
return ( return (
<Stack <Stack
style={{ style={{
@@ -65,8 +64,8 @@ export default function WeatherGraphs({ hourly }: { hourly: Hourly | undefined }
data={[ data={[
{ value: 12, label: '12 hours' }, { value: 12, label: '12 hours' },
{ value: 24, label: '24 hours' }, { value: 24, label: '24 hours' },
{ value: 28, label: '2 days' }, { value: 48, label: '2 days' },
{ value: 48, label: '3 days' }, { value: 72, label: '3 days' },
{ value: 168, label: '7 days' }, { value: 168, label: '7 days' },
]} ]}
onChange={(value: any) => setTimeFrame(value)} onChange={(value: any) => setTimeFrame(value)}
@@ -78,10 +77,7 @@ export default function WeatherGraphs({ hourly }: { hourly: Hourly | undefined }
type='category' type='category'
stroke={'var(--mantine-color-primary-0)'} stroke={'var(--mantine-color-primary-0)'}
dataKey={(data) => { dataKey={(data) => {
return new Date(data.startTime).toLocaleTimeString('en-US', { return new Date(data.startTime).toLocaleString('en-US');
hour: 'numeric',
minute: 'numeric',
});
}} }}
/> />
<YAxis <YAxis
@@ -154,10 +150,7 @@ export default function WeatherGraphs({ hourly }: { hourly: Hourly | undefined }
type='category' type='category'
stroke={'var(--mantine-color-primary-0)'} stroke={'var(--mantine-color-primary-0)'}
dataKey={(data) => { dataKey={(data) => {
return new Date(data.startTime).toLocaleTimeString('en-US', { return new Date(data.startTime).toLocaleTimeString('en-US');
hour: 'numeric',
minute: 'numeric',
});
}} }}
/> />
<YAxis stroke={'var(--mantine-color-primary-0)'} unit={'%'} domain={[0, 100]} /> <YAxis stroke={'var(--mantine-color-primary-0)'} unit={'%'} domain={[0, 100]} />

View File

@@ -72,7 +72,10 @@ export function WeatherModal({
}} }}
> >
<Stack w={'65%'} align={'center'} justify={'center'}> <Stack w={'65%'} align={'center'} justify={'center'}>
<ExtendedForecastDetails selectedDay={selectedDay} /> <ExtendedForecastDetails
selectedDay={selectedDay}
setSelectedDay={setSelectedDay}
/>
</Stack> </Stack>
</Overlay> </Overlay>
)} )}