From 51f442d3af26bfcef5e3cb5d92af05ac4aa0e789 Mon Sep 17 00:00:00 2001 From: joseCorte-exe Date: Mon, 11 Jul 2022 15:02:57 -0300 Subject: [PATCH] and more fixes --- package.json | 1 + .../buttons/gradientButton/GradientButton.tsx | 3 - .../gradientButton/GradientButtonView.ts | 44 +-- .../graph/cativoXLivreChart/index.tsx | 12 +- .../graph/grossAnualChart/GrossAnualChart.tsx | 4 +- .../grossMensalChart/GrossMensalChart.tsx | 2 +- .../grossMensalChart/GrossMensalChartView.ts | 7 +- src/components/sidebar/Sidebar.tsx | 45 +-- src/components/sidebar/SidebarView.ts | 8 +- src/contexts/menu/MenuContext.tsx | 22 ++ src/pages/_app.tsx | 41 +-- src/pages/aboutUs/index.tsx | 2 +- src/pages/chartTelemetry/index.tsx | 41 +-- src/pages/costIndicator/index.tsx | 40 ++- src/pages/dashboard/index.tsx | 13 +- src/pages/economy/index.tsx | 270 ++++++++++++++++++ src/pages/estimatedCost/index.tsx | 36 ++- src/pages/pld/index.tsx | 62 ++-- src/pages/resumoOperacao/index.tsx | 80 +++--- src/pages/telemetria/index.tsx | 69 +++-- .../charts/telemetry/getPowerFactor.ts | 4 +- .../ResumoOperacao/ResumoOperacaoView.ts | 47 ++- .../AccumulatedSavingsView.ts | 4 - src/styles/layouts/pld/PldView.ts | 12 + tsconfig.json | 2 +- yarn.lock | 37 ++- 26 files changed, 661 insertions(+), 247 deletions(-) create mode 100644 src/contexts/menu/MenuContext.tsx create mode 100644 src/pages/economy/index.tsx diff --git a/package.json b/package.json index a213691..8531239 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "axios": "^0.27.2", "chart.js": "^3.7.1", "chartjs-plugin-datalabels": "^2.0.0", + "chartjs-plugin-style": "^0.5.0", "date-fns": "^2.28.0", "eslint-plugin-react": "^7.29.4", "eslit": "^6.0.0", diff --git a/src/components/buttons/gradientButton/GradientButton.tsx b/src/components/buttons/gradientButton/GradientButton.tsx index 27ed1aa..6f61eda 100644 --- a/src/components/buttons/gradientButton/GradientButton.tsx +++ b/src/components/buttons/gradientButton/GradientButton.tsx @@ -21,9 +21,6 @@ export default function GradientButton({ title, description, orange, purple, gre return ( handleClick()}> - - -

{description}

diff --git a/src/components/buttons/gradientButton/GradientButtonView.ts b/src/components/buttons/gradientButton/GradientButtonView.ts index 53039a5..3e0c97c 100644 --- a/src/components/buttons/gradientButton/GradientButtonView.ts +++ b/src/components/buttons/gradientButton/GradientButtonView.ts @@ -37,33 +37,9 @@ export const GradientButtonView = styled.button` transform: scale(1.1); } - svg { - width: 404px; - left: 0; - position: absolute; - top: 0; - height: 110px; - } - - rect { - fill: none; - stroke: #fff; - stroke-width: 2; - stroke-dasharray: 422, 0; - transition: all 0.35s linear; - } - :hover { background: rgba($red, 0); letter-spacing: 1px; - - - rect { - stroke-width: 5; - stroke-dasharray: 15, 310; - stroke-dashoffset: 48; - transition: all 1.35s cubic-bezier(0.19, 1, 0.22, 1); - } } * { @@ -72,21 +48,11 @@ export const GradientButtonView = styled.button` } p { - :first-child { - font-family: 'Poppins'; - font-style: normal; - font-weight: 700; - font-size: calc(20px); + font-family: 'Poppins'; + font-style: normal; + font-weight: 700; + font-size: 11px; - text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); - } - :last-child { - font-family: 'Poppins'; - font-style: normal; - font-weight: 700; - font-size: 11px; - - text-transform: uppercase; - } + text-transform: uppercase; } ` diff --git a/src/components/graph/cativoXLivreChart/index.tsx b/src/components/graph/cativoXLivreChart/index.tsx index 8aa4508..1ba2fd2 100644 --- a/src/components/graph/cativoXLivreChart/index.tsx +++ b/src/components/graph/cativoXLivreChart/index.tsx @@ -107,7 +107,7 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, red, data dataArr.map(data => { sum += data; }); - const result = `${(parseFloat(value)).toLocaleString('pt-br')}` + const result = `${(parseInt(value)).toLocaleString('pt-br')}` return value==null? null : result } @@ -136,7 +136,7 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, red, data }, borderWidth: 2, fill: false, - data: chartData.map(value => value.economia_mensal), + data: chartData.map(value => parseInt(value.economia_mensal)), }, { type: 'bar' as const, @@ -146,7 +146,7 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, red, data }, data: chartData.map(value => { if (!value.dad_estimado) - return value.custo_cativo + return parseInt(value.custo_cativo) }), }, { @@ -158,7 +158,7 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, red, data }, data: chartData.map(value => { if (!value.dad_estimado) - return value.custo_livre + return parseInt(value.custo_livre) }), }, { @@ -167,7 +167,7 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, red, data backgroundColor: pattern.draw('diagonal', '#C2D5FB'), data: chartData.map(value => { if (value.dad_estimado) - return value.custo_cativo + return parseInt(value.custo_cativo) }), }, { @@ -176,7 +176,7 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, red, data backgroundColor: pattern.draw('diagonal', '#255488'), data: chartData.map(value => { if (value.dad_estimado) - return value.custo_livre + return parseInt(value.custo_livre) }), } ], diff --git a/src/components/graph/grossAnualChart/GrossAnualChart.tsx b/src/components/graph/grossAnualChart/GrossAnualChart.tsx index 151be0e..ee7f3b1 100644 --- a/src/components/graph/grossAnualChart/GrossAnualChart.tsx +++ b/src/components/graph/grossAnualChart/GrossAnualChart.tsx @@ -92,7 +92,7 @@ export function GrossAnulChart({ title, subtitle, dataProps, label, dataset, bar position: 'bottom' as const, labels: { font: { - size: 16, + size: 12, } } }, @@ -144,7 +144,7 @@ export function GrossAnulChart({ title, subtitle, dataProps, label, dataset, bar return ( - + ) } diff --git a/src/components/graph/grossMensalChart/GrossMensalChart.tsx b/src/components/graph/grossMensalChart/GrossMensalChart.tsx index ecbdaeb..3a20a45 100644 --- a/src/components/graph/grossMensalChart/GrossMensalChart.tsx +++ b/src/components/graph/grossMensalChart/GrossMensalChart.tsx @@ -132,7 +132,7 @@ export default function GrossMensalChart({ title, data1, data2, label, subtitle, + data={data} type={'bar'} height={'156'}/> ) } diff --git a/src/components/graph/grossMensalChart/GrossMensalChartView.ts b/src/components/graph/grossMensalChart/GrossMensalChartView.ts index 28abf0c..2302e81 100644 --- a/src/components/graph/grossMensalChart/GrossMensalChartView.ts +++ b/src/components/graph/grossMensalChart/GrossMensalChartView.ts @@ -1,14 +1,11 @@ import styled from "styled-components" export const GrossMensalChartView = styled.div` - width: 100%; + width: 90%; - div{ - /* margin-top: 10px; */ - } + transform: translateY(-25px); @media (max-width: 900px) { min-width: 20rem } - ` diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx index 12e3a27..8c8c167 100644 --- a/src/components/sidebar/Sidebar.tsx +++ b/src/components/sidebar/Sidebar.tsx @@ -2,13 +2,17 @@ import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Modal from '@mui/material/Modal'; import Typography from '@mui/material/Typography'; -import { GetServerSideProps } from 'next'; + import Image from 'next/image' import Link from 'next/link' + import { useRouter } from 'next/router' import { parseCookies } from 'nookies'; import React, { useContext, useEffect, useState } from 'react' + import { AuthContext } from '../../contexts/AuthContext'; +import { MenuContext } from '../../contexts/menu/MenuContext'; + import { api } from '../../services/api'; import RenderIf from '../../utils/renderIf'; @@ -30,6 +34,8 @@ const style = { }; export default function Sidebar() { + const {pldMenu, setPldMenu, economyMenu, setEconomyMenu} = useContext(MenuContext) + const [open, setOpen] = useState(false); const handleOpen = () => setOpen(true); const handleClose = () => setOpen(false); @@ -37,6 +43,8 @@ export default function Sidebar() { const { signOut } = useContext(AuthContext) const [ economiaDrawer, setEconomiaDrawer ] = useState(false) + const [ pldDrawer, setPldDrawer ] = useState(false) + const [ notificationsCount, setNotificationsCount ] = useState(0) const [ viewModal, setViewModal ] = useState(false) @@ -97,7 +105,7 @@ export default function Sidebar() { - +
setViewModal(!viewModal)} >
@@ -106,17 +114,22 @@ export default function Sidebar() {
  • {'Visão Geral'}
  • -
  • setEconomiaDrawer(!economiaDrawer)} className={router.pathname=='/grossSavings' || router.pathname=='/accumulatedSavings' || router.pathname=='/estimatedCost' || router.pathname=='/costIndicator' ? 'actualPath' : null } >{'Economia >'}
  • -
    -
  • Economia Bruta Anual
  • -
  • Economia Bruta Mensal
  • -
  • Cativo x Livre Mensal
  • -
  • Custo R$/MWh
  • -
    +
  • setEconomiaDrawer(!economiaDrawer)} className={router.pathname=='/grossSavings' || router.pathname=='/accumulatedSavings' || router.pathname=='/estimatedCost' || router.pathname=='/costIndicator' ? 'actualPath' : null } >{'Economia'}
  • + {/*
    +
  • setEconomyMenu(0)} className={economyMenu===0? 'actualPathDrawer' : null}>Economia Bruta Anual
  • +
  • setEconomyMenu(1)} className={economyMenu===1? 'actualPathDrawer' : null}>Economia Bruta Mensal
  • +
  • setEconomyMenu(2)} className={economyMenu===2? 'actualPathDrawer' : null}>Cativo x Livre Mensal
  • +
  • setEconomyMenu(3)} className={economyMenu===3? 'actualPathDrawer' : null}>Custo R$/MWh
  • +
    */}
  • {'Telemetria'}
  • {'Resumo de Op. '}
  • {'Notícias'}
  • -
  • {'PLD'}
  • +
  • setPldDrawer(!pldDrawer)} className={router.pathname=='/pld'? 'actualPath' : null}>{'PLD >'}
  • +
    +
  • setPldMenu(0)} className={pldMenu==0? 'actualPathDrawer' : null}>PLD Histórico
  • +
  • setPldMenu(1)} className={pldMenu===1? 'actualPathDrawer' : null}>Valores Diários
  • +
  • setPldMenu(2)} className={pldMenu===2? 'actualPathDrawer' : null}>Valores Horários
  • +
  • {'Info Setorial'}
  • {/*
  • {'Consumo'}
  • */}
  • {'Notificações'}

    {notificationsCount}

  • @@ -124,15 +137,15 @@ export default function Sidebar() {
  • {'FAQ'}
  • - + Deseja realmente sair ?
    @@ -141,7 +154,7 @@ export default function Sidebar() {
    -
    +