diff --git a/package-lock.json b/package-lock.json index 18d47ef..12b7af3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6741,9 +6741,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "inquirer": { "version": "7.3.2", @@ -8661,9 +8661,9 @@ } }, "node-forge": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", - "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==" + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" }, "node-int64": { "version": "0.4.0", @@ -11505,11 +11505,11 @@ "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=" }, "selfsigned": { - "version": "1.10.7", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz", - "integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==", + "version": "1.10.8", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz", + "integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==", "requires": { - "node-forge": "0.9.0" + "node-forge": "^0.10.0" } }, "semver": { diff --git a/src/App.js b/src/App.js index cab2ae7..d49cec3 100644 --- a/src/App.js +++ b/src/App.js @@ -23,7 +23,7 @@ const App = () => { const [tableData, setTableData] = useState([]); const [casesType, setCasesType] = useState("cases"); const [mapCenter, setMapCenter] = useState({ lat: 34.80746, lng: -40.4796 }); - const [mapZoom, setMapZoom] = useState(3); + const [mapZoom, setMapZoom] = useState(2); useEffect(() => { fetch("https://disease.sh/v3/covid-19/all") @@ -66,8 +66,23 @@ const App = () => { .then((data) => { setInputCountry(countryCode); setCountryInfo(data); - setMapCenter([data.countryInfo.lat, data.countryInfo.long]); - setMapZoom(4); + console.log("Country data: ",data); + + if(countryCode === "worldwide"){ + setMapCenter({ lat: 34.80746, lng: -40.4796 }); + setMapZoom(2); + } + else{ + setMapCenter([data.countryInfo.lat, data.countryInfo.long]); + setMapZoom(4); + } + // countryCode === "worldwide" ? ( + // setMapCenter({ lat: 34.80746, lng: -40.4796 }); + // setMapZoom(3); + // ) : ( + // setMapCenter([data.countryInfo.lat, data.countryInfo.long]); + // setMapZoom(4); + // ) }); }; @@ -83,8 +98,8 @@ const App = () => { onChange={onCountryChange} > - {countries.map((country) => ( - + {countries.map((country,i) => ( + ))} diff --git a/src/Table.js b/src/Table.js index ca6a51c..7caa196 100644 --- a/src/Table.js +++ b/src/Table.js @@ -5,8 +5,8 @@ import numeral from "numeral"; function Table({ countries }) { return (