Skip to content

Commit

Permalink
Adding validation and fixing caption frames wrong url
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopaulonsoares committed Jul 6, 2021
1 parent 7171ea1 commit 8f3a423
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/ChartAndReport/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function getColumns(data) {
export default function ChartAndReport(props) {
const {
isLoaded, title, data, chartType, chartOptions, exportData,
apiLastUpdate, tool, height,
apiLastUpdate, tool, height, apiUrl,
} = props;
const [wayOfVisualizeData, setWayOfVisualizeData] = useState('chart');
const convertDataToJson = convertArrayToJSON(data);
Expand All @@ -80,7 +80,7 @@ export default function ChartAndReport(props) {
exportData={exportData}
download
align="center"
apiUrl={process.env.NEXT_PUBLIC_AUDIENCIAS_SWAGGER_URL}
apiUrl={apiUrl}
apiLastUpdate={apiLastUpdate}
tool={tool}
>
Expand Down Expand Up @@ -143,6 +143,7 @@ ChartAndReport.propTypes = {
apiLastUpdate: PropTypes.string,
tool: PropTypes.string,
height: PropTypes.string,
apiUrl: PropTypes.string,
};

ChartAndReport.defaultProps = {
Expand All @@ -155,4 +156,5 @@ ChartAndReport.defaultProps = {
apiLastUpdate: 'Carregando',
tool: '',
height: '35vh',
apiUrl: process.env.NEXT_PUBLIC_EDEMOCRACIA_SWAGGER_URL,
};
3 changes: 3 additions & 0 deletions src/containers/Audiencias/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ function Audiencias(props) {
apiLastUpdate={apiLastConsolidateOfDataDate}
tool={TOOLNAME}
isLoaded
apiUrl={process.env.NEXT_PUBLIC_AUDIENCIAS_SWAGGER_URL}
/>
) : (
<NoDataForSelectedPeriod
Expand Down Expand Up @@ -569,6 +570,7 @@ function Audiencias(props) {
download
apiLastUpdate={apiLastConsolidateOfDataDate}
tool={TOOLNAME}
apiUrl={process.env.NEXT_PUBLIC_AUDIENCIAS_SWAGGER_URL}
/>
</div>
) : (
Expand Down Expand Up @@ -597,6 +599,7 @@ function Audiencias(props) {
chartOptions={audiencesChartsUsersSettings.options}
apiLastUpdate={apiLastConsolidateOfDataDate}
tool={TOOLNAME}
apiUrl={process.env.NEXT_PUBLIC_AUDIENCIAS_SWAGGER_URL}
/>
</div>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function MyApp(props) {
<>
<Head>
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />
<meta NAME="language" CONTENT="pt-br" />
<meta NAME="language" content="pt-br" />
<meta name="robots" content="noindex,nofollow" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet" />
Expand Down
4 changes: 4 additions & 0 deletions src/utils/format/date/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

// Format date to format DD/MM/YYYY
export function formatDate(input) {
if (!input) {
return '00/00/00';
}

const datePart = input.match(/\d+/g);
const year = datePart[0].substring(2);
const month = datePart[1];
Expand Down

0 comments on commit 8f3a423

Please sign in to comment.