diff --git a/package.json b/package.json index b3427ae..c864835 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "i18next-browser-languagedetector": "^4.0.2", "i18next-xhr-backend": "^3.2.2", "lodash": "^4.17.15", - "moment": "^2.24.0", - "node-sass": "^4.13.1", + "moment": "^2.26.0", + "node-sass": "^4.14.1", "react": "^16.13.1", "react-chartjs-2": "^2.9.0", "react-document-meta": "^3.0.0-beta.2", diff --git a/public/index.html b/public/index.html index 178b0e0..4a2665f 100644 --- a/public/index.html +++ b/public/index.html @@ -52,7 +52,7 @@ rel="stylesheet" /> - + @@ -84,8 +84,9 @@ To begin the development, run `npm start` or `yarn start`. To create a production bundle, use `npm run build` or `yarn build`. --> - - + +
+ + diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 72e8f21..35e3233 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -13,7 +13,7 @@ "donations":"Apoie ONGs" }, "header": { - "map": "Brasil em tempo real", + "map": "Brasil", "cities": "Estados e Cidades", "area": "Sua área", "help": "Ajuda", diff --git a/public/locales/pt/translation.json b/public/locales/pt/translation.json index db2969a..3e825c9 100644 --- a/public/locales/pt/translation.json +++ b/public/locales/pt/translation.json @@ -13,7 +13,7 @@ "donations":"Apoie ONGs" }, "header": { - "map": "Brasil em tempo real", + "map": "Brasil", "cities": "Estados e Cidades", "area": "Sua área", "help": "Ajuda", diff --git a/src/Router.js b/src/Router.js index 915f597..c7ceea2 100644 --- a/src/Router.js +++ b/src/Router.js @@ -5,13 +5,21 @@ import Cities from "./pages/Cities"; import Area from "./pages/Area"; import Help from "./pages/Help"; import News from "./pages/News"; +import UiKit from "./pages/UiKit"; import News1 from "./pages/News/News1"; import News2 from "./pages/News/News2"; import News3 from "./pages/News/News3"; import News4 from "./pages/News/News4"; import News5 from "./pages/News/News5"; import News6 from "./pages/News/News6"; -import UiKit from "./pages/UiKit"; +import News7 from "./pages/News/News7"; +import News8 from "./pages/News/News8"; +import News9 from "./pages/News/News9"; +import News10 from "./pages/News/News10"; +import News11 from "./pages/News/News11"; +import News12 from "./pages/News/News12"; +import News13 from "./pages/News/News13"; +import News14 from "./pages/News/News14"; import Donations from "./pages/Donations"; import Details from "./pages/Donations/details"; @@ -28,18 +36,19 @@ export default function Routes() { return ( - + {/* */} {/* */} - + + - - + + @@ -49,10 +58,18 @@ export default function Routes() { {/* News section /> */} - + + + + + + + + +

Desculpe, um erro ocorreu. Estaremos verificando o que aconteceu.

} />
diff --git a/src/assets/images/as-mudancas-nas-relacoes-de-consumo-durante-a-pandemia.jpg b/src/assets/images/as-mudancas-nas-relacoes-de-consumo-durante-a-pandemia.jpg new file mode 100644 index 0000000..9ad3948 Binary files /dev/null and b/src/assets/images/as-mudancas-nas-relacoes-de-consumo-durante-a-pandemia.jpg differ diff --git a/src/assets/images/como-manter-a-eficacia-da-midia-durante-a-pandemia.jpg b/src/assets/images/como-manter-a-eficacia-da-midia-durante-a-pandemia.jpg new file mode 100644 index 0000000..ad2697f Binary files /dev/null and b/src/assets/images/como-manter-a-eficacia-da-midia-durante-a-pandemia.jpg differ diff --git "a/src/assets/images/o-mercado-brasileiro-e-as-mudan\303\247as-no-consumo.jpg" "b/src/assets/images/o-mercado-brasileiro-e-as-mudan\303\247as-no-consumo.jpg" new file mode 100644 index 0000000..02a2bab Binary files /dev/null and "b/src/assets/images/o-mercado-brasileiro-e-as-mudan\303\247as-no-consumo.jpg" differ diff --git a/src/assets/images/o_impacto_da_COVID-19_nas_relacoes_de_trabalho.jpg b/src/assets/images/o_impacto_da_COVID-19_nas_relacoes_de_trabalho.jpg new file mode 100644 index 0000000..098d7a5 Binary files /dev/null and b/src/assets/images/o_impacto_da_COVID-19_nas_relacoes_de_trabalho.jpg differ diff --git a/src/assets/images/o_inicio_da_pandemia_e_o_isolamento_social_no_brasil.jpg b/src/assets/images/o_inicio_da_pandemia_e_o_isolamento_social_no_brasil.jpg new file mode 100644 index 0000000..6608e8b Binary files /dev/null and b/src/assets/images/o_inicio_da_pandemia_e_o_isolamento_social_no_brasil.jpg differ diff --git a/src/assets/images/por_tras_do_relatorio_que_pos_os_EUA_e_o_Reino_Unido_em_acao_contra_o_virus_COVID-19.jpg b/src/assets/images/por_tras_do_relatorio_que_pos_os_EUA_e_o_Reino_Unido_em_acao_contra_o_virus_COVID-19.jpg new file mode 100644 index 0000000..0ba4e33 Binary files /dev/null and b/src/assets/images/por_tras_do_relatorio_que_pos_os_EUA_e_o_Reino_Unido_em_acao_contra_o_virus_COVID-19.jpg differ diff --git a/src/assets/images/qual-o-impacto-da-crise-do-coronavirus-na-midia.jpg b/src/assets/images/qual-o-impacto-da-crise-do-coronavirus-na-midia.jpg new file mode 100644 index 0000000..120f92c Binary files /dev/null and b/src/assets/images/qual-o-impacto-da-crise-do-coronavirus-na-midia.jpg differ diff --git a/src/assets/images/saude_mental_em_tempos_de_pandemia.jpg b/src/assets/images/saude_mental_em_tempos_de_pandemia.jpg new file mode 100644 index 0000000..8c0a6db Binary files /dev/null and b/src/assets/images/saude_mental_em_tempos_de_pandemia.jpg differ diff --git a/src/assets/images/seja-criativo-para-anunciar-durante-o-isolamento-social.jpg b/src/assets/images/seja-criativo-para-anunciar-durante-o-isolamento-social.jpg new file mode 100644 index 0000000..e10c98d Binary files /dev/null and b/src/assets/images/seja-criativo-para-anunciar-durante-o-isolamento-social.jpg differ diff --git a/src/assets/scss/_base.scss b/src/assets/scss/_base.scss index f021d99..1f8f641 100644 --- a/src/assets/scss/_base.scss +++ b/src/assets/scss/_base.scss @@ -65,14 +65,14 @@ a { width: 35%; } - + @include respond-to(tablet) { .main-logo { width: 20%; padding-right: 80px; } } - + .mdc-layout-grid { width: 100%; } @@ -93,19 +93,22 @@ circle{ animation: zoominoutsinglefeatured 3s infinite ; } -.gm-style div a, .gm-style div a div, .gm-style-cc { + +.gm-style div a, .gm-style div a div, .gm-style-cc, .gmnoprint { display: none; } -._hj-f5b2a1eb-9b07_feedback_minimized_label{ - zoom: 70%; +.hIOJIb { + background-color: #FFF !important; } -// neoron chatbot -.rsc-float-button { - display: none !important; +#neoron button { + cursor: pointer; } +._hj-f5b2a1eb-9b07_feedback_minimized_label{ + zoom: 70%; +} @media only screen and (max-width: 600px) { .rsc-float-button { @@ -158,4 +161,18 @@ circle{ font-weight: bold !important; } } -} \ No newline at end of file +} + +#ribon { + width: 5rem; +} + +.aboutOpenSource { + color: #a4a4a4; + font-size: 12px; + + a { + color: #a4a4a4; + text-decoration: underline; + } +} diff --git a/src/assets/scss/_variables.scss b/src/assets/scss/_variables.scss index 6833706..fe9aaeb 100644 --- a/src/assets/scss/_variables.scss +++ b/src/assets/scss/_variables.scss @@ -15,7 +15,7 @@ $gray-40: #828282; $gray-50: #918e8c; $gray-60: #3a3a3a; $gray-70: #282832; -$gray-80: #16171c; +$gray-80: #000000; $black: #000; $magenta: #fe008c; diff --git a/src/components/Charts/CasesAndDeaths/index.js b/src/components/Charts/CasesAndDeaths/index.js new file mode 100644 index 0000000..37542f2 --- /dev/null +++ b/src/components/Charts/CasesAndDeaths/index.js @@ -0,0 +1,176 @@ +import React, { useEffect, useState } from 'react'; +import { Style } from '../styles'; +import moment from 'moment'; + +import last30DaysService from '../../../services/last30Days'; + +import {Line} from 'react-chartjs-2'; +import Chart from 'chart.js'; + +const CasesAndDeaths = (props) => { + const [responseAPI, setResponseAPI] = useState([]); + + const [lastDayCasesAndDeaths, setLastDayCasesAndDeaths] = useState(null); + const [lastDayFormatedCasesAndDeaths, setLastDayFormatedCasesAndDeaths] = useState(null); + + const [labelsCasesAndDeaths, setLabelsCasesAndDeaths] = useState([]); + const [valuesDeaths, setValuesDeaths] = useState([]); + const [valuesCases, setValuesCases] = useState([]); + + const [graphicCasesAndDeaths, setGraphicCasesAndDeaths] = useState(null); + + useEffect(() => { + getLastDay(); + }, []); + + useEffect(() => { + + if(!lastDayCasesAndDeaths || !lastDayFormatedCasesAndDeaths){ + return + } + + const maxDays = 20; + + const daysYMD = []; + const daysMD = []; + + for(let index = 0; index <= maxDays; index++){ + //pega o "i" dia antes do último retornado pela api + let day = moment(lastDayCasesAndDeaths).subtract(index, 'days'); + //coloca no array o dia no formato da api y-m-d + daysYMD.push(moment(day).format('YYYY-MM-DD')); + //coloca no array o dia no formato dd/m + daysMD.push(moment(day._d).format('l').split('/').reverse().slice(1).join('/')); + } + + const newValuesDeath = daysYMD.map(day => { + let totalDeaths = responseAPI.reduce((currentTotal, item) => { + if(item.date == day){ + return currentTotal + item.totalDeaths + } + return currentTotal + }, 0); + return totalDeaths; + }); + + const newValuesCases = daysYMD.map(day => { + let totalCases = responseAPI.reduce((currentTotal, item) => { + if(item.date == day){ + return currentTotal + item.totalCases + } + return currentTotal + }, 0); + + return totalCases; + }); + + setLabelsCasesAndDeaths(daysMD); + setValuesDeaths(newValuesDeath); + setValuesCases(newValuesCases); + + }, [lastDayCasesAndDeaths, lastDayFormatedCasesAndDeaths]); + + useEffect(() => { + if(!labelsCasesAndDeaths.length > 0 || !valuesDeaths.length > 0 || !valuesCases.length > 0){ + return + } + + setGraphicCasesAndDeaths( + { + labels: labelsCasesAndDeaths.reverse(), + datasets: [ + { + fill: false, + lineTension: 0.1, + backgroundColor: '#BDBDBD', + borderColor: '#BDBDBD', + borderCapStyle: 'round', + borderJoinStyle: 'miter', + pointBorderColor: '#BDBDBD', + pointBackgroundColor: '#BDBDBD', + borderWidth: 4, + pointBorderWidth: 2, + pointHoverRadius: 5, + pointRadius: 0, + pointHitRadius: 10, + data: valuesDeaths.reverse(), + }, + { + fill: false, + lineTension: 0.1, + backgroundColor: '#EF5350', + borderColor: '#EF5350', + borderCapStyle: 'round', + borderJoinStyle: 'miter', + pointBorderColor: '#EF5350', + pointBackgroundColor: '#EF5350', + borderWidth: 4, + pointBorderWidth: 2, + pointHoverRadius: 5, + pointRadius: 0, + pointHitRadius: 10, + data: valuesCases.reverse(), + } + ] + } + ); + }, [labelsCasesAndDeaths, valuesDeaths, valuesCases]); + + async function getLastDay(){ + const response = await last30DaysService.get().then(response => { + return response.data; + }); + + setResponseAPI(response); + + const lastDay = response[0]; + + const lastDayFormated = moment(lastDay.date).format('l').split('/').reverse().slice(1).join('/'); + + setLastDayCasesAndDeaths(lastDay.date); + setLastDayFormatedCasesAndDeaths(lastDayFormated); + }; + + + return( + + {props.title} + + {graphicCasesAndDeaths && } + + + + ); + +} + +export default CasesAndDeaths; \ No newline at end of file diff --git a/src/components/Charts/DailyCases/index.js b/src/components/Charts/DailyCases/index.js index bd7ae9b..660c544 100644 --- a/src/components/Charts/DailyCases/index.js +++ b/src/components/Charts/DailyCases/index.js @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Style } from '../styles'; import moment from 'moment'; -import api from '../api'; +import last30DaysService from '../../../services/last30Days'; import {Bar} from 'react-chartjs-2'; import Chart from 'chart.js'; @@ -47,18 +47,20 @@ const DailyCases = (props) => { } const newValues = daysYMD.map(day => { + // let todayItem = responseAPI[0].totalCases; + + // console.log(todayItem); + let totalNewCases = responseAPI.reduce((currentTotal, item) => { if(item.date == day){ - - return currentTotal + item.newcases + return item.newCases; } return currentTotal - }, 0); - return totalNewCases; }); + setLabels(daysMD); setValues(newValues); @@ -85,19 +87,18 @@ const DailyCases = (props) => { }, [labels, values]); async function getLastDay(){ - const response = await api.get(`https://api.covidzero.com.br/data_api/v1/cases/datasus`); - - const resultsData = response.data.sus_list; + const response = await last30DaysService.get().then(response => { + return response.data; + }); - setResponseAPI(resultsData); + setResponseAPI(response); - const lastItem = resultsData[resultsData.length - 1]; + const lastDay = response[0]; - const lastItemFormated = moment(lastItem.date).format('l').split('/').reverse().slice(1).join('/'); + const lastDayFormated = moment(lastDay.date).format('l').split('/').reverse().slice(1).join('/'); - setLastDay(lastItem.date); - setLastDayFormated(lastItemFormated); - + setLastDay(lastDay.date); + setLastDayFormated(lastDayFormated); }; diff --git a/src/components/Charts/DailyDeaths/index.js b/src/components/Charts/DailyDeaths/index.js new file mode 100644 index 0000000..7acf98c --- /dev/null +++ b/src/components/Charts/DailyDeaths/index.js @@ -0,0 +1,142 @@ +import React, { useEffect, useState } from 'react'; +import { Style } from '../styles'; +import moment from 'moment'; + +import last30DaysService from '../../../services/last30Days'; + +import {Bar} from 'react-chartjs-2'; +import Chart from 'chart.js'; + +const DailyDeaths = (props) => { + const [responseAPI, setResponseAPI] = useState([]); + + const [lastDay, setLastDay] = useState(null); + const [lastDayFormated, setLastDayFormated] = useState(null); + + const [labels, setLabels] = useState([]); + const [values, setValues] = useState([]); + + const [graphic, setGraphic] = useState(null); + + + useEffect(() => { + getLastDay(); + }, []); + + useEffect(() => { + + if(!lastDay || !lastDayFormated){ + return + } + + const maxDays = 20; + + const daysYMD = []; + const daysMD = []; + + for(let index = 0; index <= maxDays; index++){ + //pega o "i" dia antes do último retornado pela api + let day = moment(lastDay).subtract(index, 'days'); + //coloca no array o dia no formato da api y-m-d + daysYMD.push(moment(day).format('YYYY-MM-DD')); + + //coloca no array o dia no formato dd/m + daysMD.push(moment(day._d).format('l').split('/').reverse().slice(1).join('/')); + + } + + const newValues = daysYMD.map(day => { + let totalNewDeaths = responseAPI.reduce((currentTotal, item) => { + if(item.date == day){ + return item.newDeaths; + } + return currentTotal + }, 0); + + return totalNewDeaths; + }); + + setLabels(daysMD); + setValues(newValues); + + }, [lastDay, lastDayFormated]); + + useEffect(() => { + if(!labels.length > 0 || !values.length > 0){ + return + } + + + setGraphic( + { + labels: labels.reverse(), + datasets: [ + { + backgroundColor: '#BDBDBD', + hoverbackgroundColor: '#BDBDBD', + data: values.reverse(), + } + ] + } + ); + }, [labels, values]); + + async function getLastDay(){ + const response = await last30DaysService.get().then(response => { + return response.data; + }); + + setResponseAPI(response); + + const lastDay = response[0]; + + const lastDayFormated = moment(lastDay.date).format('l').split('/').reverse().slice(1).join('/'); + + setLastDay(lastDay.date); + setLastDayFormated(lastDayFormated); + }; + + + return( + + {props.title} + + { graphic && } + + + + ); + +} + +export default DailyDeaths; \ No newline at end of file diff --git a/src/components/Charts/RegionCases/index.js b/src/components/Charts/RegionCases/index.js index e3a12d6..734a7d7 100644 --- a/src/components/Charts/RegionCases/index.js +++ b/src/components/Charts/RegionCases/index.js @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Style } from '../styles'; import moment from 'moment'; -import api from '../api'; +import regionCasesService from '../../../services/regionCases'; import {Doughnut} from 'react-chartjs-2'; import Chart from 'chart.js'; @@ -21,52 +21,49 @@ const RegionCases = (props) => { const [graphic, setGraphic] = useState(null); useEffect(() => { - getLastDay(); - }, []); + getRegionCases(); + }, [getRegionCases]); useEffect(() => { - + if(!lastDay){ return } const sulValue = responseAPI.reduce((currentTotal, item) => { - if(item.date == lastDay && item.region == 'Sul'){ - return currentTotal + item.totalcases + + if(item.date == lastDay && item.region == 'Sul' && item.codmun == null){ + return currentTotal + item.totalCases } - return currentTotal + return currentTotal; }, 0); const sudesteValue = responseAPI.reduce((currentTotal, item) => { - if(item.date == lastDay && item.region == 'Sudeste'){ - return currentTotal + item.totalcases + if(item.date == lastDay && item.region == 'Sudeste' && item.codmun == null){ + return currentTotal + item.totalCases } - return currentTotal + return currentTotal; }, 0); const centroOesteValue = responseAPI.reduce((currentTotal, item) => { - if(item.date == lastDay && item.region === 'Centro-Oeste'){ - // console.log(currentTotal); - // console.log(item.totalcases); - // console.log(item.state); - return currentTotal + item.totalcases + if(item.date == lastDay && item.region === 'Centro-Oeste' && item.codmun == null){ + return currentTotal + item.totalCases; } - // console.log(currentTotal); - return currentTotal + return currentTotal; }, 0); const nordesteValue = responseAPI.reduce((currentTotal, item) => { - if(item.date == lastDay && item.region == 'Nordeste'){ - return currentTotal + item.totalcases + if(item.date == lastDay && item.region == 'Nordeste' && item.codmun == null){ + return currentTotal + item.totalCases } - return currentTotal + return currentTotal; }, 0); const norteValue = responseAPI.reduce((currentTotal, item) => { - if(item.date == lastDay && item.region == 'Norte'){ - return currentTotal + item.totalcases + if(item.date == lastDay && item.region == 'Norte' && item.codmun == null){ + return currentTotal + item.totalCases } - return currentTotal + return currentTotal; }, 0); setSul(sulValue); @@ -75,7 +72,7 @@ const RegionCases = (props) => { setNordeste(nordesteValue); setNorte(norteValue); - }, [lastDay]); + }, [lastDay, responseAPI]); useEffect(() => { @@ -93,24 +90,23 @@ const RegionCases = (props) => { ], borderWidth: 0.6, data: [sul, sudeste, centroOeste, nordeste, norte], - + } ], } ); }, [sul, sudeste, centroOeste, nordeste, norte]); - async function getLastDay(){ - const response = await api.get(`https://api.covidzero.com.br/data_api/v1/cases/datasus`); - - const resultsData = response.data.sus_list; + async function getRegionCases(){ + const response = await regionCasesService.get().then(response => { + return response.data; + }); - setResponseAPI(resultsData); + setResponseAPI(response); - const lastItem = resultsData[resultsData.length - 1]; - - setLastDay(lastItem.date); + const lastDay = response[1].date; + setLastDay(lastDay); }; return( @@ -121,7 +117,7 @@ const RegionCases = (props) => { data={graphic} options={{ cutoutPercentage: 80, - + legend:{ display: true, labels: { @@ -136,11 +132,11 @@ const RegionCases = (props) => { }, }} /> } - + ); } -export default RegionCases; \ No newline at end of file +export default RegionCases; diff --git a/src/components/Charts/TotalCases/index.js b/src/components/Charts/TotalCases/index.js index 4bdc765..00c6a14 100644 --- a/src/components/Charts/TotalCases/index.js +++ b/src/components/Charts/TotalCases/index.js @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Style } from '../styles'; import moment from 'moment'; -import api from '../api'; +import last30DaysService from '../../../services/last30Days'; import {Line} from 'react-chartjs-2'; import Chart from 'chart.js'; @@ -44,7 +44,7 @@ const TotalCases = (props) => { const newValues = daysYMD.map(day => { let totalNewCasesBr = responseAPI.reduce((currentTotal, item) => { if(item.date == day){ - return currentTotal + item.totalcases + return currentTotal + item.totalCases } return currentTotal @@ -89,18 +89,18 @@ const TotalCases = (props) => { }, [labelsTCases, valuesTCases]); async function getLastDay(){ - const response = await api.get(`https://api.covidzero.com.br/data_api/v1/cases/datasus`); - - const resultsData = response.data.sus_list; + const response = await last30DaysService.get().then(response => { + return response.data; + }); - setResponseAPI(resultsData); + setResponseAPI(response); - const lastItem = resultsData[resultsData.length - 1]; + const lastDay = response[0]; - const lastItemFormated = moment(lastItem.date).format('l').split('/').reverse().slice(1).join('/'); + const lastDayFormated = moment(lastDay.date).format('l').split('/').reverse().slice(1).join('/'); - setLastDayTCases(lastItem.date); - setLastDayFormatedTCases(lastItemFormated); + setLastDayTCases(lastDay.date); + setLastDayFormatedTCases(lastDayFormated); }; diff --git a/src/components/Charts/TotalDeaths/index.js b/src/components/Charts/TotalDeaths/index.js index a5bc580..cc72613 100644 --- a/src/components/Charts/TotalDeaths/index.js +++ b/src/components/Charts/TotalDeaths/index.js @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Style } from '../styles'; import moment from 'moment'; -import api from '../api'; +import last30DaysService from '../../../services/last30Days'; import {Line} from 'react-chartjs-2'; import Chart from 'chart.js'; @@ -47,7 +47,7 @@ const TotalDeaths = (props) => { const newValues = daysYMD.map(day => { let totalDeaths = responseAPI.reduce((currentTotal, item) => { if(item.date == day){ - return currentTotal + item.totaldeaths + return currentTotal + item.totalDeaths } return currentTotal @@ -93,18 +93,18 @@ const TotalDeaths = (props) => { }, [labelsTDeaths, valuesTDeaths]); async function getLastDay(){ - const response = await api.get(`https://api.covidzero.com.br/data_api/v1/cases/datasus`); - - const resultsData = response.data.sus_list; + const response = await last30DaysService.get().then(response => { + return response.data; + }); - setResponseAPI(resultsData); + setResponseAPI(response); - const lastItem = resultsData[resultsData.length - 1]; + const lastDay = response[0]; - const lastItemFormated = moment(lastItem.date).format('l').split('/').reverse().slice(1).join('/'); + const lastDayFormated = moment(lastDay.date).format('l').split('/').reverse().slice(1).join('/'); - setLastDayTDeaths(lastItem.date); - setLastDayFormatedTDeaths(lastItemFormated); + setLastDayTDeaths(lastDay.date); + setLastDayFormatedTDeaths(lastDayFormated); }; diff --git a/src/components/index.js b/src/components/index.js index f50ce43..6267526 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -15,9 +15,11 @@ import MapBrazil from "./MapBrazil"; import MapCities from "./MapCities"; import SocialShare from "./SocialShare"; import DailyCases from "./Charts/DailyCases"; +import DailyDeaths from "./Charts/DailyDeaths"; import TotalCases from "./Charts/TotalCases"; import RegionCases from "./Charts/RegionCases"; import TotalDeaths from "./Charts/TotalDeaths"; +import CasesAndDeaths from "./Charts/CasesAndDeaths"; import MapArea from "./MapArea"; import Marker from "./Marker"; import Loading from "./Loading"; @@ -38,9 +40,11 @@ export { MapCities, SocialShare, DailyCases, + DailyDeaths, TotalCases, RegionCases, TotalDeaths, + CasesAndDeaths, MapArea, Marker, MapBrazil, diff --git a/src/layout/Sidebar/index.js b/src/layout/Sidebar/index.js index dec5a20..728e47d 100644 --- a/src/layout/Sidebar/index.js +++ b/src/layout/Sidebar/index.js @@ -30,11 +30,11 @@ const Sidebar = props => { path: "/", icon: pathname === "/" ? : }, - { - title: "menu.cities", - path: "/cities", - icon: pathname === "/cities" ? : - }, + // { + // title: "menu.cities", + // path: "/cities", + // icon: pathname === "/cities" ? : + //}, { title: "menu.area", path: "/area", diff --git a/src/pages/Area/index.js b/src/pages/Area/index.js index 574a8c5..a0bd15e 100644 --- a/src/pages/Area/index.js +++ b/src/pages/Area/index.js @@ -28,29 +28,9 @@ export default function Area() { } const [citiesCases, setTotalCases] = useState(initalCases) - useEffect(() => { - async function fetchData() { - const citiesCases = await API.cases.getCityCases(); - setTotalCases(citiesCases) - } - fetchData(); - addScript('https://d2smc9x58xj6ns.cloudfront.net/neoron.js'); - }, []); - - let _loaded = {}; - function addScript(url) { - if (!_loaded[url]) { - let s = document.createElement('script'); - s.src = url; - document.head.appendChild(s); - _loaded[url] = true; - } - } return ( <> - -
{((latitude && longitude) || error) && @@ -66,4 +46,4 @@ export default function Area() { ); -} \ No newline at end of file +} diff --git a/src/pages/Brazil/index.js b/src/pages/Brazil/index.js index ff75de2..234fd31 100644 --- a/src/pages/Brazil/index.js +++ b/src/pages/Brazil/index.js @@ -5,12 +5,14 @@ import ReactTooltip from "react-tooltip"; import * as Styled from "./styles.js"; -import { CardStats, DailyCases, TotalCases, RegionCases, TotalDeaths } from "~/components"; +import { CardStats, DailyCases, DailyDeaths, TotalCases, RegionCases, TotalDeaths, CasesAndDeaths } from "~/components"; import { Header } from "~/components"; import { MapBrazil } from "~/components"; import { Chips } from "~/components"; import API from "~/API"; +import totalCasesService from "../../services/totalCases"; + const Brazil = () => { const now = new Date(); const [t] = useTranslation(); @@ -22,8 +24,12 @@ const Brazil = () => { deaths: 0, cases: [] } + const [totalCases, setTotalCases] = useState(initalCases) + const [totalCasesStates, setTotalCasesStates] = useState(0); + const [totalDeathsStates, setTotalDeathsStates] = useState(0); + const sumStateCases = (stateCases) => { let totalCases = { confirmed: 0, @@ -43,12 +49,24 @@ const Brazil = () => { return totalCases; } + async function totalCasesState(){ + const response = await totalCasesService.get().then(response => { + return response.data; + }); + + setTotalCasesStates(response[0].totalCases); + setTotalDeathsStates(response[0].totalDeaths); + + } + useEffect(() => { (async () => { const stateCases = await API.cases.getStatesCases(); setTotalCases(sumStateCases(stateCases)) } )() + + totalCasesState(); }, []) return ( @@ -69,17 +87,13 @@ const Brazil = () => { - + - + - {/* - - - - */} + @@ -95,11 +109,35 @@ const Brazil = () => { + + + + + + + + + + + {/* + + + + + + + + */} + + +

Somos um projeto OpenSource. Para acesso ao nosso código fonte e fontes utilizadas, clique aqui.

+
+
diff --git a/src/pages/Donations/checkoutBoletoPreme.js b/src/pages/Donations/checkoutBoletoPreme.js index 7c5c65a..6b13f56 100644 --- a/src/pages/Donations/checkoutBoletoPreme.js +++ b/src/pages/Donations/checkoutBoletoPreme.js @@ -5,7 +5,9 @@ import { Header,Button,Loading } from "~/components"; import history from "~/services/history"; import * as Styled from "./styles.js"; -import API from "~/API"; + +import API from "~/API"; + import ProjectsJson from "./projects.json"; @@ -29,9 +31,10 @@ export default function CheckoutBoleto() { goal:0, quota_total:0, quota_value:0, - photo:{url:false} + photo:{url:false} } - + + const [Projects, setProjects] = useState(initalProjects); const [paramPreme,setParamPreme] = useState(initalParamPreme); const [dataOrder,setDataOrder] = useState({ @@ -46,68 +49,76 @@ export default function CheckoutBoleto() { }); - - + + + useEffect(() => { - (async () => { - - const response= await API.donationsPreme.Authentication(); + (async () => { + + const response= await API.donationsPreme.Authentication(); setParamPreme({...paramPreme,token:response.token}); setloadingStatus(false) - - })() - + })() + + const projectsJson=ProjectsJson.find(({ id }) => id==storeId); if(typeof projectsJson !="undefined"){ - setProjects(projectsJson); + setProjects(projectsJson); }else{ history.push("/donations"); } - - - },[]); + + + },[paramPreme, storeId]); + useEffect(() => { if(paramPreme.token!=""){ API.donationsPreme.ListOrder(paramPreme).then(response =>{ - + + setDataOrder(response); - - }); + + }); } - },[paramPreme.token]); - + },[paramPreme, paramPreme.token]); + const formatDate=(value)=>{ - if(value!='') + if(value!='') return new Date(value).toLocaleDateString(); } - + + return ( <>
- + Obrigado pela sua doação, {dataOrder.customer.firstName}! Ao recebermos a confirmação do pagamento do Boleto Bancário, sua doação de {Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(dataOrder.payment.amount)} será repassada diretamente para a ONG {Projects.ong_name}. - - + + + +
Código de barras - + + + {dataOrder.payment.barcode} @@ -117,25 +128,27 @@ export default function CheckoutBoleto() { Vencimento {formatDate(dataOrder.payment.dueDate)} -
- +
-

Pagamento processado por

+

Pagamento processado por

+

O pagamento será processado por Preme Pay e estará disponível em sua fatura como CovidZero. Ao realizar o pagamento você concorda com os termos de uso.

@@ -143,15 +156,16 @@ export default function CheckoutBoleto() { -

O CNPJ da ONG {Projects.ong_name} é {Projects.ong_cnpj}. Com ele, você poderá deduzir valores dos seus impostos a serem pagos.

-

Você receberá um email com a confirmação da doação.

-

A CovidZero não receberá nenhuma comissão sobre essa doação.

+ +

O CNPJ da ONG Ribon é 26.660.577/0001-13. Com ele, você poderá deduzir valores dos seus impostos a serem pagos.

+

Você receberá um email com a confirmação da doação.

+

A CovidZero não receberá nenhuma comissão sobre essa doação.

- + - ); + ); -} \ No newline at end of file +} diff --git a/src/pages/Donations/checkoutCartaoCaptable.js b/src/pages/Donations/checkoutCartaoCaptable.js index 919edec..76f9621 100644 --- a/src/pages/Donations/checkoutCartaoCaptable.js +++ b/src/pages/Donations/checkoutCartaoCaptable.js @@ -49,7 +49,7 @@ export default function CheckoutCartao() { const [donationType, setDonationType] = useState(false); const [donationEmpresa, setDonationEmpresa] = useState(false); - const [fomarPagamento, setFomarPagamento] = useState(0); + const [fomarPagamento, setFomarPagamento] = useState(1); const [loadingStatus, setloadingStatus] = useState(false); @@ -143,12 +143,16 @@ export default function CheckoutCartao() { async function objDonation(){ + + + + let param={ "project_id": id, - "value":values.valor + "value":parseFloat(values.valor.replace(",",".")) } - return await API.donations.DonationsProjects(id,param); + return await API.donationsCaptable.DonationsProjects(id,param); } @@ -179,7 +183,7 @@ export default function CheckoutCartao() { let elem=document.getElementById(val); elem.style.display = "block"; - alert(elem.innerHTML); + alert(elem.innerHTML); return false; } } @@ -216,20 +220,20 @@ export default function CheckoutCartao() { "id": id ? id : donation.id, "order": { "description":values.description, - "amount": values.valor, + "amount": parseFloat(values.valor.replace(",",".")), "payment": { "card": { "holder_name": values.holder_name, - "expiration_month": dataExpiration[0], - "expiration_year": dataExpiration[1], - "card_number": values.card_number, - "security_code": values.security_code + "expiration_month":Number(dataExpiration[0]), + "expiration_year": Number(dataExpiration[1]), + "card_number": Number(values.card_number.replace(/\D/g, '')), + "security_code":Number(values.security_code) } }, "customer": { "first_name": values.first_name, "surname": values.surname, - "cpf": values.cpf, + "cpf": values.cpf.replace(/\D/g, ''), "birthdate": values.birthdate, "email": values.email, "phone": values.phone, @@ -250,11 +254,12 @@ export default function CheckoutCartao() { } } } + + + - console.log(param); - - API.donations.CheckoutProjects(param).then(response =>{ - history.push("/donations/confirmed"); + API.donationsCaptable.CheckoutProjects(param).then(response =>{ + history.push("/donations/confirmed/captable/1"); setloadingStatus(false); }).catch(errs=>{ @@ -454,12 +459,12 @@ export default function CheckoutCartao() {
-
+ {/*
setFomarPagamento(0)}> Boleto -
+
*/}
setFomarPagamento(1)}> diff --git a/src/pages/Donations/checkoutCartaoPreme.js b/src/pages/Donations/checkoutCartaoPreme.js index 9868fe6..d496e58 100644 --- a/src/pages/Donations/checkoutCartaoPreme.js +++ b/src/pages/Donations/checkoutCartaoPreme.js @@ -1,3 +1,4 @@ + import React,{useState,useEffect} from "react"; import {useParams, } from "react-router-dom"; import history from "~/services/history"; @@ -18,6 +19,8 @@ import { cpfMask,dataMask,cepMask,validadeMask,cardMask,phoneMask,valorMask,cnpj import API from "~/API"; import ProjectsJson from "./projects.json"; +const moment = require('moment'); + export default function CheckoutCartao() { const [t] = useTranslation(); @@ -53,7 +56,7 @@ export default function CheckoutCartao() { const [valuesCard, setValuesCard] = useState(initalCard); const [donationType, setDonationType] = useState(false); const [donationEmpresa, setDonationEmpresa] = useState(false); - const [paymentType, setPaymentType] = useState(1); + const [paymentType, setPaymentType] = useState(0); const [loadingStatus, setloadingStatus] = useState(false); @@ -234,7 +237,7 @@ export default function CheckoutCartao() { "firstName": values.first_name, "surname": values.surname, "cpf": values.cpf.replace(/\D/g, ''), - "birthdate": values.birthdate, + "birthdate": moment(values.birthdate, "DD/MM/YYYY").format("YYYY-MM-DD"), "email": values.email, "phone": values.phone, "donationEmpresa":donationEmpresa, @@ -254,12 +257,12 @@ export default function CheckoutCartao() { } try { - const response = await API.donationsPreme.ListCustomer(paramPreme); + const response = await API.donationsPreme.CreateCustomer(paramPreme, customer); - setParamPreme({ - ...paramPreme, - customerId:response[0].id - }); + setParamPreme({ + ...paramPreme, + customerId:response.id + }); }catch (err) { alert('Ocorreu um erro, tente novamente.'); @@ -300,12 +303,19 @@ export default function CheckoutCartao() { async function CreateOrder(){ - + let amount = 0; + if(isNaN(values.valor)) { + amount = parseFloat(values.valor.replace(",",".")); + } + else { + amount = values.valor; + } let data = new Date(Date.now() + 2*86400000); - + + let order= { - "amount": values.valor, + "amount": amount, "description":values.description, "payment": { "type": paymentType, @@ -370,15 +380,16 @@ export default function CheckoutCartao() { - if(response[0].id) + if(response.length > 0) { setParamPreme({ ...paramPreme, customerId:response[0].id, cardId:response[0].card.id }); - - else + } + else { await CreateCustomer(); + } } @@ -573,13 +584,14 @@ export default function CheckoutCartao() {
+ {/*
setPaymentType(1)}> Boleto
- + */}
setPaymentType(0)}> Cartão de Crédito @@ -679,4 +691,5 @@ export default function CheckoutCartao() { ); + } \ No newline at end of file diff --git a/src/pages/Donations/confirmedPreme.js b/src/pages/Donations/confirmedPreme.js index 2adb01d..b5515d7 100644 --- a/src/pages/Donations/confirmedPreme.js +++ b/src/pages/Donations/confirmedPreme.js @@ -1,11 +1,13 @@ import React,{useState,useEffect} from "react"; import {useParams} from "react-router-dom"; -import { useTranslation } from "react-i18next"; + +import { useTranslation } from "react-i18next"; import { Header,Button,Loading } from "~/components"; import history from "~/services/history"; -import * as Styled from "./styles.js"; +import * as Styled from "./styles.js"; + +import API from "~/API"; -import API from "~/API"; import ProjectsJson from "./projects.json"; export default function CheckoutBoleto() { @@ -13,7 +15,7 @@ export default function CheckoutBoleto() { let { storeId,customerId,orderNumber} = useParams(); const [loadingStatus, setloadingStatus] = useState(true) - + const initalParamPreme={ storeId, customerId, @@ -28,9 +30,11 @@ export default function CheckoutBoleto() { goal:0, quota_total:0, quota_value:0, - photo:{url:false} + + photo:{url:false} } - + + const [Projects, setProjects] = useState(initalProjects); const [paramPreme,setParamPreme] = useState(initalParamPreme); const [dataOrder,setDataOrder] = useState({ @@ -43,53 +47,57 @@ export default function CheckoutBoleto() { }); - - + + + useEffect(() => { - (async () => { - - const response= await API.donationsPreme.Authentication(); + (async () => { + + const response= await API.donationsPreme.Authentication(); setParamPreme({...paramPreme,token:response.token}); setloadingStatus(false) - - })() - + })() + + const projectsJson=ProjectsJson.find(({ id }) => id==storeId); if(typeof projectsJson !="undefined"){ - setProjects(projectsJson); + setProjects(projectsJson); }else{ history.push("/donations"); } - - - },[]); + + + },[paramPreme, storeId]); + useEffect(() => { if(paramPreme.token!=""){ API.donationsPreme.ListOrder(paramPreme).then(response =>{ - + + setDataOrder(response); - - }); - + }); + + } - },[paramPreme.token]); + },[paramPreme, paramPreme.token]); + + - return ( <>
- + Obrigado pela sua doação, {dataOrder.customer.firstName}! @@ -97,31 +105,36 @@ export default function CheckoutBoleto() {
-
+ +
-

Sua doação de {Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(dataOrder.payment.amount)} foi confirmada e o valor será repassado diretamente para a ONG {Projects.ong_name}.

+

Sua doação de {Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(dataOrder.payment.amount)} foi confirmada e o valor será repassado diretamente para a ONG Ribon.

+ +

O CNPJ da ONG Ribon é 26.660.577/0001-13. Com ele, você poderá deduzir valores dos seus impostos a serem pagos.

-

O CNPJ da ONG {Projects.ong_name} é {Projects.ong_cnpj}. Com ele, você poderá deduzir valores dos seus impostos a serem pagos.

Você receberá um email com a confirmação da doação.

A CovidZero não recebeu nenhuma comissão sobre essa doação.

- - + + +
-

Pagamento processado por

+

Pagamento processado por

+
- + - ); + ); + +} -} \ No newline at end of file diff --git a/src/pages/Donations/details.js b/src/pages/Donations/details.js index 79ea3ea..fdcdb5d 100644 --- a/src/pages/Donations/details.js +++ b/src/pages/Donations/details.js @@ -12,11 +12,11 @@ import API from "~/API"; import ProjectsJson from "./projects.json"; export default function Details() { - const [t] = useTranslation(); - + const [t] = useTranslation(); + let { id:idProjecto,capitation } = useParams(); - - + + const [loadingStatus, setloadingStatus] = useState(true) const initalProjects = { @@ -26,7 +26,7 @@ export default function Details() { goal:0, quota_total:0, quota_value:0, - photo:{url:false} + photo:{url:false} } const initalMeta = { @@ -37,23 +37,23 @@ export default function Details() { const [meta, _setMeta] = useState(initalMeta) const [Projects, setProjects] = useState(initalProjects) - + const setMeta=(response)=>{ - + initalMeta.title =`${response.name}`+ ' | CovidZero'; initalMeta.description=`${response.name}`+ ' | CovidZero - Combate ao COVID-19'; - + _setMeta(initalMeta); } useEffect(() => { - + if(capitation=='captable'){ - (async () => { - API.donationsCaptable.findProjects(idProjecto). - then(response =>{ + (async () => { + API.donationsCaptable.findProjects(idProjecto) + .then(response =>{ setMeta(response); setProjects(response); setloadingStatus(false); @@ -71,15 +71,16 @@ export default function Details() { }else{ history.push("/donations"); } - + } + // eslint-disable-next-line react-hooks/exhaustive-deps },[]); - + let formato = { minimumFractionDigits: 2 , currency: 'BRL' } - + function formatValor(_value){ let value =_value!=null ? _value :0; @@ -97,7 +98,7 @@ export default function Details() { {Projects.photo.url && }
{Projects.name}
-
+ @@ -109,25 +110,25 @@ export default function Details() { phoneColumns={4} tabletColumns={4} > - Arrecadado
} + Arrecadado
} count={formatValor(Projects.quota_total)} className="donation-stats" - /> + /> - Meta
} + Meta
} count={formatValor(Projects.goal)} className="donation-stats" - /> - + /> + - + @@ -144,22 +145,22 @@ export default function Details() {
-
- +
+ {Projects.about}

Quanto o CovidZero ganha?

-

Nada! O valor recebido é passado diretamente para a instituição escolhida e o CovidZero não recebe nenhuma doação por isso.

-
- - -