From 105a9619fa5222f01e56d99b91bb40f85c8dfbba Mon Sep 17 00:00:00 2001 From: joseandre25 Date: Tue, 24 Oct 2023 20:32:59 -0300 Subject: [PATCH] =?UTF-8?q?:pencil:=20formata=C3=A7=C3=A3o=20da=20home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Charts/MyCharts.tsx | 0 src/components/Pages/Home.tsx | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 src/components/Charts/MyCharts.tsx diff --git a/src/components/Charts/MyCharts.tsx b/src/components/Charts/MyCharts.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/components/Pages/Home.tsx b/src/components/Pages/Home.tsx index e9f93b6..6581b3e 100644 --- a/src/components/Pages/Home.tsx +++ b/src/components/Pages/Home.tsx @@ -1,5 +1,6 @@ import Image from "next/image"; import { useState, useEffect } from "react" + interface TitleProps { municipio: string; ano: string; @@ -8,6 +9,7 @@ interface TitleProps { export const Home = ({ municipio, ano }: TitleProps) => { const [titleText, setTitleText] = useState("Brasília"); const [bids, setBids] = useState([]); + const buildTitle = () => { fetch(`https://raw.githubusercontent.com/unb-mds/2023-2-Squad07/main/public/resultados.json`, { method: 'GET', @@ -21,9 +23,17 @@ export const Home = ({ municipio, ano }: TitleProps) => { if (municipio === 'geral') { setTitleText('Ceará') } - }, [setTitleText, municipio]); + }, [municipio]); + + // Função para formatar a saída dos avisos + const formatAviso = (bid: any) => { + return ( +
+ No dia {bid.pdf_filename.replace(/APRECE_(\d{2})_(\d{2})_(\d{2}).pdf/, '$1/$2/$3')} houveram {bid.num_avisos_licitacao} avisos de licitação. +
+ ); + }; - console.log() return (
@@ -53,12 +63,11 @@ export const Home = ({ municipio, ano }: TitleProps) => {
{bids.map((bid: any, i: number) => (
- <>{bid.pdf_filename} - <>{bid.num_avisos_licitacao} + {formatAviso(bid)}
))}
) -} \ No newline at end of file +}