Skip to content

Commit

Permalink
Refactor image url paths part 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Van-Nice committed Jun 20, 2024
1 parent dc1c816 commit 13b69d7
Showing 1 changed file with 54 additions and 54 deletions.
108 changes: 54 additions & 54 deletions scripts/weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,72 @@ import { updateCurrent } from './updateCurrent.js';

const weatherCodeToImageMap = {
// Thunderstorms - typically use both day and night images
200: "public/weather-both/thunder-storm-both.png",
201: "public/weather-both/thunder-storm-both.png",
202: "public/weather-both/thunder-storm-both.png",
210: "public/weather-both/thunder-storm-both.png",
211: "public/weather-both/thunder-storm-both.png",
212: "public/weather-both/thunder-storm-both.png",
221: "public/weather-both/thunder-storm-both.png",
230: "public/weather-both/thunder-storm-both.png",
231: "public/weather-both/thunder-storm-both.png",
232: "public/weather-both/thunder-storm-both.png",
200: "../public/weather-both/thunder-storm-both.png",
201: "../public/weather-both/thunder-storm-both.png",
202: "../public/weather-both/thunder-storm-both.png",
210: "../public/weather-both/thunder-storm-both.png",
211: "../public/weather-both/thunder-storm-both.png",
212: "../public/weather-both/thunder-storm-both.png",
221: "../public/weather-both/thunder-storm-both.png",
230: "../public/weather-both/thunder-storm-both.png",
231: "../public/weather-both/thunder-storm-both.png",
232: "../public/weather-both/thunder-storm-both.png",

// Drizzle - typically use both day and night images
300: "public/weather-both/showers-both.png",
301: "public/weather-both/showers-both.png",
302: "public/weather-both/showers-both.png",
310: "public/weather-both/showers-both.png",
311: "public/weather-both/showers-both.png",
312: "public/weather-both/showers-both.png",
313: "public/weather-both/showers-both.png",
314: "public/weather-both/showers-both.png",
321: "public/weather-both/showers-both.png",
300: "../public/weather-both/showers-both.png",
301: "../public/weather-both/showers-both.png",
302: "../public/weather-both/showers-both.png",
310: "../public/weather-both/showers-both.png",
311: "../public/weather-both/showers-both.png",
312: "../public/weather-both/showers-both.png",
313: "../public/weather-both/showers-both.png",
314: "../public/weather-both/showers-both.png",
321: "../public/weather-both/showers-both.png",

// Rain - typically use both day and night images
500: "public/weather-both/rain-both.png",
501: "public/weather-both/rain-both.png",
502: "public/weather-both/rain-both.png",
503: "public/weather-both/rain-both.png",
504: "public/weather-both/rain-both.png",
511: "public/weather-both/freezing-rain-both.png",
520: "public/weather-both/showers-both.png",
521: "public/weather-both/showers-both.png",
522: "public/weather-both/showers-both.png",
531: "public/weather-both/showers-both.png",
500: "../public/weather-both/rain-both.png",
501: "../public/weather-both/rain-both.png",
502: "../public/weather-both/rain-both.png",
503: "../public/weather-both/rain-both.png",
504: "../public/weather-both/rain-both.png",
511: "../public/weather-both/freezing-rain-both.png",
520: "../public/weather-both/showers-both.png",
521: "../public/weather-both/showers-both.png",
522: "../public/weather-both/showers-both.png",
531: "../public/weather-both/showers-both.png",

// Snow - typically use both day and night images
600: "public/weather-both/snow-both.png",
601: "public/weather-both/snow-both.png",
602: "public/weather-both/snow-both.png",
611: "public/weather-both/sleet-both.png",
612: "public/weather-both/sleet-both.png",
613: "public/weather-both/sleet-both.png",
615: "public/weather-both/rain-and-snow-both.png",
616: "public/weather-both/rain-and-snow-both.png",
620: "public/weather-both/snow-both.png",
621: "public/weather-both/snow-both.png",
622: "public/weather-both/snow-both.png",
600: "../public/weather-both/snow-both.png",
601: "../public/weather-both/snow-both.png",
602: "../public/weather-both/snow-both.png",
611: "../public/weather-both/sleet-both.png",
612: "../public/weather-both/sleet-both.png",
613: "../public/weather-both/sleet-both.png",
615: "../public/weather-both/rain-and-snow-both.png",
616: "../public/weather-both/rain-and-snow-both.png",
620: "../public/weather-both/snow-both.png",
621: "../public/weather-both/snow-both.png",
622: "../public/weather-both/snow-both.png",

// Atmosphere - typically use both day and night images
701: "public/weather-both/fog-both.png",
711: "public/weather-both/smoke-both.png",
721: "public/weather-both/haze-both.png",
731: "public/weather-both/dust-both.png",
741: "public/weather-both/fog-both.png",
751: "public/weather-both/sand-both.png",
761: "public/weather-both/dust-both.png",
762: "public/weather-both/ash-both.png",
771: "public/weather-both/windy-both.png",
701: "../public/weather-both/fog-both.png",
711: "../public/weather-both/smoke-both.png",
721: "../public/weather-both/haze-both.png",
731: "../public/weather-both/dust-both.png",
741: "../public/weather-both/fog-both.png",
751: "../public/weather-both/sand-both.png",
761: "../public/weather-both/dust-both.png",
762: "../public/weather-both/ash-both.png",
771: "../public/weather-both/windy-both.png",

// Clear - use night or day images
800: ["public/weather-day/sun-day.png", "public/weather-night/clear-night.png"],
800: ["../public/weather-day/sun-day.png", "../public/weather-night/clear-night.png"],

// Clouds
801: ["public/weather-day/mostly-sunny-day.png", "public/weather-night/mostly-clear-night.png"],
802: ["public/weather-day/partly-sunny-day.png", "public/weather-night/partly-cloudy-night.png"],
803: ["public/weather-day/intermitten-clouds-day.png", "public/weather-night/intermitten-clouds-night.png"],
804: ["public/weather-day/mostly-cloudy-day.png", "public/weather-night/mostly-cloudy-night.png"]
801: ["../public/weather-day/mostly-sunny-day.png", "../public/weather-night/mostly-clear-night.png"],
802: ["../public/weather-day/partly-sunny-day.png", "../public/weather-night/partly-cloudy-night.png"],
803: ["../public/weather-day/intermitten-clouds-day.png", "../public/weather-night/intermitten-clouds-night.png"],
804: ["../public/weather-day/mostly-cloudy-day.png", "../public/weather-night/mostly-cloudy-night.png"]
};

// TODO: create a boolean function for weather it's day, night or in between
Expand Down

0 comments on commit 13b69d7

Please sign in to comment.