{"version":3,"sources":["components/Footer.js","components/Map.js","App.js","reportWebVitals.js","index.js"],"names":["Footer","href","Map","useState","loading","setLoading","isError","setIsError","useEffect","getWeather","possiblePokemon","rainy","sunny","wind","snow","cloudy","fog","clear","mist","thunder","a","index","allCities","length","city","url","process","name","axios","get","weatherData","weatherForLocation","data","current","condition","text","toLowerCase","includes","weather","ally","getPokemonWithWeather","LeafIcon","L","extend","options","iconSize","pokemonToGrab","pokemonToSend","spriteUrl","sprites","front_default","sprite","icon","iconUrl","className","width","border","src","alt","MapContainer","center","zoom","scrollWheelZoom","TileLayer","attribution","map","Marker","position","latitude","longitude","keyboard","Popup","class","closeOnEscapeKey","onClick","App","id","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode","document","getElementById"],"mappings":"g7DAYeA,EAVA,WACb,OACE,iCACE,4BACE,mBAAGC,KAAK,kCAAR,gD,+FC8OOC,EA9OH,WACV,MAA8BC,oBAAS,GAAvC,mBAAOC,EAAP,KAAgBC,EAAhB,KACA,EAA8BF,oBAAS,GAAvC,mBAAOG,EAAP,KAAgBC,EAAhB,KAEAC,qBAAU,WACRC,OAGF,IAAMC,EAAkB,CACtBC,MAAO,QACPC,MAAO,YACPC,KAAM,YACNC,KAAM,UACNC,OAAQ,SACRC,IAAK,UACLC,MAAO,WACPC,KAAM,oBACNC,QAAS,UAKLV,EAAU,uCAAG,oCAAAW,EAAA,+DAENC,EAAQ,EAFF,YAEKA,EAAQC,IAAUC,QAFvB,wBAGTC,EAAOF,IAAUD,GACfI,EAJO,yDAFAC,kCAEA,cAIiEF,EAAKG,KAJtE,oBAKaC,IAAMC,IAAIJ,GALvB,cAKPK,EALO,QAOTC,EACFD,EAAYE,KAAKC,QAAQC,UAAUC,KAAKC,eAGrBC,SAAS,WAC5BN,EAAmBM,SAAS,YAE5BN,EAAqB,SAErBA,EAAmBM,SAAS,SAC5BN,EAAmBM,SAAS,WAE5BN,EAAqB,QAErBA,E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GR,wCAEF,+BACE,6BACE,qBACED,IAAI,mFACJC,IAAI,cAGR,yCAEF,+BACE,6BACE,qBACED,IAAI,mFACJC,IAAI,aAGR,oDAKR,0BAASJ,UAAU,MAAnB,UACE,2DACChD,EAAU,qEAA8C,KACzD,eAACqD,EAAA,EAAD,CACEC,OAAQ,CAAC,OAAQ,MACjBC,KAAM,IACNC,iBAAiB,EAHnB,UAKE,cAACC,EAAA,EAAD,CACEC,YAAY,yEACZvC,IAAI,uDAELH,IAAU2C,KAAI,SAACzC,GACd,OACE,cAAC0C,EAAA,EAAD,CAEEC,SAAU,CAAC3C,EAAK4C,SAAU5C,EAAK6C,WAC/BjB,KAAM5B,EAAK4B,KACXM,IAAKlC,EAAKe,KACV+B,SAAS,OALX,SAOE,eAACC,EAAA,EAAD,CAAOC,MAAM,QAAQC,iBAAiB,OAAtC,UACGjD,EAAKG,KACN,uBACCH,EAAKc,YATHd,EAAKG,YAelB,wBAAQ+C,QArIM,WACpBrE,GAAW,GACXI,KAmIM,sCAMJ,qCACE,mBAAG6C,UAAU,iBAAb,wBACChD,EAAU,qEAA8C,SC3NlDqE,MAff,WACE,OACE,sBAAKrB,UAAU,MAAf,UACE,yBAAQA,UAAU,aAAlB,UACE,gDACA,2FAEF,sBAAMsB,GAAG,OAAT,SACE,cAAC,EAAD,MAEF,cAAC,EAAD,QCFSC,EAZS,SAAAC,GAClBA,GAAeA,aAAuBC,UACxC,6BAAqBC,MAAK,YAAkD,IAA/CC,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,OCDdQ,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,MAEFC,SAASC,eAAe,SAM1Bb,M","file":"static/js/main.ba040f1e.chunk.js","sourcesContent":["import React from \"react\";\n\nconst Footer = () => {\n return (\n \n );\n};\n\nexport default Footer;\n","import { useEffect, useState } from \"react\";\nimport { MapContainer, TileLayer, Marker, Popup } from \"react-leaflet\";\nimport { allCities } from \"../data/cities.json\";\nimport * as L from \"leaflet\";\nimport axios from \"axios\";\n\nconst Map = () => {\n const [loading, setLoading] = useState(true);\n const [isError, setIsError] = useState(false);\n\n useEffect(() => {\n getWeather();\n });\n\n const possiblePokemon = {\n rainy: \"lotad\",\n sunny: \"growlithe\",\n wind: \"pidgeotto\",\n snow: \"cubchoo\",\n cloudy: \"swablu\",\n fog: \"litwick\",\n clear: \"clefairy\",\n mist: \"mimikyu-disguised\",\n thunder: \"zapdos\",\n };\n\n const weatherKey = process.env.REACT_APP_WEATHER_API_KEY;\n\n const getWeather = async () => {\n try {\n for (let index = 0; index < allCities.length; index++) {\n let city = allCities[index];\n const url = `https://api.weatherapi.com/v1/current.json?key=${weatherKey}&q=${city.name}&aqi=no`;\n const weatherData = await axios.get(url);\n\n let weatherForLocation =\n weatherData.data.current.condition.text.toLowerCase();\n\n if (\n weatherForLocation.includes(\"cloudy\") ||\n weatherForLocation.includes(\"overcast\")\n ) {\n weatherForLocation = \"cloudy\";\n } else if (\n weatherForLocation.includes(\"rain\") ||\n weatherForLocation.includes(\"drizzle\")\n ) {\n weatherForLocation = \"rainy\";\n } else if (\n weatherForLocation.includes(\"thundery\") ||\n weatherForLocation.includes(\"thunder\")\n ) {\n weatherForLocation = \"thunder\";\n } else if (weatherForLocation.includes(\"fog\")) {\n weatherForLocation = \"fog\";\n } else if (weatherForLocation.includes(\"snow\")) {\n weatherForLocation = \"snow\";\n }\n\n city.weather = weatherForLocation.toLowerCase();\n\n city.ally = city.name + \"\" + city.weather;\n\n await getPokemonWithWeather(city);\n }\n setIsError(false);\n setLoading(false);\n } catch (error) {\n setIsError(true);\n }\n };\n\n const LeafIcon = L.Icon.extend({\n options: {\n iconSize: [60, 60],\n },\n });\n\n const getPokemonWithWeather = async (city) => {\n try {\n let pokemonToGrab = possiblePokemon[city.weather];\n const url = `https://pokeapi.co/api/v2/pokemon/${pokemonToGrab}`;\n if (url !== \"https://pokeapi.co/api/v2/pokemon/undefined\") {\n const pokemonToSend = await axios.get(url);\n const spriteUrl = pokemonToSend.data.sprites.front_default;\n city.sprite = spriteUrl;\n\n city.icon = new LeafIcon({\n iconUrl: city.sprite,\n });\n }\n } catch (error) {\n setIsError(true);\n }\n setIsError(false);\n };\n\n const reloadWeather = () => {\n setLoading(true);\n getWeather();\n };\n\n if (loading === false) {\n return (\n <>\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Map key
PokemonWeather
\n \n Cloudy or overcast
\n \n Clear
\n \n Rainy
\n \n Sunny
\n \n Windy
\n \n Snow
\n \n Fog
\n \n Mist
\n \n Thunder
\n
\n
\n

Map of the UK and Ireland

\n {isError ?

There was an error. Please try again

: null}\n \n \n {allCities.map((city) => {\n return (\n \n \n {city.name}\n
\n {city.weather}\n
\n \n );\n })}\n \n \n
\n \n );\n } else {\n return (\n <>\n

Loading...

\n {isError ?

There was an error. Please try again

: null}\n \n );\n }\n};\n\nexport default Map;\n","import \"./App.css\";\nimport Footer from \"./components/Footer\";\nimport Map from \"./components/Map\";\n\nfunction App() {\n return (\n
\n
\n

Pokéweather

\n

Track daily UK and Ireland weather, through Pokémon!

\n
\n
\n \n
\n
\n );\n}\n\nexport default App;\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}