|
1 | 1 | import { useTheme } from "@emotion/react"; |
2 | 2 | import { format } from "date-fns"; |
3 | 3 | import { fi } from "date-fns/locale/fi"; |
4 | | -import { memo, useMemo } from "react"; |
| 4 | +import { memo } from "react"; |
5 | 5 | import useSWR from "swr"; |
6 | 6 |
|
7 | 7 | import { api, fetcher } from "../api"; |
8 | 8 | import useLocationSettings from "../hooks/useLocationSettings"; |
9 | | -import { getTemperatureRoast } from "../temperatureRoast"; |
10 | 9 | import { WeatherData } from "../types/weather/fmi"; |
11 | 10 | import { |
12 | 11 | getFmiWeatherDescription, |
@@ -42,16 +41,6 @@ const WeatherBox: React.FC<WeatherBoxProps> = ({ className }) => { |
42 | 41 | const today = daily[0]; |
43 | 42 | const hourly = data?.hourly; |
44 | 43 |
|
45 | | - const currentTemp = current?.temperature; |
46 | | - const roundedTemp = |
47 | | - currentTemp !== undefined ? Math.round(currentTemp) : undefined; |
48 | | - /* eslint-disable react-hooks/exhaustive-deps -- intentionally keyed on roundedTemp to avoid re-randomizing on fractional changes */ |
49 | | - const roast = useMemo( |
50 | | - () => (currentTemp !== undefined ? getTemperatureRoast(currentTemp) : null), |
51 | | - [roundedTemp], |
52 | | - ); |
53 | | - /* eslint-enable react-hooks/exhaustive-deps */ |
54 | | - |
55 | 44 | if (!location && !locationLoading) { |
56 | 45 | return ( |
57 | 46 | <Box className={className}> |
@@ -132,7 +121,7 @@ const WeatherBox: React.FC<WeatherBoxProps> = ({ className }) => { |
132 | 121 | textTransform: "none", |
133 | 122 | }} |
134 | 123 | > |
135 | | - {[location?.displayName, roast].filter(Boolean).join(" – ")} |
| 124 | + {location?.displayName ?? ""} |
136 | 125 | </span> |
137 | 126 | </div> |
138 | 127 | <div |
|
0 commit comments