From b97b7ed8dd290776c5a7badbd0e406f3b9442ebc Mon Sep 17 00:00:00 2001 From: joseCorte-exe Date: Fri, 22 Jul 2022 14:20:08 -0300 Subject: [PATCH] label size --- src/components/graph/DemRegXDemConChart.tsx | 18 +++++-- .../graph/DiscretizedConsumptionChart.tsx | 19 +++++-- .../graph/DiscretizedConsumptionChartLine.tsx | 3 ++ src/components/graph/LineBarChart.tsx | 17 ++++++- src/components/graph/LineChart.tsx | 17 ++++++- .../graph/cativoXLivreChart/index.tsx | 36 +++++++++----- .../graph/costIndicatorChart/index.tsx | 26 ++++++---- src/components/graph/fatorPotenciaChart.tsx | 14 +++++- .../graph/grossAnualChart/GrossAnualChart.tsx | 33 ++++++++----- .../grossMensalChart/GrossMensalChart.tsx | 28 +++++++---- src/pages/economy/index.tsx | 8 +-- src/pages/faq/index.tsx | 34 +++++++------ src/pages/news/index.tsx | 3 +- src/pages/notifications/index.tsx | 34 +++++++------ src/pages/telemetria/index.tsx | 49 ++++++------------- .../layouts/Telemetria/TelemetriaView.ts | 20 +------- src/styles/layouts/economy/economy.ts | 15 +----- src/styles/layouts/news/NewsView.ts | 2 +- 18 files changed, 215 insertions(+), 161 deletions(-) diff --git a/src/components/graph/DemRegXDemConChart.tsx b/src/components/graph/DemRegXDemConChart.tsx index b3efb90..dcd17e6 100644 --- a/src/components/graph/DemRegXDemConChart.tsx +++ b/src/components/graph/DemRegXDemConChart.tsx @@ -92,12 +92,22 @@ export function DemRegXDemConChart({ x: { grid: { display: false - } + }, + ticks: { + font: { + size: 16 + } + }, }, y: { grid: { display: false - } + }, + ticks: { + font: { + size: 16 + } + }, }, }, plugins: { @@ -140,8 +150,9 @@ export function DemRegXDemConChart({ { type: 'bar' as const, label: 'Demanda Registrada', - backgroundColor: '#255488', data: data2?.map(value => value.dem_reg), + borderRadius: 8, + backgroundColor: '#255488', }, ], }; @@ -154,7 +165,6 @@ export function DemRegXDemConChart({ return ( - {/* */}
diff --git a/src/components/graph/DiscretizedConsumptionChart.tsx b/src/components/graph/DiscretizedConsumptionChart.tsx index 7688a91..b71577b 100644 --- a/src/components/graph/DiscretizedConsumptionChart.tsx +++ b/src/components/graph/DiscretizedConsumptionChart.tsx @@ -40,12 +40,22 @@ export function DiscretizedConsumptionChart({ title, subtitle, dataProps, label, x: { grid: { display: false - } + }, + ticks: { + font: { + size: 16 + } + }, }, y: { grid: { display: false - } + }, + ticks: { + font: { + size: 16 + } + }, }, }, plugins: { @@ -68,6 +78,7 @@ export function DiscretizedConsumptionChart({ title, subtitle, dataProps, label, { type: 'line' as const, label: 'reativa', + borderRadius: 8, borderColor: '#F00' , fill: false, borderDash: [5, 5], @@ -78,8 +89,9 @@ export function DiscretizedConsumptionChart({ title, subtitle, dataProps, label, { type: 'bar' as const, label: 'consumo', - backgroundColor: '#74acec', data: dataProps.map(value => value.consumo), + borderRadius: 8, + backgroundColor: '#74acec', }, // { // type: 'line' as const, @@ -97,7 +109,6 @@ export function DiscretizedConsumptionChart({ title, subtitle, dataProps, label, return ( - {/* */}
diff --git a/src/components/graph/DiscretizedConsumptionChartLine.tsx b/src/components/graph/DiscretizedConsumptionChartLine.tsx index 8b987cd..5b11b01 100644 --- a/src/components/graph/DiscretizedConsumptionChartLine.tsx +++ b/src/components/graph/DiscretizedConsumptionChartLine.tsx @@ -70,6 +70,7 @@ export default function DiscretizedConsumptionChartLine({ title, subtitle, data1 datasets: [ { label: dataset1, + borderRadius: 8, data: data1.map(value => value.reativa), borderColor: 'rgb(53, 162, 235)', backgroundColor: 'rgba(53, 162, 235, 0)', @@ -77,6 +78,7 @@ export default function DiscretizedConsumptionChartLine({ title, subtitle, data1 { label: 'base', data: data1.map(value => 500), + borderRadius: 8, borderColor: 'rgb(0, 0, 0)', fill: false, backgroundColor: 'rgba(255, 145, 0, 0)' , @@ -85,6 +87,7 @@ export default function DiscretizedConsumptionChartLine({ title, subtitle, data1 { label: 'tolerância', data: data1.map(value => 525), + borderRadius: 8, borderColor: 'rgb(255, 0, 0)', fill: false, backgroundColor: 'rgba(255, 145, 0, 0)' , diff --git a/src/components/graph/LineBarChart.tsx b/src/components/graph/LineBarChart.tsx index 78100d8..95b7ba6 100644 --- a/src/components/graph/LineBarChart.tsx +++ b/src/components/graph/LineBarChart.tsx @@ -88,7 +88,22 @@ export function LineBarChart({ title, subtitle, data1, data2, data3, label, red, x: { grid: { display: false - } + }, + ticks: { + font: { + size: 16 + } + }, + }, + y: { + grid: { + display: false + }, + ticks: { + font: { + size: 16 + } + }, }, }, plugins: { diff --git a/src/components/graph/LineChart.tsx b/src/components/graph/LineChart.tsx index 1862a66..f25259f 100644 --- a/src/components/graph/LineChart.tsx +++ b/src/components/graph/LineChart.tsx @@ -50,7 +50,22 @@ export default function LineChart({ title, subtitle, data1, data2, data3, data4, x: { grid: { display: false - } + }, + ticks: { + font: { + size: 16 + } + }, + }, + y: { + grid: { + display: false + }, + ticks: { + font: { + size: 16 + } + }, }, }, plugins: { diff --git a/src/components/graph/cativoXLivreChart/index.tsx b/src/components/graph/cativoXLivreChart/index.tsx index 5732a2b..565a115 100644 --- a/src/components/graph/cativoXLivreChart/index.tsx +++ b/src/components/graph/cativoXLivreChart/index.tsx @@ -82,12 +82,22 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1, x: { grid: { display: false - } + }, + ticks: { + font: { + size: !miniature? 16 : 10 + } + }, }, y: { grid: { display: false - } + }, + ticks: { + font: { + size: !miniature? 16 : 10 + } + }, }, }, plugins: { @@ -141,48 +151,50 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1, { type: 'bar' as const, label: 'Cativo', - backgroundColor: '#C2D5FB', data: chartData?.map(value => { if (!value.dad_estimado) return parseInt(value.custo_cativo) }), + borderRadius: 8, + backgroundColor: '#C2D5FB', + stack: 'cativo' }, { type: 'bar' as const, label: 'Livre', - backgroundColor: '#255488', data: chartData?.filter(value => !value.dad_estimad? true : false).map(value => { if (!value.dad_estimado) return parseInt(value.custo_livre) }), + borderRadius: 8, + backgroundColor: '#255488', + stack: 'livre' }, { type: 'bar', label: 'Est. Cativo', - backgroundColor: pattern.draw('diagonal', '#C2D5FB'), data: chartData?.map(value => { if (value.dad_estimado) return parseInt(value.custo_cativo) }), + borderRadius: 8, + backgroundColor: pattern.draw('diagonal', '#C2D5FB'), + stack: 'cativo' }, { type: 'bar', label: 'Est. Livre', - backgroundColor: pattern.draw('diagonal', '#255488'), data: chartData?.map(value => { if (value.dad_estimado) return parseInt(value.custo_livre) }), + borderRadius: 8, + backgroundColor: pattern.draw('diagonal', '#255488'), + stack: 'livre' } ], } - useEffect(() => { - const chart = chartRef.current; - - // triggerTooltip(chart); - }, []); - return ( diff --git a/src/components/graph/costIndicatorChart/index.tsx b/src/components/graph/costIndicatorChart/index.tsx index 31e3db3..856a342 100644 --- a/src/components/graph/costIndicatorChart/index.tsx +++ b/src/components/graph/costIndicatorChart/index.tsx @@ -45,12 +45,22 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl x: { grid: { display: false - } + }, + ticks: { + font: { + size: !miniature? 16 : 10 + } + }, }, y: { grid: { display: false - } + }, + ticks: { + font: { + size: !miniature? 16 : 10 + } + }, }, }, plugins: { @@ -90,36 +100,32 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl { label: '2021', data: data1?.map(value => value.custo_unit>0? value.custo_unit : null), - // backgroundColor: '#C2d5fb' + borderRadius: 8, backgroundColor: (value, ctx) => { if (value.dad_estimado) return draw('diagonal-right-left', '#C2d5fb'); else return '#C2d5fb' }, + stack: '0' }, { label: '2022', data: data2?.map(value => value.custo_unit>0? value.custo_unit : null), - // backgroundColor: '#255488' + borderRadius: 8, backgroundColor: (value, ctx) => { if (value.dad_estimado) return draw('diagonal-right-left', '#255488'); else return '#255488' }, + stack: '0' } ], } return ( - {/* - - */} value.dad_estimado === false).map((value, index) => { return parseFloat(value.economia_acumulada) }), + borderRadius: 10, backgroundColor: '#255488', }, { @@ -124,8 +134,9 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba label: 'Estimado', data: dataProps.filter(value => value.ano === '2022').map((value, index) => { if (value.dad_estimado) - return parseFloat(value.economia_acumulada) + return parseFloat(value.economia_acumulada) }), + borderRadius: 10, backgroundColor: draw('diagonal-right-left', '#C2d5fb'), }, ], diff --git a/src/components/graph/grossMensalChart/GrossMensalChart.tsx b/src/components/graph/grossMensalChart/GrossMensalChart.tsx index 40d8ef2..a0008b2 100644 --- a/src/components/graph/grossMensalChart/GrossMensalChart.tsx +++ b/src/components/graph/grossMensalChart/GrossMensalChart.tsx @@ -55,12 +55,22 @@ export default function GrossMensalChart({ title, data1, data2, label, subtitle, x: { grid: { display: false - } + }, + ticks: { + font: { + size: !miniature? 16 : 10 + } + }, }, y: { grid: { display: false - } + }, + ticks: { + font: { + size: !miniature? 16 : 10 + } + }, }, }, plugins: { @@ -103,25 +113,23 @@ export default function GrossMensalChart({ title, data1, data2, label, subtitle, type: 'bar', label: 'Consolidado', data: data1.map(value => !value.dad_estimado? value?.economia_acumulada : null), - backgroundColor: '#255488' + borderRadius: 8, + backgroundColor: '#255488', + stack: '0' }, { type: 'bar', label: 'Estimado', data: data2.map(value => value.dad_estimado? value?.economia_acumulada : null), - backgroundColor: draw('diagonal-right-left', '#C2d5fb') + borderRadius: 8, + backgroundColor: draw('diagonal-right-left', '#C2d5fb'), + stack: '0' }, ], } return ( - {/* - - */} { api.post('/economy/estimates', unity!==''?{ "filters": [ - {"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity} + {"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity!=="default"? null : unity} ] }:{}).then(res => { setCatLivDataState(res.data.data) @@ -75,7 +75,7 @@ export default function economy({userName, anual, years, brutaMensal, yearsBruta useEffect(() => { api.post('/economy/MWh', unity!==''?{ "filters": [ - {"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity} + {"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity!=="default"? null : unity} ] }:{}).then(res => { setIndicatorDataState(res.data.data) @@ -152,7 +152,7 @@ export default function economy({userName, anual, years, brutaMensal, yearsBruta onChange={value => setUnity(value.target.value)} fullWidth > - Todas + Todas {/* RSZFNAENTR101P !!OPÇAO COM DADOS TESTES!! */} { clients.map((value) => { @@ -182,7 +182,7 @@ export default function economy({userName, anual, years, brutaMensal, yearsBruta onChange={value => setUnity(value.target.value)} fullWidth > - Todas + Todas {/* RSZFNAENTR101P COMENTARIO DE OPÇAO COM DADOS TESTES */} { clients.map((value) => { diff --git a/src/pages/faq/index.tsx b/src/pages/faq/index.tsx index 372776c..e327e35 100644 --- a/src/pages/faq/index.tsx +++ b/src/pages/faq/index.tsx @@ -12,28 +12,30 @@ import { FaqView } from '../../styles/layouts/commonQuestions/FaqView' export default function commonQuestions({faqData, userName}) { return ( - +
Smart Energia - FAQ
- {/* */} -
- { - faqData.length<1? -

Nenhuma pergunta no momento!

+ + {/* */} +
+ { + faqData.length!==0? + faqData.map((value, index ) => { + return <> + +
+ + }) : - faqData.map((value, index ) => { - return <> - -
- - }) - } -
-
+

Nenhuma pergunta no momento!

+ } +
+ +
) } @@ -47,7 +49,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { await apiClient.get('/faq').then(res => { faqData = res.data.data }).catch(res => { - // console.log(res) + console.log(res) }) if (!token) { diff --git a/src/pages/news/index.tsx b/src/pages/news/index.tsx index a8c04b7..31d2e59 100644 --- a/src/pages/news/index.tsx +++ b/src/pages/news/index.tsx @@ -46,10 +46,9 @@ export default function aboutUs({userName, news}: any) { }) } - Ver Mais + rel={"noreferrer"}>Ver todas as notícias diff --git a/src/pages/notifications/index.tsx b/src/pages/notifications/index.tsx index 0521ae9..5694a14 100644 --- a/src/pages/notifications/index.tsx +++ b/src/pages/notifications/index.tsx @@ -12,28 +12,30 @@ import Banner from '../../components/banner/Banner' export default function Notifications({notificationData, userName}: any) { return ( - +
Smart Energia - Notificações
- {/* */} -
- { - notificationData.length!=0? - notificationData.map((value, index ) => { - return <> - -
- - }) - : -

Você não tem notificações!

- } -
- + + {/* */} +
+ { + notificationData.length!=0? + notificationData.map((value, index ) => { + return <> + +
+ + }) + : +

Você não tem notificações!

+ } +
+
+
) } diff --git a/src/pages/telemetria/index.tsx b/src/pages/telemetria/index.tsx index 79f323c..1915750 100644 --- a/src/pages/telemetria/index.tsx +++ b/src/pages/telemetria/index.tsx @@ -144,25 +144,6 @@ export default function Telemetria({userName, clients}: any) { setOpenSnackSuccess(false) }) } - - function handleVerifyFields() { - if (unity != '' && startDate.toLocaleDateString() != '' && endDate.toLocaleDateString() != '' && discretization != '') { - router.push({ - pathname: '/chartTelemetry', - query: { - 'startDate': startDate.toLocaleDateString(), - 'endDate': endDate.toLocaleDateString(), - discretization, - unity - }, - }) - return true - } else { - setOpenSnackFields(true) - return false - } - } - async function getChartData() { const html = document.querySelector("table")?.outerHTML; await api.post('/telemetry/demand', { @@ -195,12 +176,6 @@ export default function Telemetria({userName, clients}: any) { getChartData() }, [send]) - useEffect(() => { - // getDiscretization("PRAXCUENTR101P", "2022-01-01", "2022-01-31", "med_5min") - // .then(result => setDiscretizedConsumptionData(result)) - // .catch(exception => console.log(exception)) - }, [discretization]) - return(
@@ -243,7 +218,7 @@ export default function Telemetria({userName, clients}: any) { severity="error" sx={{ width: '100%' }} > - Verifique os campos! + Verifique os campos e tente novamente! @@ -351,9 +326,10 @@ export default function Telemetria({userName, clients}: any) {
{ + setSend(true) getDiscretization(unity, startDate, endDate, discretization) - .then(result => setDiscretizedConsumptionData(result)) - .catch(exception => console.log(exception)) + .then(result => {setDiscretizedConsumptionData(result); setSend(false)}) + .catch(exception => {setSend(false); setOpenSnackFields(true)}) }}/>
@@ -447,9 +423,10 @@ export default function Telemetria({userName, clients}: any) {
{ + setSend(true) getDemand(unity, startDate, endDate, discretization) - .then(result => setDemRegXDemCon(result)) - .catch(exception => console.log(exception)) + .then(result => {setDemRegXDemCon(result); setSend(false)}) + .catch(exception => {setSend(false); setOpenSnackFields(true)}) }}/>
@@ -539,9 +516,10 @@ export default function Telemetria({userName, clients}: any) {
{ + setSend(true) getPowerFactorData(unity, startDate, endDate, discretization) - .then(result => setFatorPotenciaData(result)) - .catch(exception => console.log(exception)) + .then(result => {setFatorPotenciaData(result); setSend(false)}) + .catch(exception => {setSend(false); setOpenSnackFields(true)}) }}/>
@@ -598,11 +576,12 @@ export default function Telemetria({userName, clients}: any) { -
+
{ + setSend(true) getDemand(unity, startDate, endDate, discretization) - .then(result => setDiscretizedConsumptionData(result)) - .catch(exception => console.log(exception)) + .then(result => {setDiscretizedConsumptionData(result); setSend(false)}) + .catch(exception => {setSend(false); setOpenSnackFields(true)}) }}/>
diff --git a/src/styles/layouts/Telemetria/TelemetriaView.ts b/src/styles/layouts/Telemetria/TelemetriaView.ts index 9498483..bc40e8b 100644 --- a/src/styles/layouts/Telemetria/TelemetriaView.ts +++ b/src/styles/layouts/Telemetria/TelemetriaView.ts @@ -191,7 +191,7 @@ export const TelemetriaView = styled.main` .MuiInputLabel-outlined { margin-top: 11px; } - .Mui-focused { + .Mui-focused, .MuiInputLabel-shrink { margin-top: 0!important; } } @@ -226,23 +226,7 @@ export const TelemetriaView = styled.main` flex-wrap: wrap; .select { - display: flex; - align-items: flex-start; - justify-content: center; - - flex-direction: column; - /* height: 10em; */ - - :nth-child(1) { - label { - margin-top: 10px; - } - } - :nth-child(2) { - label { - margin-top: 10px; - } - } + margin-bottom: 17px;// input margin bottom } } `; diff --git a/src/styles/layouts/economy/economy.ts b/src/styles/layouts/economy/economy.ts index a4d10eb..6c370c4 100644 --- a/src/styles/layouts/economy/economy.ts +++ b/src/styles/layouts/economy/economy.ts @@ -22,23 +22,10 @@ export const EconomyView = styled.main` .MuiInputLabel-outlined { margin-top: 11px; } - .Mui-focused { + .Mui-focused, .MuiInputLabel-shrink { margin-top: 0!important; } .chartBox { } - - /* input { - width: 16.6rem; - height: 63px!important; - - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - font-weight: 400; - - border-radius: 6px; - border: solid gray 1px; - - background-color: #F9F9F9; - } */ ` diff --git a/src/styles/layouts/news/NewsView.ts b/src/styles/layouts/news/NewsView.ts index 8a3aa42..3a550b5 100644 --- a/src/styles/layouts/news/NewsView.ts +++ b/src/styles/layouts/news/NewsView.ts @@ -84,7 +84,7 @@ export const NewsView = styled.main` align-items: center; margin-top: 1px; - width: 140px; + width: 170px; height: 45px; cursor: pointer;