1(this["webpackJsonpcovid-dashboard"]=this["webpackJsonpcovid-dashboard"]||[]).push([[0],{375:function(e,t,a){},378:function(e,t,a){"use strict";a.r(t);var r=a(0),c=a(53),s=a.n(c),n=a(23),l=a.n(n),o=a(41),i=a(15),d=a(95),u=a.n(d),j=a(2),b=function(e){var t=e.className,a=e.title,r=e.getTextInput,c=e.inputValue,s=e.children;return Object(j.jsxs)("div",{className:"".concat(t," bg-blue-dark p-2 rounded"),children:[Object(j.jsx)("h3",{className:"text-center text-blue-verylight font-semibold",children:a}),Object(j.jsx)("div",{className:"pt-3 flex justify-center",children:Object(j.jsx)("input",{type:"text",className:"bg-gray-100 w-4/5 placeholder-red-light text-blue-verydark px-2 rounded outline-none mb-3 py-1",placeholder:"Search ...",onChange:function(e){return r(e)},value:c})}),s]})},x=u.a.create({baseURL:"https://disease.sh/v3/covid-19"}),h=a(391),m=function(){return Object(j.jsxs)("div",{className:"flex flex-col items-center",children:[Object(j.jsx)("p",{children:Object(j.jsx)("i",{className:"las la-frown text-blue-verylight text-4xl"})}),Object(j.jsx)("p",{children:"Sorry, something went wrong! "})]})},f=a(168),p=a.n(f),O=function(){return Object(j.jsxs)("div",{className:"flex flex-col items-center",children:[Object(j.jsx)(p.a,{type:"Hearts",height:60,width:60,color:"#ded9ff"}),Object(j.jsx)("p",{className:"text-center text-blue-verylight",children:"Loading..."})]})},v=function(){var e=Object(r.useState)(""),t=Object(i.a)(e,2),a=t[0],c=t[1],s=Object(h.a)(["countriesData"],Object(o.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x.get("/countries");case 2:return t=e.sent,(a=t.data).forEach(function(){var e=Object(o.a)(l.a.mark((function e(t){var a,r,c;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(a=t.countryInfo.iso2)){e.next=7;break}return e.next=4,u.a.get("https://restcountries.eu/rest/v2/alpha/".concat(a),{});case 4:r=e.sent,c=r.data,t.country=c.name;case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)}))),{refetchOnWindowFocus:!1}),n=s.isSuccess,d=s.isLoading,f=s.isError,p=s.data,v=n?p.map((function(e,t){return 0!==a.length?-1!==e.country.toLowerCase().indexOf(a.toLowerCase())?Object(j.jsxs)("div",{className:"grid grid-cols-6 auto-rows-max my-1 bg-blue-verydark rounded p-2 text-white",children:[Object(j.jsx)("div",{className:"col-start-1 col-span-2 flex items-center mr-2 row-start-1 row-end-2",children:Object(j.jsx)("img",{src:e.countryInfo.flag,alt:e.country})}),Object(j.jsx)("div",{className:" col-start-3 col-span-4",children:Object(j.jsxs)("div",{className:"flex flex-col justify-around",children:[Object(j.jsxs)("p",{children:["C: ",(new Intl.NumberFormat).format(e.cases)]}),Object(j.jsxs)("p",{children:["D: ",(new Intl.NumberFormat).format(e.deaths)]})]})}),Object(j.jsx)("div",{className:"col-start-1 col-span-6 row-start-2 row-end-3",children:Object(j.jsx)("p",{className:"text-left truncate ",children:e.country})})]},null===e.countryInfo._id?t:e.countryInfo._id):null:Object(j.jsxs)("div",{className:"grid grid-cols-6 auto-rows-max my-1 bg-blue-verydark rounded text-white p-2",children:[Object(j.jsx)("div",{className:"col-start-1 col-span-2 flex items-center mr-2 row-start-1 row-end-2",children:Object(j.jsx)("img",{src:e.countryInfo.flag,alt:e.country})}),Object(j.jsx)("div",{className:" col-start-3 col-span-4",children:Object(j.jsxs)("div",{className:"flex flex-col justify-around",children:[Object(j.jsxs)("p",{children:["C: ",(new Intl.NumberFormat).format(e.cases)]}),Object(j.jsxs)("p",{children:["D: ",(new Intl.NumberFormat).format(e.deaths)]})]})}),Object(j.jsx)("div",{className:"col-start-1 col-span-6 row-start-2 row-end-3",children:Object(j.jsx)("p",{className:"text-left truncate ",children:e.country})})]},null===e.countryInfo._id?t:e.countryInfo._id)})):null;return Object(j.jsxs)(b,{getTextInput:function(e){c(e.target.value)},inputValue:a,title:"Cases and Deaths by country",className:"col-start-1 col-span-10 row-start-3 countries__aside overflow-hidden sm:row-start-2 sm:row-end-3 sm:col-span-3 lg:col-span-2",children:[n&&Object(j.jsx)("div",{className:"h-full overflow-y-auto",children:v.every((function(e){return null===e}))?Object(j.jsxs)("p",{className:"text-left text-xl text-blue-verylight",children:["We couldn't find the country"," ",Object(j.jsx)("i",{className:"las la-heart-broken text-5xl block text-center"})]}):v}),d&&Object(j.jsx)(O,{}),f&&Object(j.jsx)(m,{})]})},g=function(e){var t=e.children,a=e.className;return Object(j.jsx)("div",{className:"".concat(a," bg-blue-dark flex flex-col items-center text-blue-verylight p-2 rounded"),children:t})},w=function(e){var t=e.totalKeys,a=Object(r.useState)("vaccine"),c=Object(i.a)(a,2),s=c[0],n=c[1],d=Object(h.a)(["totalInfo",s],Object(o.a)(l.a.mark((function e(){var t,a,r,c;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vaccine"!==s){e.next=8;break}return e.next=3,x.get("/vaccine/coverage",{params:{lastdays:1}});case 3:return t=e.sent,a=t.data,e.abrupt("return",a[Object.keys(a)[0]]);case 8:if("vaccine"===s){e.next=15;break}return e.next=11,x.get("/all");case 11:return r=e.sent,c=r.data,console.log(c[s]),e.abrupt("return",c[s]);case 15:case"end":return e.stop()}}),e)}))),{refetchOnWindowFocus:!1}
1),u=d.isSuccess,b=d.isLoading,f=d.isError,p=d.data,v=function(e){var a=t,r=a.indexOf(s);"previous_option"===e.target.id?n(0===r?a[a.length-1]:a[r-1]):"next_option"===e.target.id&&(r===a.length-1?n(a[0]):n(a[r+1]))};return Object(j.jsxs)(g,{className:"col-start-1 col-span-10 row-start-1 row-end-2 sm:col-span-3 lg:col-span-2",children:[u&&Object(j.jsxs)(j.Fragment,{children:[Object(j.jsxs)("p",{className:"font-bold text-center",children:["Total ",Object(j.jsx)("span",{className:"text-white",children:s})," ","vaccine"===s?"administered":"by covid-19"]}),Object(j.jsx)("p",{className:"font-bold text-2xl my-2",children:(new Intl.NumberFormat).format(p)}),Object(j.jsxs)("div",{className:"flex items-center w-3/4 justify-center bg-blue-verydark rounded",children:[Object(j.jsx)("span",{onClick:function(e){return v(e)},children:Object(j.jsx)("i",{className:"las la-caret-left text-2xl cursor-pointer",id:"previous_option"})}),Object(j.jsx)("p",{className:"px-1 text-white w-2/4 text-center",children:s.charAt(0).toUpperCase()+s.slice(1)}),Object(j.jsx)("span",{onClick:function(e){return v(e)},children:Object(j.jsx)("i",{className:"las la-caret-right text-2xl cursor-pointer",id:"next_option"})})]})]}),b&&Object(j.jsx)(O,{}),f&&Object(j.jsx)(m,{})]})},y=a(75),N=a(381),k=a(382),I=a(185),C=a(186),F=a(84),S=a(81),D=a(189),E=function(e){return e>1e9?(e/1e9).toFixed(1).toString()+"B+":e>1e6?(e/1e6).toFixed(1).toString()+"M+":e>1e3?(e/1e3).toFixed(1).toString()+"K+":e.toString()},_=function(e){var t=e.data,a=e.title,r=e.dataKey;return Object(j.jsxs)("div",{className:"relative bg-blue-verydark rounded lg:flex-1 hv-30",children:[Object(j.jsx)("p",{className:"font-semibold text-blue-verylight text-center pb-2",children:a}),Object(j.jsx)(N.a,{width:"85%",height:"70%",className:"bg-red-dark rounded mx-auto",children:Object(j.jsxs)(k.a,{width:275,height:300,data:t,margin:{top:5,left
1:5,right:5,bottom:5},children:[Object(j.jsx)(I.a,{tick:{fill:"#7579e7"},dataKey:"date"}),Object(j.jsx)(C.a,{tick:{fill:"#7579e7"},type:"number",tickFormatter:E}),Object(j.jsx)(F.a,{itemStyle:{color:"#7579e7"}}),Object(j.jsx)(S.a,{}),Object(j.jsx)(D.a,{type:"monotone",dataKey:r,stroke:"#ded9ff",activeDot:{r:8}})]})})]})},L=function(){var e=function(e,t){var a=[],r=0;if("vaccine"===t)for(var c=0,s=Object.entries(e);c<s.length;c++){var n=Object(i.a)(s[c],2),l=n[0],o=n[1];a.push(Object(y.a)({date:l},t,o))}else for(var d=0,u=Object.entries(e);d<u.length;d++){var j=Object(i.a)(u[d],2),b=j[0],x=j[1];a.push(Object(y.a)({date:b},t,x-r)),r=x}return a},t=function(){var t=Object(o.a)(l.a.mark((function t(a,r){var c,s;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.get(a,{params:{lastdays:"all"}});case 2:if(c=t.sent,s=c.data,"vaccine"===r){t.next=6;break}return t.abrupt("return",e(s[r],r));case 6:return t.abrupt("return",e(s,r));case 7:case"end":return t.stop()}}),t)})));return function(e,a){return t.apply(this,arguments)}}(),a=Object(h.a)(["vacineChartData"],(function(){return t("/vaccine/coverage","vaccine")}),{refetchOnWindowFocus:!1}),r=a.data,c=a.isError,s=a.isLoading,n=Object(h.a)(["deathsChartData"],(function(){return t("/historical/all","deaths")}),{refetchOnWindowFocus:!1}),d=n.data,u=n.isError,b=n.isLoading,f=Object(h.a)(["casesChartData"],(function(){return t("/historical/all","cases")}),{refetchOnWindowFocus:!1}),p=f.data,v=f.isError,g=f.isLoading,w=function(e,t,a,r,c){return e?Object(j.jsx)(O,{}):t?Object(j.jsx)(m,{}):Object(j.jsx)(_,{data:a,title:c,dataKey:r})};return Object(j.jsxs)("div",{className:"bg-blue-dark grid lg:grid-rows-3 auto-rows-auto grid-cols-1 lg:grid-cols-1 p-2 rounded col-start-1 col-span-10 row-start-2 gap-y-4 sm:col-start-4 sm:col-span-7 sm:row-start-1 row-end-3 lg:col-start-8 lg:col-span-full lg:flex lg:flex-col",children:[w(g,v,p,"cases","Daily cases"),w(b,u,d,"deaths","Daily deaths"),w(s,c,r,"vaccine","Total vaccine dosis")]})},W=a(387),K=a(388),M=a(392),T=(a(373),a(187)),G=a(35),U=a.n(G),z=a(386),A=function(e){var t=e.text,a=e.children,r=e.lat,c=e.long,s=Object(T.renderToStaticMarkup)(Object(j.jsx)("div",{className:"bg-red-600 w-8 h-8 shadow text-white flex justify-center items-center rounded-full",children:Object(j.jsx)("p",{className:"font-small font-semibold",children:E(t)})})),n=U.a.divIcon({html:s});return Object(j.jsxs)(z.a,{position:[r,c],icon:n,children:[" ",a," "]})},J=function(){var e=Object(r.useState)([]),t=Object(i.a)(e,2),a=t[0],c=t[1];Object(r.useEffect)((function(){(function(){var e=Object(o.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x.get("/countries");case 2:t=e.sent,a=t.data,c(a);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[]);var s=a.map((function(e){return Object(j.jsx)(A,{text:e.cases,lat:e.countryInfo.lat,long:e.countryInfo.long,children:Object(j.jsxs)(W.a,{className:"bg-gray-300",children:[Object(j.jsxs)("div",{className:"flex justify-around items-center flex-col",children:[Object(j.jsx)("img",{className:"w-2/4 h-auto",src:e.countryInfo.flag,alt:""}),Object(j.jsx)("span",{className:"font-semibold",children:e.country})]}),Object(j.jsxs)("span",{className:"my-1 block ",children:[" ",Object(j.jsx)("span",{className:"font-semibold",children:"Confirmed: "}),E(e.cases)]}),Object(j.jsxs)("span",{className:"my-1 block ",children:[Object(j.jsx)("span",{className:"font-semibold",children:"Deaths: "})," ",E(e.deaths)]}),Object(j.jsxs)("span",{className:"my-1 block",children:[Object(j.jsx)("span",{className:"font-semibold",children:"Recovered: "})," ",E(e.recovered)]})]})})}));return Object(j.jsx)("div",{className:" bg-blue-dark rounded col-start-1 col-span-10 row-start-4 map lg:col-start-3 lg:col-end-8 lg:row-start-1 lg:row-span-2 lg:h-full",children:Object(j.jsxs)(K.a,{center:[8.752900594999996,-82.87873458499998],zoom:2,className:"h-full rounded",scrollWheelZoom:!1,children:[Object(j.jsx)(M.a,{attribution:'\xa9 <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery \xa9 <a href="https://www.mapbox.com/">Mapbox</a> contributors',url:"https://api.mapbox.com/styles/v1/maped2280/ckqr6z9xs2axw18pj82p0vhvm/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoibWFwZWQyMjgwIiwiYSI6ImNrcXI3NHRmcDFiaXUyb3A1eGh0dGV2bDEifQ.9OYTtIw85NvEgGE-f1U6og"}),s]})})},R=function(){return Object(j.jsxs)("div",{className:"grid grid-cols-10 auto-rows-auto gap-2 flex-1 overflow-hidden",children:[Object(j.jsx)(w,{totalKeys:["vaccine","deaths","cases","recovered","active"]}),Object(j.jsx)(v,{}),Object(j.jsx)(J,{}),Object(j.jsx)(L,{})]})},V=function(e){var t=e.title,a=e.name;e.icon;return Object(j.jsxs)("div",{className:"p-2 bg-blue-verydark flex justify-between items-center mb-2 rounded",children:[Object(j.jsxs)("p",{className:"text-gray-100 text-center",children:[a," ",Object(j.jsx)("i",{className:"las la-heart text-white text-lg"})]}),Object(j.jsx)("h1",{className:"text-gray-100 text-center text-lg font-bold tracking-wide",children:t}),Object(j.jsx)("div",{children:Object(j.jsxs)("a",{href:"https://github.com/Elvis2280/covid-19-dashboard/tree/master",rel:"noreferrer",target:"_blank",children:[" ",Object(j.jsx)("i",{className:"lab la-github-alt text-white text-2xl mr-5"})]})})]})},Y=(a(375),a(376),a(390)),q=a(169),B=new Y.a,H=function(){return Object(j.jsx)(q.a,{client:B,children:Object(j.jsx)("div",{className:"w-full bg-gray-200 px-3 ",children:Object(j.jsxs)("div",{className:"max-w-7xl mx-auto min-h-screen flex flex-col py-2",children:[Object(j.jsx)(V,{title:"Covid-19 Global Cases Dashboard",name:"Elvis Miranda"}
1),Object(j.jsx)(R,{})]})})})};a(377);s.a.render(Object(j.jsx)(H,{}),document.querySelector("#root"))}},[[378,1,2]]]); 2//# sourceMappingURL=main.e2af3b85.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.