From 7171ea18f0e1dcaafa65c2c52e68cd93fd53a7e0 Mon Sep 17 00:00:00 2001 From: Joao Paulo Nunes Soares Date: Wed, 30 Jun 2021 16:31:40 -0300 Subject: [PATCH] Changing cached data alert options to refresh automatically --- src/components/Alert/index.js | 17 ++++++++++++++--- src/components/Alert/style.js | 8 ++++++++ src/settings/applicationOptions/index.js | 4 ++-- src/settings/texts/AudienciasPage/index.js | 2 +- src/settings/texts/WikilegisPage/index.js | 2 +- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/components/Alert/index.js b/src/components/Alert/index.js index b303e25d..f79507a4 100644 --- a/src/components/Alert/index.js +++ b/src/components/Alert/index.js @@ -1,7 +1,9 @@ +/* eslint-disable max-len */ /* eslint-disable import/prefer-default-export */ /* eslint-disable react/destructuring-assignment */ /* eslint-disable react/prop-types */ -import React from 'react'; +import React, { useEffect } from 'react'; +import CircularProgress from '@material-ui/core/CircularProgress'; import { Grid, Box, Typography } from '@material-ui/core'; import WarningIcon from '@material-ui/icons/Warning'; import Paper from '@material-ui/core/Paper'; @@ -10,6 +12,12 @@ import { useStyles } from './style'; export function AlertCachedData({ apiLastCacheMade }) { const classes = useStyles(); + useEffect(() => { + setTimeout(() => { + document.location.reload(true); + }, 35000); + }, []); + return ( @@ -18,12 +26,15 @@ export function AlertCachedData({ apiLastCacheMade }) { - Erro ao tentar obter os dados solicitados. Os dados exibidos são de cache referentes a + Os dados exibidos são de cache referentes a {' '} {apiLastCacheMade} - . + . Os dados mais recentes estão sendo obtidos e a página será atualizada automaticamente quando concluído. + + + ); diff --git a/src/components/Alert/style.js b/src/components/Alert/style.js index 474e98cb..aa292045 100644 --- a/src/components/Alert/style.js +++ b/src/components/Alert/style.js @@ -39,4 +39,12 @@ export const useStyles = makeStyles((theme) => ({ fontSize: '0.813rem', fontWeight: 600, }, + spinnerBox: { + height: '100%', + width: '10%', + flexGrow: 1, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + }, })); diff --git a/src/settings/applicationOptions/index.js b/src/settings/applicationOptions/index.js index c83528ea..4dbe8e1c 100644 --- a/src/settings/applicationOptions/index.js +++ b/src/settings/applicationOptions/index.js @@ -18,8 +18,8 @@ export const DEFAULT_YEAR_PERIOD = '0'; // All years options export const DEFAULT_SEARCH_QUERY = '?period=yearly&ordering=start_date'; // Query that get informations of all years // =================== API's ================ -export const REFRESH_API_CACHE_DATA_INTERVAL = 900; // In seconds. (3600 seconds = 1 hour) -export const SHOW_API_CACHE_ERROR_MESSAGE_LIMIT_TIME = 120; // In minutes (120 minutes = 2 hours) +export const REFRESH_API_CACHE_DATA_INTERVAL = 900;// 900; // In seconds. (3600 seconds = 1 hour) +export const SHOW_API_CACHE_ERROR_MESSAGE_LIMIT_TIME = 720; // In minutes (720 minutes = 12 hours) // =============== HOUR SETTINGS =============== export const START_TIME_OF_DATA_CONSOLIDATION = '1:00'; // In 24h format, in the format h:mm diff --git a/src/settings/texts/AudienciasPage/index.js b/src/settings/texts/AudienciasPage/index.js index 7a0d766c..68a01683 100644 --- a/src/settings/texts/AudienciasPage/index.js +++ b/src/settings/texts/AudienciasPage/index.js @@ -2,7 +2,7 @@ // Page Texts export const pageToolTitle = 'Audiências Interativas'; -export const pageHTMLTitle = 'Dashboard Audiências'; +export const pageHTMLTitle = 'Audiências Interativas | Painel da Participação'; export const pageTitle = 'A Participação em Audiências Interativas'; export const pageSubTitle = 'Painel de estatísticas de participação dos cidadãos em audiências públicas e eventos interativos da Câmara dos Deputados.'; export const pageColor = '#DA7F0B'; diff --git a/src/settings/texts/WikilegisPage/index.js b/src/settings/texts/WikilegisPage/index.js index 36f13d49..0f40f8d3 100644 --- a/src/settings/texts/WikilegisPage/index.js +++ b/src/settings/texts/WikilegisPage/index.js @@ -2,7 +2,7 @@ // Page Texts export const pageToolTitle = 'Wikilegis'; -export const pageHTMLTitle = 'Dashboard Wikilegis'; +export const pageHTMLTitle = 'Wikilegis | Painel da Participação '; export const pageTitle = 'Participação na Wikilegis'; export const pageSubTitle = 'Painel de estatísticas da participação dos cidadãos nas propostas legislativas da Câmara dos Deputados.'; export const pageColor = '#00C354';