From 34a1287be3712556c35be9e5dd112006acc2b1e6 Mon Sep 17 00:00:00 2001 From: Dennis Kigen Date: Mon, 1 Jan 2024 20:54:39 +0300 Subject: [PATCH] Minimal refactors --- src/hooks/useWeather.js | 24 +- src/icons.js | 532 +++++++++++++++++++++++++++++++++++++++ src/icons.json | 530 -------------------------------------- src/recommendations.js | 433 +++++++++++++++++++++++++++++++ src/recommendations.json | 354 -------------------------- 5 files changed, 978 insertions(+), 895 deletions(-) create mode 100644 src/icons.js delete mode 100644 src/icons.json create mode 100644 src/recommendations.js delete mode 100644 src/recommendations.json diff --git a/src/hooks/useWeather.js b/src/hooks/useWeather.js index 86a59db..a809b2a 100644 --- a/src/hooks/useWeather.js +++ b/src/hooks/useWeather.js @@ -3,19 +3,22 @@ import utc from 'dayjs/plugin/utc'; dayjs.extend(utc); import useSWR from 'swr'; import fetcher from '../lib/fetcher'; - -import * as recommendations from '../recommendations'; -import * as weatherIcons from '../icons'; +import recommendations from '../recommendations'; +import weatherIcons from '../icons.js'; const iconPrefix = `wi wi-`; -const apiKey = import.meta.env.VITE_API_KEY; -const apiUrl = import.meta.env.VITE_API_URL; +const API_KEY = import.meta.env.VITE_API_KEY; +const BASE_URL = import.meta.env.VITE_API_URL; + +if (!BASE_URL || !API_KEY) { + throw new Error('API URL or Key is not defined in environment variables'); +} export function useWeather(endpoint, location, units) { - const apiEndpoint = `?q=${location}&units=${units}&APPID=${apiKey}`; + const apiEndpoint = `?q=${location}&units=${units}&APPID=${API_KEY}`; const { data, error, isLoading } = useSWR( - `${apiUrl}/${endpoint}/${apiEndpoint}`, + `${BASE_URL}/${endpoint}/${apiEndpoint}`, fetcher, ); @@ -58,8 +61,7 @@ function mapResponseProperties(data) { // Add extra properties for the five day forecast: dt_txt, icon, min, max if (data.dt_txt) { mapped.dt_txt = data.dt_txt; - mapped.forecastIcon = - iconPrefix + weatherIcons.default['day'][mapped.icon_id].icon; + mapped.forecastIcon = iconPrefix + weatherIcons['day'][mapped.icon_id].icon; } if (mapped.sunset || mapped.sunrise) { @@ -81,9 +83,9 @@ function mapResponseProperties(data) { : false; mapped.weatherIcon = iconPrefix + - weatherIcons.default[mapped.isDay ? 'day' : 'night'][mapped.icon_id].icon; + weatherIcons[mapped.isDay ? 'day' : 'night'][mapped.icon_id].icon; mapped.weatherRecommendation = - recommendations.default[mapped.isDay ? 'day' : 'night'][ + recommendations[mapped.isDay ? 'day' : 'night'][ mapped.icon_id ].recommendation; } diff --git a/src/icons.js b/src/icons.js new file mode 100644 index 0000000..6986c08 --- /dev/null +++ b/src/icons.js @@ -0,0 +1,532 @@ +const weatherIcons = { + day: { + '200': { + label: 'thunderstorm with light rain', + icon: 'thunderstorm', + }, + '201': { + label: 'thunderstorm with rain', + icon: 'thunderstorm', + }, + '202': { + label: 'thunderstorm with heavy rain', + icon: 'thunderstorm', + }, + '210': { + label: 'light thunderstorm', + icon: 'lightning', + }, + '211': { + label: 'thunderstorm', + icon: 'lightning', + }, + '212': { + label: 'heavy thunderstorm', + icon: 'lightning', + }, + '221': { + label: 'ragged thunderstorm', + icon: 'lightning', + }, + '230': { + label: 'thunderstorm with light drizzle', + icon: 'thunderstorm', + }, + '231': { + label: 'thunderstorm with drizzle', + icon: 'thunderstorm', + }, + '232': { + label: 'thunderstorm with heavy drizzle', + icon: 'thunderstorm', + }, + '300': { + label: 'light intensity drizzle', + icon: 'sprinkle', + }, + '301': { + label: 'drizzle', + icon: 'sprinkle', + }, + '302': { + label: 'heavy intensity drizzle', + icon: 'rain', + }, + '310': { + label: 'light intensity drizzle rain', + icon: 'rain', + }, + '311': { + label: 'drizzle rain', + icon: 'rain', + }, + '312': { + label: 'heavy intensity drizzle rain', + icon: 'rain', + }, + '313': { + label: 'shower rain and drizzle', + icon: 'rain', + }, + '314': { + label: 'heavy shower rain and drizzle', + icon: 'rain', + }, + '321': { + label: 'shower drizzle', + icon: 'sprinkle', + }, + '500': { + label: 'light rain', + icon: 'sprinkle', + }, + '501': { + label: 'moderate rain', + icon: 'rain', + }, + '502': { + label: 'heavy intensity rain', + icon: 'rain', + }, + '503': { + label: 'very heavy rain', + icon: 'rain', + }, + '504': { + label: 'extreme rain', + icon: 'rain', + }, + '511': { + label: 'freezing rain', + icon: 'rain-mix', + }, + '520': { + label: 'light intensity shower rain', + icon: 'showers', + }, + '521': { + label: 'shower rain', + icon: 'showers', + }, + '522': { + label: 'heavy intensity shower rain', + icon: 'showers', + }, + '531': { + label: 'ragged shower rain', + icon: 'storm-showers', + }, + '600': { + label: 'light snow', + icon: 'snow', + }, + '601': { + label: 'snow', + icon: 'sleet', + }, + '602': { + label: 'heavy snow', + icon: 'snow', + }, + '611': { + label: 'sleet', + icon: 'rain-mix', + }, + '612': { + label: 'shower sleet', + icon: 'rain-mix', + }, + '615': { + label: 'light rain and snow', + icon: 'rain-mix', + }, + '616': { + label: 'rain and snow', + icon: 'rain-mix', + }, + '620': { + label: 'light shower snow', + icon: 'rain-mix', + }, + '621': { + label: 'shower snow', + icon: 'snow', + }, + '622': { + label: 'heavy shower snow', + icon: 'snow', + }, + '701': { + label: 'mist', + icon: 'showers', + }, + '711': { + label: 'smoke', + icon: 'smoke', + }, + '721': { + label: 'haze', + icon: 'day-haze', + }, + '731': { + label: 'sand, dust whirls', + icon: 'dust', + }, + '741': { + label: 'fog', + icon: 'day-fog', + }, + '751': { + label: 'sand', + icon: 'cloudy-gusts', + }, + '761': { + label: 'dust', + icon: 'dust', + }, + '762': { + label: 'volcanic ash', + icon: 'dust', + }, + '771': { + label: 'squalls', + icon: 'cloudy-gusts', + }, + '781': { + label: 'tornado', + icon: 'tornado', + }, + '800': { + label: 'clear sky', + icon: 'day-sunny', + }, + '801': { + label: 'few clouds', + icon: 'day-cloudy-gusts', + }, + '802': { + label: 'scattered clouds', + icon: 'day-cloudy-gusts', + }, + '803': { + label: 'broken clouds', + icon: 'day-cloudy-gusts', + }, + '804': { + label: 'overcast clouds', + icon: 'day-sunny-overcast', + }, + '900': { + label: 'tornado', + icon: 'tornado', + }, + '901': { + label: 'tropical storm', + icon: 'storm-showers', + }, + '902': { + label: 'hurricane', + icon: 'hurricane', + }, + '903': { + label: 'cold', + icon: 'snowflake-cold', + }, + '904': { + label: 'hot', + icon: 'hot', + }, + '905': { + label: 'windy', + icon: 'windy', + }, + '906': { + label: 'hail', + icon: 'hail', + }, + '951': { + label: 'calm', + icon: 'sunny', + }, + '952': { + label: 'light breeze', + icon: 'cloudy-gusts', + }, + '953': { + label: 'gentle breeze', + icon: 'cloudy-gusts', + }, + '954': { + label: 'moderate breeze', + icon: 'cloudy-gusts', + }, + '955': { + label: 'fresh breeze', + icon: 'cloudy-gusts', + }, + '956': { + label: 'strong breeze', + icon: 'cloudy-gusts', + }, + '957': { + label: 'high wind, near gale', + icon: 'strong-wind', + }, + '958': { + label: 'gale', + icon: 'cloudy-gusts', + }, + '959': { + label: 'severe gale', + icon: 'cloudy-gusts', + }, + '960': { + label: 'storm', + icon: 'thunderstorm', + }, + '961': { + label: 'violent storm', + icon: 'thunderstorm', + }, + '962': { + label: 'hurricane', + icon: 'cloudy-gusts', + }, + }, + night: { + '200': { + label: 'thunderstorm with light rain', + icon: 'night-alt-thunderstorm', + }, + '201': { + label: 'thunderstorm with rain', + icon: 'night-alt-thunderstorm', + }, + '202': { + label: 'thunderstorm with heavy rain', + icon: 'night-alt-thunderstorm', + }, + '210': { + label: 'light thunderstorm', + icon: 'night-alt-lightning', + }, + '211': { + label: 'thunderstorm', + icon: 'night-alt-lightning', + }, + '212': { + label: 'heavy thunderstorm', + icon: 'night-alt-lightning', + }, + '221': { + label: 'ragged thunderstorm', + icon: 'night-alt-lightning', + }, + '230': { + label: 'thunderstorm with light drizzle', + icon: 'night-alt-thunderstorm', + }, + '231': { + label: 'thunderstorm with drizzle', + icon: 'night-alt-thunderstorm', + }, + '232': { + label: 'thunderstorm with haeavy drizzle', + icon: 'night-alt-thunderstorm', + }, + '300': { + label: 'light intensity drizzle', + icon: 'night-alt-sprinkle', + }, + '301': { + label: 'drizzle', + icon: 'night-alt-sprinkle', + }, + '302': { + label: 'heavy intensity drizzle', + icon: 'night-alt-rain', + }, + '310': { + label: 'light intensity drizzle', + icon: 'night-alt-rain', + }, + '311': { + label: 'drizzle rain', + icon: 'night-alt-rain', + }, + '312': { + label: 'heavy intensity drizzle rain', + icon: 'night-alt-rain', + }, + '313': { + label: 'shower rain and drizzle', + icon: 'night-alt-rain', + }, + '314': { + label: 'heavy shower rain and drizzle', + icon: 'night-alt-rain', + }, + '321': { + label: 'shower drizzle', + icon: 'night-alt-sprinkle', + }, + '500': { + label: 'light rain', + icon: 'night-alt-sprinkle', + }, + '501': { + label: 'moderate rain', + icon: 'night-alt-rain', + }, + '502': { + label: 'heavy intensity rain', + icon: 'night-alt-rain', + }, + '503': { + label: 'very heavy rain', + icon: 'night-alt-rain', + }, + '504': { + label: 'extreme rain', + icon: 'night-alt-rain', + }, + '511': { + label: 'freezing rain', + icon: 'night-alt-rain-mix', + }, + '520': { + label: 'light intensity shower rain', + icon: 'night-alt-showers', + }, + '521': { + label: 'shower rain', + icon: 'night-alt-showers', + }, + '522': { + label: 'heavy intensity shower rain', + icon: 'night-alt-showers', + }, + '531': { + label: 'ragged shower rain', + icon: 'night-alt-storm-showers', + }, + '600': { + label: 'light snow', + icon: 'night-alt-snow', + }, + '601': { + label: 'snow', + icon: 'night-alt-sleet', + }, + '602': { + label: 'heavy snow', + icon: 'night-alt-snow', + }, + '611': { + label: 'sleet', + icon: 'night-alt-rain-mix', + }, + '612': { + label: 'light shower sleet', + icon: 'night-alt-rain-mix', + }, + '615': { + label: 'light rain and snow', + icon: 'night-alt-rain-mix', + }, + '616': { + label: 'rain and snow', + icon: 'night-alt-rain-mix', + }, + '620': { + label: 'light shower snow', + icon: 'night-alt-rain-mix', + }, + '621': { + label: 'shower snow', + icon: 'night-alt-snow', + }, + '622': { + label: 'heavy shower snow', + icon: 'night-alt-snow', + }, + '701': { + label: 'mist', + icon: 'night-alt-showers', + }, + '711': { + label: 'smoke', + icon: 'smoke', + }, + '721': { + label: 'haze', + icon: 'day-haze', + }, + '731': { + label: 'sand/dust whirls', + icon: 'dust', + }, + '741': { + label: 'fog', + icon: 'night-fog', + }, + '761': { + label: 'sand', + icon: 'dust', + }, + '762': { + label: 'dust', + icon: 'dust', + }, + '781': { + label: 'volcanic ash', + icon: 'tornado', + }, + '800': { + label: 'clear sky', + icon: 'night-clear', + }, + '801': { + label: 'cloudy gusts', + icon: 'night-alt-cloudy-gusts', + }, + '802': { + label: 'cloudy gusts', + icon: 'night-alt-cloudy-gusts', + }, + '803': { + label: 'cloudy gusts', + icon: 'night-alt-cloudy-gusts', + }, + '804': { + label: 'cloudy', + icon: 'night-alt-cloudy', + }, + '900': { + label: 'tornado', + icon: 'tornado', + }, + '902': { + label: 'hurricane', + icon: 'hurricane', + }, + '903': { + label: 'snowflake-cold', + icon: 'snowflake-cold', + }, + '904': { + label: 'hot', + icon: 'hot', + }, + '906': { + label: 'hail', + icon: 'night-alt-hail', + }, + '957': { + label: 'strong wind', + icon: 'strong-wind', + }, + }, +}; + +export default weatherIcons; diff --git a/src/icons.json b/src/icons.json deleted file mode 100644 index 61aad5e..0000000 --- a/src/icons.json +++ /dev/null @@ -1,530 +0,0 @@ -{ - "day": { - "200": { - "label": "thunderstorm with light rain", - "icon": "thunderstorm" - }, - "201": { - "label": "thunderstorm with rain", - "icon": "thunderstorm" - }, - "202": { - "label": "thunderstorm with heavy rain", - "icon": "thunderstorm" - }, - "210": { - "label": "light thunderstorm", - "icon": "lightning" - }, - "211": { - "label": "thunderstorm", - "icon": "lightning" - }, - "212": { - "label": "heavy thunderstorm", - "icon": "lightning" - }, - "221": { - "label": "ragged thunderstorm", - "icon": "lightning" - }, - "230": { - "label": "thunderstorm with light drizzle", - "icon": "thunderstorm" - }, - "231": { - "label": "thunderstorm with drizzle", - "icon": "thunderstorm" - }, - "232": { - "label": "thunderstorm with heavy drizzle", - "icon": "thunderstorm" - }, - "300": { - "label": "light intensity drizzle", - "icon": "sprinkle" - }, - "301": { - "label": "drizzle", - "icon": "sprinkle" - }, - "302": { - "label": "heavy intensity drizzle", - "icon": "rain" - }, - "310": { - "label": "light intensity drizzle rain", - "icon": "rain" - }, - "311": { - "label": "drizzle rain", - "icon": "rain" - }, - "312": { - "label": "heavy intensity drizzle rain", - "icon": "rain" - }, - "313": { - "label": "shower rain and drizzle", - "icon": "rain" - }, - "314": { - "label": "heavy shower rain and drizzle", - "icon": "rain" - }, - "321": { - "label": "shower drizzle", - "icon": "sprinkle" - }, - "500": { - "label": "light rain", - "icon": "sprinkle" - }, - "501": { - "label": "moderate rain", - "icon": "rain" - }, - "502": { - "label": "heavy intensity rain", - "icon": "rain" - }, - "503": { - "label": "very heavy rain", - "icon": "rain" - }, - "504": { - "label": "extreme rain", - "icon": "rain" - }, - "511": { - "label": "freezing rain", - "icon": "rain-mix" - }, - "520": { - "label": "light intensity shower rain", - "icon": "showers" - }, - "521": { - "label": "shower rain", - "icon": "showers" - }, - "522": { - "label": "heavy intensity shower rain", - "icon": "showers" - }, - "531": { - "label": "ragged shower rain", - "icon": "storm-showers" - }, - "600": { - "label": "light snow", - "icon": "snow" - }, - "601": { - "label": "snow", - "icon": "sleet" - }, - "602": { - "label": "heavy snow", - "icon": "snow" - }, - "611": { - "label": "sleet", - "icon": "rain-mix" - }, - "612": { - "label": "shower sleet", - "icon": "rain-mix" - }, - "615": { - "label": "light rain and snow", - "icon": "rain-mix" - }, - "616": { - "label": "rain and snow", - "icon": "rain-mix" - }, - "620": { - "label": "light shower snow", - "icon": "rain-mix" - }, - "621": { - "label": "shower snow", - "icon": "snow" - }, - "622": { - "label": "heavy shower snow", - "icon": "snow" - }, - "701": { - "label": "mist", - "icon": "showers" - }, - "711": { - "label": "smoke", - "icon": "smoke" - }, - "721": { - "label": "haze", - "icon": "day-haze" - }, - "731": { - "label": "sand, dust whirls", - "icon": "dust" - }, - "741": { - "label": "fog", - "icon": "day-fog" - }, - "751": { - "label": "sand", - "icon": "cloudy-gusts" - }, - "761": { - "label": "dust", - "icon": "dust" - }, - "762": { - "label": "volcanic ash", - "icon": "dust" - }, - "771": { - "label": "squalls", - "icon": "cloudy-gusts" - }, - "781": { - "label": "tornado", - "icon": "tornado" - }, - "800": { - "label": "clear sky", - "icon": "day-sunny" - }, - "801": { - "label": "few clouds", - "icon": "day-cloudy-gusts" - }, - "802": { - "label": "scattered clouds", - "icon": "day-cloudy-gusts" - }, - "803": { - "label": "broken clouds", - "icon": "day-cloudy-gusts" - }, - "804": { - "label": "overcast clouds", - "icon": "day-sunny-overcast" - }, - "900": { - "label": "tornado", - "icon": "tornado" - }, - "901": { - "label": "tropical storm", - "icon": "storm-showers" - }, - "902": { - "label": "hurricane", - "icon": "hurricane" - }, - "903": { - "label": "cold", - "icon": "snowflake-cold" - }, - "904": { - "label": "hot", - "icon": "hot" - }, - "905": { - "label": "windy", - "icon": "windy" - }, - "906": { - "label": "hail", - "icon": "hail" - }, - "951": { - "label": "calm", - "icon": "sunny" - }, - "952": { - "label": "light breeze", - "icon": "cloudy-gusts" - }, - "953": { - "label": "gentle breeze", - "icon": "cloudy-gusts" - }, - "954": { - "label": "moderate breeze", - "icon": "cloudy-gusts" - }, - "955": { - "label": "fresh breeze", - "icon": "cloudy-gusts" - }, - "956": { - "label": "strong breeze", - "icon": "cloudy-gusts" - }, - "957": { - "label": "high wind, near gale", - "icon": "strong-wind" - }, - "958": { - "label": "gale", - "icon": "cloudy-gusts" - }, - "959": { - "label": "severe gale", - "icon": "cloudy-gusts" - }, - "960": { - "label": "storm", - "icon": "thunderstorm" - }, - "961": { - "label": "violent storm", - "icon": "thunderstorm" - }, - "962": { - "label": "hurricane", - "icon": "cloudy-gusts" - } - }, - "night": { - "200": { - "label": "thunderstorm with light rain", - "icon": "night-alt-thunderstorm" - }, - "201": { - "label": "thunderstorm with rain", - "icon": "night-alt-thunderstorm" - }, - "202": { - "label": "thunderstorm with heavy rain", - "icon": "night-alt-thunderstorm" - }, - "210": { - "label": "light thunderstorm", - "icon": "night-alt-lightning" - }, - "211": { - "label": "thunderstorm", - "icon": "night-alt-lightning" - }, - "212": { - "label": "heavy thunderstorm", - "icon": "night-alt-lightning" - }, - "221": { - "label": "ragged thunderstorm", - "icon": "night-alt-lightning" - }, - "230": { - "label": "thunderstorm with light drizzle", - "icon": "night-alt-thunderstorm" - }, - "231": { - "label": "thunderstorm with drizzle", - "icon": "night-alt-thunderstorm" - }, - "232": { - "label": "thunderstorm with haeavy drizzle", - "icon": "night-alt-thunderstorm" - }, - "300": { - "label": "light intensity drizzle", - "icon": "night-alt-sprinkle" - }, - "301": { - "label": "drizzle", - "icon": "night-alt-sprinkle" - }, - "302": { - "label": "heavy intensity drizzle", - "icon": "night-alt-rain" - }, - "310": { - "label": "light intensity drizzle", - "icon": "night-alt-rain" - }, - "311": { - "label": "drizzle rain", - "icon": "night-alt-rain" - }, - "312": { - "label": "heavy intensity drizzle rain", - "icon": "night-alt-rain" - }, - "313": { - "label": "shower rain and drizzle", - "icon": "night-alt-rain" - }, - "314": { - "label": "heavy shower rain and drizzle", - "icon": "night-alt-rain" - }, - "321": { - "label": "shower drizzle", - "icon": "night-alt-sprinkle" - }, - "500": { - "label": "light rain", - "icon": "night-alt-sprinkle" - }, - "501": { - "label": "moderate rain", - "icon": "night-alt-rain" - }, - "502": { - "label": "heavy intensity rain", - "icon": "night-alt-rain" - }, - "503": { - "label": "very heavy rain", - "icon": "night-alt-rain" - }, - "504": { - "label": "extreme rain", - "icon": "night-alt-rain" - }, - "511": { - "label": "freezing rain", - "icon": "night-alt-rain-mix" - }, - "520": { - "label": "light intensity shower rain", - "icon": "night-alt-showers" - }, - "521": { - "label": "shower rain", - "icon": "night-alt-showers" - }, - "522": { - "label": "heavy intensity shower rain", - "icon": "night-alt-showers" - }, - "531": { - "label": "ragged shower rain", - "icon": "night-alt-storm-showers" - }, - "600": { - "label": "light snow", - "icon": "night-alt-snow" - }, - "601": { - "label": "snow", - "icon": "night-alt-sleet" - }, - "602": { - "label": "heavy snow", - "icon": "night-alt-snow" - }, - "611": { - "label": "sleet", - "icon": "night-alt-rain-mix" - }, - "612": { - "label": "light shower sleet", - "icon": "night-alt-rain-mix" - }, - "615": { - "label": "light rain and snow", - "icon": "night-alt-rain-mix" - }, - "616": { - "label": "rain and snow", - "icon": "night-alt-rain-mix" - }, - "620": { - "label": "light shower snow", - "icon": "night-alt-rain-mix" - }, - "621": { - "label": "shower snow", - "icon": "night-alt-snow" - }, - "622": { - "label": "heavy shower snow", - "icon": "night-alt-snow" - }, - "701": { - "label": "mist", - "icon": "night-alt-showers" - }, - "711": { - "label": "smoke", - "icon": "smoke" - }, - "721": { - "label": "haze", - "icon": "day-haze" - }, - "731": { - "label": "sand/dust whirls", - "icon": "dust" - }, - "741": { - "label": "fog", - "icon": "night-fog" - }, - "761": { - "label": "sand", - "icon": "dust" - }, - "762": { - "label": "dust", - "icon": "dust" - }, - "781": { - "label": "volcanic ash", - "icon": "tornado" - }, - "800": { - "label": "clear sky", - "icon": "night-clear" - }, - "801": { - "label": "cloudy gusts", - "icon": "night-alt-cloudy-gusts" - }, - "802": { - "label": "cloudy gusts", - "icon": "night-alt-cloudy-gusts" - }, - "803": { - "label": "cloudy gusts", - "icon": "night-alt-cloudy-gusts" - }, - "804": { - "label": "cloudy", - "icon": "night-alt-cloudy" - }, - "900": { - "label": "tornado", - "icon": "tornado" - }, - "902": { - "label": "hurricane", - "icon": "hurricane" - }, - "903": { - "label": "snowflake-cold", - "icon": "snowflake-cold" - }, - "904": { - "label": "hot", - "icon": "hot" - }, - "906": { - "label": "hail", - "icon": "night-alt-hail" - }, - "957": { - "label": "strong wind", - "icon": "strong-wind" - } - } -} diff --git a/src/recommendations.js b/src/recommendations.js new file mode 100644 index 0000000..16b5a5b --- /dev/null +++ b/src/recommendations.js @@ -0,0 +1,433 @@ +const recommendations = { + day: { + '200': { + recommendation: 'Stormy with a bit of rain. Coat required', + }, + '201': { + recommendation: 'Stormy with showers. Grab a brolly on your way out', + }, + '202': { + recommendation: + "It's going to be absolutely torrential out there today. Carry as many umbrellas as you can", + }, + '210': { + recommendation: + "Light storm on the way. Good time for that spare lightning detector you've had lying around", + }, + '211': { + recommendation: 'A storm on the way. Mind your eardrums please.', + }, + '212': { + recommendation: + 'Biblical weather today. Gumboots and a life jacket are the bare minimum', + }, + '221': { + recommendation: + 'Horrid weather. Jackets, brollies, heck, you might even need a boat', + }, + '230': { + recommendation: "Storms and a bit of rain. Brolly + layers I'm afraid", + }, + '231': { + recommendation: + "Rain + storms aka you'll look pretty daft going without a jacket today", + }, + '232': { + recommendation: 'Rainfall incoming. Umbrella for goodness sake!', + }, + '300': { + recommendation: + 'Well, a bit of rain never killed anyone. Am I even legally allowed to say er... *frantically deletes*', + }, + '301': { + recommendation: + 'Rain, but not terminal. Be sensible and wear a coat for heavens sake', + }, + '302': { + recommendation: "Rain, of the annoying variety. Don't get caught out", + }, + '310': { + recommendation: + "The kind of rain you see people dance in in the movies. You'll be fine", + }, + '311': { + recommendation: 'A spot of rain. Nothing to be overly worried about', + }, + '312': { + recommendation: "More rain, I'm afraid. Coat or jacket as standard", + }, + '313': { + recommendation: + "Showers forecasted. That means a free shower for you if you don't carry a brolly", + }, + '314': { + recommendation: + 'Cats and dogs. Umbrella and a thick pair of wellies required.', + }, + '321': { + recommendation: + 'Rain, but the sort you could survive by staying indoors. Umbrella optional', + }, + '500': { + recommendation: + 'You can get away with just a sweater today. Disclaimer: I will not be held responsible for any rain-related mishaps', + }, + '501': { + recommendation: 'A bit more rain. Best carry an umbrella chap', + }, + '502': { + recommendation: + 'Now this is getting annoying. Umbrella + jacket required', + }, + '503': { + recommendation: + 'Biblical amounts of rain forecasted. Umbrella, jacket, coat, layers, life jacket, and standby boat as standard', + }, + '504': { + recommendation: + "I'm delighted to tell you that you're not leaving the house today because you'd literally drown in the rain outside", + }, + '511': { + recommendation: + "Rain, biting cold, soul-renching conditions, the works. You'd be well advised to seek cover and remain indoors", + }, + '520': { + recommendation: + 'Showers forecasted. Carry an umbrella for goodness sake!', + }, + '521': { + recommendation: + 'Showers forecasted. Please carry an umbrella for goodness sake', + }, + '522': { + recommendation: + "You're getting absolutely drenched if you dare go without a military-grade jacket and umbrella combo today", + }, + '531': { + recommendation: + "Ragged rains. You're going to need a jacket, wellies and industrial-strength fortitude to make it through this", + }, + '600': { + recommendation: "Light snow forecasted. You'll be fine", + }, + '601': { + recommendation: + "Snow. But you'll live. Just carry a sweater for good measure", + }, + '602': { + recommendation: + "It's blustery out there. Consider calling in sick at the office", + }, + '611': { + recommendation: 'Umbrella and coat as standard', + }, + '612': { + recommendation: 'Umbrella and coat as standard', + }, + '613': { + recommendation: 'Umbrella and coat as standard', + }, + '615': { + recommendation: + "Umbrella and coat as standard. Don't say I didn't warn you", + }, + '616': { + recommendation: + 'Umbrella + coat + a nice cup of a warm beverage recommended', + }, + '620': { + recommendation: 'A light jacket should do the trick', + }, + '621': { + recommendation: + 'Rain + snow. Could be better. Could be worse. Jacket + brolly recommended', + }, + '622': { + recommendation: + "It's an absolute warzone out there. Coat, umbrella, jacket and military-grade helmet required", + }, + '701': { + recommendation: + "The air is thick with fog and there's just barely a light rain. Tread carefully", + }, + '702': { + recommendation: 'Do you smell burning? I smell burning...', + }, + '711': { + recommendation: + 'Smoke warning - potential forest fire hazard. Be extremely vigilant and on the lookout for the most up to date weather advisories', + }, + '721': { + recommendation: + "The sun's out but it's hazy. I've got work, but I'm lazy. Like a mini Eminem, right?", + }, + '731': { + recommendation: + 'Like walking out in the Sahara is what it looks like out there. Tech wear the absolute bare minimum', + }, + '741': { + recommendation: + 'Foggy weather. Visibility severely impacted. Take extreme care when driving if you must.', + }, + '751': { + recommendation: + 'Potential sandstorms expected. Avoid the outdoors if you can', + }, + '761': { + recommendation: + 'Potential dust storms expected. Take cover and remain safe', + }, + '762': { + recommendation: 'Volcanic ash advisory - stay indoors whenever possible', + }, + '771': { + recommendation: 'Snow squall warning - avoid the outdoors if you can', + }, + '781': { + recommendation: + 'Tornado warning - take immediate cover at the first sign. Avoid windows.', + }, + '800': { + recommendation: + "It's a beautiful day. Lather up on some sunscreen and maybe carry a hat too for good measure.", + }, + '801': { + recommendation: + 'Great day for a hanging out the laundry and maybe a nice picnic date later :)', + }, + '802': { + recommendation: + 'Love is in the air. Call that special someone up for a coffee', + }, + '803': { + recommendation: "'Netflix and chill' weather. It's pleasant outside", + }, + '804': { + recommendation: 'Great day for a run. Pack that gym bag', + }, + }, + night: { + '200': { + recommendation: 'Stormy with a bit of rain. Coat required', + }, + '201': { + recommendation: 'Stormy with showers. Grab a brolly on your way out', + }, + '202': { + recommendation: + "It's going to be absolutely torrential out there. Carry as many umbrellas as you can", + }, + '210': { + recommendation: + "Light storm on the way. Good time for that spare lightning detector you've had lying around", + }, + '211': { + recommendation: 'A storm on the way. Mind your eardrums please.', + }, + '212': { + recommendation: + 'Biblical weather today. Gumboots and a life jacket are the bare minimum', + }, + '221': { + recommendation: + 'Horrid weather. Jackets, brollies, heck, you might even need a boat', + }, + '230': { + recommendation: "Storms and a bit of rain. Brolly + layers I'm afraid", + }, + '231': { + recommendation: + "Rain + storms aka you'll look pretty daft going without a jacket today", + }, + '232': { + recommendation: 'Rainfall incoming. Umbrella for goodness sake!', + }, + '300': { + recommendation: + 'Well, a bit of rain never killed anyone. Am I even legally allowed to say er... *frantically deletes*', + }, + '301': { + recommendation: + 'Rain, but not terminal. Be sensible and wear a coat for heavens sake', + }, + '302': { + recommendation: "Rain, of the annoying variety. Don't get caught out", + }, + '310': { + recommendation: + "The kind of rain you see people dance in in the movies. You'll be fine", + }, + '311': { + recommendation: 'A spot of rain. Nothing to be overly worried about', + }, + '312': { + recommendation: "More rain, I'm afraid. Coat or jacket as standard", + }, + '313': { + recommendation: + "Showers forecasted. That means a free shower for you if you don't carry a brolly", + }, + '314': { + recommendation: + 'Cats and dogs. Umbrella and a thick pair of wellies required.', + }, + '321': { + recommendation: + 'Rain, but the sort you could survive by staying indoors. Umbrella optional', + }, + '500': { + recommendation: + 'You can get away with just a sweater today. Disclaimer: I will not be held responsible for any rain-related mishaps', + }, + '501': { + recommendation: 'A bit more rain. Best carry an umbrella chap', + }, + '502': { + recommendation: + 'Now this is getting annoying. Umbrella + jacket required', + }, + '503': { + recommendation: + 'Biblical amounts of rain forecasted. Umbrella, jacket, coat, layers, life jacket, and standby boat as standard', + }, + '504': { + recommendation: + "I'm delighted to tell you that you're not leaving the house today because you'd literally drown in the rain outside", + }, + '511': { + recommendation: + "Rain, biting cold, soul-renching conditions, the works. You'd be well advised to seek cover and remain indoors", + }, + '520': { + recommendation: + 'Showers forecasted. Carry an umbrella for goodness sake!', + }, + '521': { + recommendation: + 'Showers forecasted. Please carry an umbrella for goodness sake', + }, + '522': { + recommendation: + "You're getting absolutely drenched if you dare go without a military-grade jacket and umbrella combo today", + }, + '531': { + recommendation: + "Ragged rains. You're going to need a jacket, wellies and industrial-strength fortitude to make it through this", + }, + '600': { + recommendation: "Light snow forecasted. You'll be fine", + }, + '601': { + recommendation: + "Snow. But you'll live. Just carry a sweater for good measure", + }, + '602': { + recommendation: + "It's blustery out there. Consider calling in sick at the office", + }, + '611': { + recommendation: 'Umbrella and coat as standard', + }, + '615': { + recommendation: + "Umbrella and coat as standard. Don't say I didn't warn you", + }, + '616': { + recommendation: + 'Umbrella + coat + a nice cup of a warm beverage recommended', + }, + '620': { + recommendation: 'A light jacket should do the trick', + }, + '621': { + recommendation: + 'Rain + snow. Could be better. Could be worse. Jacket + brolly recommended', + }, + '622': { + recommendation: + "It's an absolute warzone out there. Coat, umbrella, jacket and military-grade helmet required", + }, + '701': { + recommendation: + "The air is thick with fog and there's just barely a light rain. Tread carefully", + }, + '702': { + recommendation: 'Do you smell burning? I smell burning...', + }, + '711': { + recommendation: + 'Smoke warning - potential forest fire hazard. Be extremely vigilant and on the lookout for the most up to date weather advisories', + }, + '721': { + recommendation: + "Silent night, hazy night... you'll need your standard-issue mil-spec night vision goggles", + }, + '731': { + recommendation: + 'Like walking out in the Sahara is what it looks like out there. Tech wear the absolute bare minimum', + }, + '741': { + recommendation: + 'Foggy weather. Visibility severely impacted. Take extreme care when driving if you must.', + }, + '751': { + recommendation: + 'Potential sandstorms expected. Avoid the outdoors if you can', + }, + '761': { + recommendation: + 'Potential dust storms expected. Take cover and remain safe', + }, + '762': { + recommendation: 'Volcanic ash advisory - stay indoors whenever possible', + }, + '771': { + recommendation: 'Snow squall warning - avoid the outdoors if you can', + }, + '781': { + recommendation: + 'Tornado warning - take immediate cover at the first sign. Avoid windows.', + }, + '800': { + recommendation: + 'Clear skies. Kind of night where you fire up stellarium and cozy up underneath the telescope', + }, + '801': { + recommendation: + 'Cloudy skies on a blustery evening. Snuggle up with a hot cuppa', + }, + '802': { + recommendation: "Cloudy gusts forecasted. You'll wanna get a coat", + }, + '803': { + recommendation: 'Cloudy and blustery outside. Coat required', + }, + '804': { + recommendation: 'Cloudy with a chance of meatballs', + }, + '900': { + recommendation: + '⚠️ Tornado warning ⚠️ Seek safe shelter immediately. stay away from doors, windows, outside walls and protect your head!', + }, + '902': { + recommendation: + '⚠️ Hurricane warning ⚠️ Stay indoors and away from windows. Be on the lookout for the latest emergency response information', + }, + '903': { + recommendation: + 'Snowflakes falling with a chilly wind blowing. Christmas already?', + }, + '904': { + recommendation: + 'Absolutely blazing outside. Ice baths on rotation is the bare minimum', + }, + '906': { + recommendation: 'Hailstorm forecasted. Take cover', + }, + '957': { + recommendation: 'Strong winds. Hold on to something or someone strong', + }, + }, +}; + +export default recommendations; diff --git a/src/recommendations.json b/src/recommendations.json deleted file mode 100644 index ba0c615..0000000 --- a/src/recommendations.json +++ /dev/null @@ -1,354 +0,0 @@ -{ - "day": { - "200": { - "recommendation": "Stormy with a bit of rain. Coat required" - }, - "201": { - "recommendation": "Stormy with showers. Grab a brolly on your way out" - }, - "202": { - "recommendation": "It's going to be absolutely torrential out there today. Carry as many umbrellas as you can" - }, - "210": { - "recommendation": "Light storm on the way. Good time for that spare lightning detector you've had lying around" - }, - "211": { - "recommendation": "A storm on the way. Mind your eardrums please." - }, - "212": { - "recommendation": "Biblical weather today. Gumboots and a life jacket are the bare minimum" - }, - "221": { - "recommendation": "Horrid weather. Jackets, brollies, heck, you might even need a boat" - }, - "230": { - "recommendation": "Storms and a bit of rain. Brolly + layers I'm afraid" - }, - "231": { - "recommendation": "Rain + storms aka you'll look pretty daft going without a jacket today" - }, - "232": { - "recommendation": "Rainfall incoming. Umbrella for goodness sake!" - }, - "300": { - "recommendation": "Well, a bit of rain never killed anyone. Am I even legally allowed to say er... *frantically deletes*" - }, - "301": { - "recommendation": "Rain, but not terminal. Be sensible and wear a coat for heavens sake" - }, - "302": { - "recommendation": "Rain, of the annoying variety. Don't get caught out" - }, - "310": { - "recommendation": "The kind of rain you see people dance in in the movies. You'll be fine" - }, - "311": { - "recommendation": "A spot of rain. Nothing to be overly worried about" - }, - "312": { - "recommendation": "More rain, I'm afraid. Coat or jacket as standard" - }, - "313": { - "recommendation": "Showers forecasted. That means a free shower for you if you don't carry a brolly" - }, - "314": { - "recommendation": "Cats and dogs. Umbrella and a thick pair of wellies required." - }, - "321": { - "recommendation": "Rain, but the sort you could survive by staying indoors. Umbrella optional" - }, - "500": { - "recommendation": "You can get away with just a sweater today. Disclaimer: I will not be held responsible for any rain-related mishaps" - }, - "501": { - "recommendation": "A bit more rain. Best carry an umbrella chap" - }, - "502": { - "recommendation": "Now this is getting annoying. Umbrella + jacket required" - }, - "503": { - "recommendation": "Biblical amounts of rain forecasted. Umbrella, jacket, coat, layers, life jacket, and standby boat as standard" - }, - "504": { - "recommendation": "I'm delighted to tell you that you're not leaving the house today because you'd literally drown in the rain outside" - }, - "511": { - "recommendation": "Rain, biting cold, soul-renching conditions, the works. You'd be well advised to seek cover and remain indoors" - }, - "520": { - "recommendation": "Showers forecasted. Carry an umbrella for goodness sake!" - }, - "521": { - "recommendation": "Showers forecasted. Please carry an umbrella for goodness sake" - }, - "522": { - "recommendation": "You're getting absolutely drenched if you dare go without a military-grade jacket and umbrella combo today" - }, - "531": { - "recommendation": "Ragged rains. You're going to need a jacket, wellies and industrial-strength fortitude to make it through this" - }, - "600": { - "recommendation": "Light snow forecasted. You'll be fine" - }, - "601": { - "recommendation": "Snow. But you'll live. Just carry a sweater for good measure" - }, - "602": { - "recommendation": "It's blustery out there. Consider calling in sick at the office" - }, - "611": { - "recommendation": "Umbrella and coat as standard" - }, - "612": { - "recommendation": "Umbrella and coat as standard" - }, - "613": { - "recommendation": "Umbrella and coat as standard" - }, - "615": { - "recommendation": "Umbrella and coat as standard. Don't say I didn't warn you" - }, - "616": { - "recommendation": "Umbrella + coat + a nice cup of a warm beverage recommended" - }, - "620": { - "recommendation": "A light jacket should do the trick" - }, - "621": { - "recommendation": "Rain + snow. Could be better. Could be worse. Jacket + brolly recommended" - }, - "622": { - "recommendation": "It's an absolute warzone out there. Coat, umbrella, jacket and military-grade helmet required" - }, - "701": { - "recommendation": "The air is thick with fog and there's just barely a light rain. Tread carefully" - }, - "702": { - "recommendation": "Do you smell burning? I smell burning..." - }, - "711": { - "recommendation": "Smoke warning - potential forest fire hazard. Be extremely vigilant and on the lookout for the most up to date weather advisories" - }, - "721": { - "recommendation": "The sun's out but it's hazy. I've got work, but I'm lazy. Like a mini Eminem, right?" - }, - "731": { - "recommendation": "Like walking out in the Sahara is what it looks like out there. Tech wear the absolute bare minimum" - }, - "741": { - "recommendation": "Foggy weather. Visibility severely impacted. Take extreme care when driving if you must." - }, - "751": { - "recommendation": "Potential sandstorms expected. Avoid the outdoors if you can" - }, - "761": { - "recommendation": "Potential dust storms expected. Take cover and remain safe" - }, - "762": { - "recommendation": "Volcanic ash advisory - stay indoors whenever possible" - }, - "771": { - "recommendation": "Snow squall warning - avoid the outdoors if you can" - }, - "781": { - "recommendation": "Tornado warning - take immediate cover at the first sign. Avoid windows." - }, - "800": { - "recommendation": "It's a beautiful day. Lather up on some sunscreen and maybe carry a hat too for good measure." - }, - "801": { - "recommendation": "Great day for a hanging out the laundry and maybe a nice picnic date later :)" - }, - "802": { - "recommendation": "Love is in the air. Call that special someone up for a coffee" - }, - "803": { - "recommendation": "'Netflix and chill' weather. It's pleasant outside" - }, - "804": { - "recommendation": "Great day for a run. Pack that gym bag" - } - }, - "night": { - "200": { - "recommendation": "Stormy with a bit of rain. Coat required" - }, - "201": { - "recommendation": "Stormy with showers. Grab a brolly on your way out" - }, - "202": { - "recommendation": "It's going to be absolutely torrential out there. Carry as many umbrellas as you can" - }, - "210": { - "recommendation": "Light storm on the way. Good time for that spare lightning detector you've had lying around" - }, - "211": { - "recommendation": "A storm on the way. Mind your eardrums please." - }, - "212": { - "recommendation": "Biblical weather today. Gumboots and a life jacket are the bare minimum" - }, - "221": { - "recommendation": "Horrid weather. Jackets, brollies, heck, you might even need a boat" - }, - "230": { - "recommendation": "Storms and a bit of rain. Brolly + layers I'm afraid" - }, - "231": { - "recommendation": "Rain + storms aka you'll look pretty daft going without a jacket today" - }, - "232": { - "recommendation": "Rainfall incoming. Umbrella for goodness sake!" - }, - "300": { - "recommendation": "Well, a bit of rain never killed anyone. Am I even legally allowed to say er... *frantically deletes*" - }, - "301": { - "recommendation": "Rain, but not terminal. Be sensible and wear a coat for heavens sake" - }, - "302": { - "recommendation": "Rain, of the annoying variety. Don't get caught out" - }, - "310": { - "recommendation": "The kind of rain you see people dance in in the movies. You'll be fine" - }, - "311": { - "recommendation": "A spot of rain. Nothing to be overly worried about" - }, - "312": { - "recommendation": "More rain, I'm afraid. Coat or jacket as standard" - }, - "313": { - "recommendation": "Showers forecasted. That means a free shower for you if you don't carry a brolly" - }, - "314": { - "recommendation": "Cats and dogs. Umbrella and a thick pair of wellies required." - }, - "321": { - "recommendation": "Rain, but the sort you could survive by staying indoors. Umbrella optional" - }, - "500": { - "recommendation": "You can get away with just a sweater today. Disclaimer: I will not be held responsible for any rain-related mishaps" - }, - "501": { - "recommendation": "A bit more rain. Best carry an umbrella chap" - }, - "502": { - "recommendation": "Now this is getting annoying. Umbrella + jacket required" - }, - "503": { - "recommendation": "Biblical amounts of rain forecasted. Umbrella, jacket, coat, layers, life jacket, and standby boat as standard" - }, - "504": { - "recommendation": "I'm delighted to tell you that you're not leaving the house today because you'd literally drown in the rain outside" - }, - "511": { - "recommendation": "Rain, biting cold, soul-renching conditions, the works. You'd be well advised to seek cover and remain indoors" - }, - "520": { - "recommendation": "Showers forecasted. Carry an umbrella for goodness sake!" - }, - "521": { - "recommendation": "Showers forecasted. Please carry an umbrella for goodness sake" - }, - "522": { - "recommendation": "You're getting absolutely drenched if you dare go without a military-grade jacket and umbrella combo today" - }, - "531": { - "recommendation": "Ragged rains. You're going to need a jacket, wellies and industrial-strength fortitude to make it through this" - }, - "600": { - "recommendation": "Light snow forecasted. You'll be fine" - }, - "601": { - "recommendation": "Snow. But you'll live. Just carry a sweater for good measure" - }, - "602": { - "recommendation": "It's blustery out there. Consider calling in sick at the office" - }, - "611": { - "recommendation": "Umbrella and coat as standard" - }, - "615": { - "recommendation": "Umbrella and coat as standard. Don't say I didn't warn you" - }, - "616": { - "recommendation": "Umbrella + coat + a nice cup of a warm beverage recommended" - }, - "620": { - "recommendation": "A light jacket should do the trick" - }, - "621": { - "recommendation": "Rain + snow. Could be better. Could be worse. Jacket + brolly recommended" - }, - "622": { - "recommendation": "It's an absolute warzone out there. Coat, umbrella, jacket and military-grade helmet required" - }, - "701": { - "recommendation": "The air is thick with fog and there's just barely a light rain. Tread carefully" - }, - "702": { - "recommendation": "Do you smell burning? I smell burning..." - }, - "711": { - "recommendation": "Smoke warning - potential forest fire hazard. Be extremely vigilant and on the lookout for the most up to date weather advisories" - }, - "721": { - "recommendation": "Silent night, hazy night... you'll need your standard-issue mil-spec night vision goggles" - }, - "731": { - "recommendation": "Like walking out in the Sahara is what it looks like out there. Tech wear the absolute bare minimum" - }, - "741": { - "recommendation": "Foggy weather. Visibility severely impacted. Take extreme care when driving if you must." - }, - "751": { - "recommendation": "Potential sandstorms expected. Avoid the outdoors if you can" - }, - "761": { - "recommendation": "Potential dust storms expected. Take cover and remain safe" - }, - "762": { - "recommendation": "Volcanic ash advisory - stay indoors whenever possible" - }, - "771": { - "recommendation": "Snow squall warning - avoid the outdoors if you can" - }, - "781": { - "recommendation": "Tornado warning - take immediate cover at the first sign. Avoid windows." - }, - "800": { - "recommendation": "Clear skies. Kind of night where you fire up stellarium and cozy up underneath the telescope" - }, - "801": { - "recommendation": "Cloudy skies on a blustery evening. Snuggle up with a hot cuppa" - }, - "802": { - "recommendation": "Cloudy gusts forecasted. You'll wanna get a coat" - }, - "803": { - "recommendation": "Cloudy and blustery outside. Coat required" - }, - "804": { - "recommendation": "Cloudy with a chance of meatballs" - }, - "900": { - "recommendation": "⚠️ Tornado warning ⚠️ Seek safe shelter immediately. stay away from doors, windows, outside walls and protect your head!" - }, - "902": { - "recommendation": "⚠️ Hurricane warning ⚠️ Stay indoors and away from windows. Be on the lookout for the latest emergency response information" - }, - "903": { - "recommendation": "Snowflakes falling with a chilly wind blowing. Christmas already?" - }, - "904": { - "recommendation": "Absolutely blazing outside. Ice baths on rotation is the bare minimum" - }, - "906": { - "recommendation": "Hailstorm forecasted. Take cover" - }, - "957": { - "recommendation": "Strong winds. Hold on to something or someone strong" - } - } -}