{"version":3,"sources":["InfoBox.js","LineGraph.js","Table.js","util.js","Map.js","App.js","serviceWorker.js","index.js"],"names":["InfoBox","title","cases","total","active","isRed","props","console","log","Card","onClick","className","CardContent","Typography","color","gutterBottom","options","legend","display","elements","point","radius","maintainAspectRatio","tooltips","mode","intersect","callbacks","label","tooltipItem","data","numeral","value","format","scales","xAxes","type","time","tooltipFormat","yAxes","gridLines","ticks","callback","index","values","buildChartData","casesType","lastDataPoint","chartData","date","newDataPoint","x","y","push","LineGraph","useState","setData","useEffect","a","fetch","then","response","json","fetchData","length","datasets","backgroundColor","borderColor","Table","countries","map","country","casesTypeColors","hex","rgb","half_op","multiplier","recovered","deaths","sortData","sortedData","sort","b","prettyPrintStat","stat","Map","center","zoom","TileLayer","url","attribution","Circle","countryInfo","lat","long","fillColor","fillOpacity","Math","sqrt","Popup","style","backgroundImage","flag","showDataOnMap","App","setInputCountry","setCountryInfo","setCountries","mapCountries","setMapCountries","tableData","setTableData","setCasesType","lng","mapCenter","setMapCenter","mapZoom","setMapZoom","name","iso2","getCountriesData","onCountryChange","e","countryCode","target","FormControl","Select","variant","onChange","MenuItem","todayCases","todayRecovered","todayDeaths","Boolean","window","location","hostname","match","ReactDOM","render","StrictMode","document","getElementById","navigator","serviceWorker","ready","registration","unregister","catch","error","message"],"mappings":"6YA6BeA,MAzBf,YAAoE,IAAjDC,EAAgD,EAAhDA,MAAOC,EAAyC,EAAzCA,MAAOC,EAAkC,EAAlCA,MAAOC,EAA2B,EAA3BA,OAAQC,EAAmB,EAAnBA,MAAUC,EAAS,0DAEjE,OADAC,QAAQC,IAAIP,EAAOG,GAEjB,kBAACK,EAAA,EAAD,CACEC,QAASJ,EAAMI,QACfC,UAAS,kBAAaP,GAAU,oBAAvB,YACPC,GAAS,iBAGX,kBAACO,EAAA,EAAD,KACE,kBAACC,EAAA,EAAD,CAAYC,MAAM,gBAAgBC,cAAY,GAC3Cd,GAEH,wBAAIU,UAAS,0BAAqBN,GAAS,0BACxCH,GAGH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K,EACLD,OAAsB,WAAdyC,EACR3C,MAAOgF,EAAgBS,EAAYwC,aACnChI,MAAO2B,IAAQ6D,EAAYd,QAAQ7C,OAAO,WAG9C,kBAAC,EAAD,CACEoC,UAAWuC,EACX9D,UAAWA,EACXwC,OAAQ4B,EACR3B,KAAM6B,KAGV,kBAAC1G,EAAA,EAAD,CAAME,UAAU,cACd,kBAACC,EAAA,EAAD,KACE,yBAAKD,UAAU,oBACb,qDACA,kBAAC,EAAD,CAAOyD,UAAWyC,IAClB,6CAAmBhE,GACnB,kBAAC,EAAD,CAAWA,UAAWA,UCrHduF,QACW,cAA7BC,OAAOC,SAASC,UAEe,UAA7BF,OAAOC,SAASC,UAEhBF,OAAOC,SAASC,SAASC,MACvB,2DCZNC,IAASC,OACP,kBAAC,IAAMC,WAAP,KACE,kBAAC,EAAD,OAEFC,SAASC,eAAe,SDyHpB,kBAAmBC,WACrBA,UAAUC,cAAcC,MACrBrF,MAAK,SAAAsF,GACJA,EAAaC,gBAEdC,OAAM,SAAAC,GACL7I,QAAQ6I,MAAMA,EAAMC,a","file":"static/js/main.a304eec8.chunk.js","sourcesContent":["import React from \"react\";\nimport { Card, CardContent, Typography } from \"@material-ui/core\";\nimport \"./InfoBox.css\";\n\nfunction InfoBox({ title, cases, total, active, isRed, ...props }) {\n console.log(title, active);\n return (\n \n \n \n {title}\n \n

\n {cases}\n

\n\n \n {total} Total\n \n
\n \n );\n}\n\nexport default InfoBox;\n","import React, { useState, useEffect } from \"react\";\nimport { Line } from \"react-chartjs-2\";\nimport numeral from \"numeral\";\n\nconst options = {\n legend: {\n display: false,\n },\n elements: {\n point: {\n radius: 0,\n },\n },\n maintainAspectRatio: false,\n tooltips: {\n mode: \"index\",\n intersect: false,\n callbacks: {\n label: function (tooltipItem, data) {\n return numeral(tooltipItem.value).format(\"+0,0\");\n },\n },\n },\n scales: {\n xAxes: [\n {\n type: \"time\",\n time: {\n format: \"MM/DD/YY\",\n tooltipFormat: \"ll\",\n },\n },\n ],\n yAxes: [\n {\n gridLines: {\n display: false,\n },\n ticks: {\n // Include a dollar sign in the ticks\n callback: function (value, index, values) {\n return numeral(value).format(\"0a\");\n },\n },\n },\n ],\n },\n};\n\nconst buildChartData = (data, casesType) => {\n let chartData = [];\n let lastDataPoint;\n for (let date in data.cases) {\n if (lastDataPoint) {\n let newDataPoint = {\n x: date,\n y: data[casesType][date] - lastDataPoint,\n };\n chartData.push(newDataPoint);\n }\n lastDataPoint = data[casesType][date];\n }\n return chartData;\n};\n\nfunction LineGraph({ casesType }) {\n const [data, setData] = useState({});\n\n useEffect(() => {\n const fetchData = async () => {\n await fetch(\"https://disease.sh/v3/covid-19/historical/all?lastdays=120\")\n .then((response) => {\n return response.json();\n })\n .then((data) => {\n let chartData = buildChartData(data, casesType);\n setData(chartData);\n console.log(chartData);\n // buildChart(chartData);\n });\n };\n\n fetchData();\n }, [casesType]);\n\n return (\n
\n {data?.length > 0 && (\n \n )}\n
\n );\n}\n\nexport default LineGraph;\n","import React from \"react\";\nimport \"./Table.css\";\nimport numeral from \"numeral\";\n\nfunction Table({ countries }) {\n return (\n
\n {countries.map((country) => (\n \n {country.country}\n \n {numeral(country.cases).format(\"0,0\")}\n \n \n ))}\n
\n );\n}\n\nexport default Table;\n","import React from \"react\";\nimport numeral from \"numeral\";\nimport { Circle, Popup } from \"react-leaflet\";\n\nconst casesTypeColors = {\n cases: {\n hex: \"#CC1034\",\n rgb: \"rgb(204, 16, 52)\",\n half_op: \"rgba(204, 16, 52, 0.5)\",\n multiplier: 800,\n },\n recovered: {\n hex: \"#7dd71d\",\n rgb: \"rgb(125, 215, 29)\",\n half_op: \"rgba(125, 215, 29, 0.5)\",\n multiplier: 1200,\n },\n deaths: {\n hex: \"#fb4443\",\n rgb: \"rgb(251, 68, 67)\",\n half_op: \"rgba(251, 68, 67, 0.5)\",\n multiplier: 2000,\n },\n};\n\nexport const sortData = (data) => {\n let sortedData = [...data];\n sortedData.sort((a, b) => {\n if (a.cases > b.cases) {\n return -1;\n } else {\n return 1;\n }\n });\n return sortedData;\n};\n\nexport const prettyPrintStat = (stat) =>\n stat ? `+${numeral(stat).format(\"0.0a\")}` : \"+0\";\n\nexport const showDataOnMap = (data, casesType = \"cases\") =>\n data.map((country) => (\n \n \n
\n
\n
{country.country}
\n
\n Cases: {numeral(country.cases).format(\"0,0\")}\n
\n
\n Recovered: {numeral(country.recovered).format(\"0,0\")}\n
\n
\n Deaths: {numeral(country.deaths).format(\"0,0\")}\n
\n \n
\n \n ));\n","import React from \"react\";\nimport { Map as LeafletMap, TileLayer } from \"react-leaflet\";\nimport \"./Map.css\";\nimport { showDataOnMap } from \"./util\";\n\nfunction Map({ countries, casesType, center, zoom }) {\n return (\n
\n \n \n {showDataOnMap(countries, casesType)}\n \n
\n );\n}\n\nexport default Map;\n","import React, { useState, useEffect } from \"react\";\nimport \"./App.css\";\nimport {\n MenuItem,\n FormControl,\n Select,\n Card,\n CardContent,\n} from \"@material-ui/core\";\nimport InfoBox from \"./InfoBox\";\nimport LineGraph from \"./LineGraph\";\nimport Table from \"./Table\";\nimport { sortData, prettyPrintStat } from \"./util\";\nimport numeral from \"numeral\";\nimport Map from \"./Map\";\nimport \"leaflet/dist/leaflet.css\";\n\nconst App = () => {\n const [country, setInputCountry] = useState(\"worldwide\");\n const [countryInfo, setCountryInfo] = useState({});\n const [countries, setCountries] = useState([]);\n const [mapCountries, setMapCountries] = useState([]);\n const [tableData, setTableData] = useState([]);\n const [casesType, setCasesType] = useState(\"cases\");\n const [mapCenter, setMapCenter] = useState({ lat: 34.80746, lng: -40.4796 });\n const [mapZoom, setMapZoom] = useState(3);\n\n useEffect(() => {\n fetch(\"https://disease.sh/v3/covid-19/all\")\n .then((response) => response.json())\n .then((data) => {\n setCountryInfo(data);\n });\n }, []);\n\n useEffect(() => {\n const getCountriesData = async () => {\n fetch(\"https://disease.sh/v3/covid-19/countries\")\n .then((response) => response.json())\n .then((data) => {\n const countries = data.map((country) => ({\n name: country.country,\n value: country.countryInfo.iso2,\n }));\n let sortedData = sortData(data);\n setCountries(countries);\n setMapCountries(data);\n setTableData(sortedData);\n });\n };\n\n getCountriesData();\n }, []);\n\n console.log(casesType);\n\n const onCountryChange = async (e) => {\n const countryCode = e.target.value;\n\n const url =\n countryCode === \"worldwide\"\n ? \"https://disease.sh/v3/covid-19/all\"\n : `https://disease.sh/v3/covid-19/countries/${countryCode}`;\n await fetch(url)\n .then((response) => response.json())\n .then((data) => {\n setInputCountry(countryCode);\n setCountryInfo(data);\n setMapCenter([data.countryInfo.lat, data.countryInfo.long]);\n setMapZoom(4);\n });\n };\n\n return (\n
\n
\n
\n

COVID-19 Tracker

\n \n \n Worldwide\n {countries.map((country) => (\n {country.name}\n ))}\n \n \n
\n
\n setCasesType(\"cases\")}\n title=\"Coronavirus Cases\"\n isRed\n active={casesType === \"cases\"}\n cases={prettyPrintStat(countryInfo.todayCases)}\n total={numeral(countryInfo.cases).format(\"0.0a\")}\n />\n setCasesType(\"recovered\")}\n title=\"Recovered\"\n active={casesType === \"recovered\"}\n cases={prettyPrintStat(countryInfo.todayRecovered)}\n total={numeral(countryInfo.recovered).format(\"0.0a\")}\n />\n setCasesType(\"deaths\")}\n title=\"Deaths\"\n isRed\n active={casesType === \"deaths\"}\n cases={prettyPrintStat(countryInfo.todayDeaths)}\n total={numeral(countryInfo.deaths).format(\"0.0a\")}\n />\n
\n \n
\n \n \n
\n

Live Cases by Country

\n \n

Worldwide new {casesType}

\n \n \n \n \n \n );\n};\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.0/8 are considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl, {\n headers: { 'Service-Worker': 'script' },\n })\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready\n .then(registration => {\n registration.unregister();\n })\n .catch(error => {\n console.error(error.message);\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}