From 8bc13d035b17f2e66cf25780b909008e1fe5968b Mon Sep 17 00:00:00 2001 From: joseCorte-exe Date: Thu, 23 Jun 2022 17:41:37 -0300 Subject: [PATCH 1/3] :art: change resumo operacao selects position --- src/pages/resumoOperacao.tsx | 8 +++++--- src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/resumoOperacao.tsx b/src/pages/resumoOperacao.tsx index dc44829..9aa7d9a 100644 --- a/src/pages/resumoOperacao.tsx +++ b/src/pages/resumoOperacao.tsx @@ -84,6 +84,8 @@ export default function ResumoOperacao({tableData, clientsData, userName, client } else { setTableDataState(tableData) } + + console.log(month) }, [month, unidade]) return ( @@ -96,7 +98,7 @@ export default function ResumoOperacao({tableData, clientsData, userName, client

Seletor Mês

- + Unidades Nenhum { clientMonth.map((value) => { - return {monthLabels[parseFloat(value.mes.slice(3, 4))-1]} + return {monthLabels[parseFloat(value.mes.slice(3, 4))-1]} }) } diff --git a/src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts b/src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts index c059741..2e6db5b 100644 --- a/src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts +++ b/src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts @@ -19,6 +19,7 @@ export const TableView = styled.div` .select{ display: flex; + flex-direction: column; margin-bottom: 25px; From 32b592ce02d467b2d44a7d24620720a9e25db153 Mon Sep 17 00:00:00 2001 From: Alex Santos Date: Thu, 23 Jun 2022 22:21:25 -0300 Subject: [PATCH 2/3] support login --- src/pages/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index a95fd64..5e2d390 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -71,7 +71,7 @@ export default function Home() { }else{ try { await signIn({email, password}).then((res: any) => { - if (res.response.status === 422) { + if (res.response.status === 422 || res.response.status === 401) { setOpenSnackError(true) } }) From 62bc63d595720a9f26e84f76ba64160bd88c1626 Mon Sep 17 00:00:00 2001 From: joseCorte-exe Date: Fri, 24 Jun 2022 02:18:15 -0300 Subject: [PATCH 3/3] fixing --- src/components/banner/BannerView.ts | 5 ++++ .../gradientButton/GradientButtonView.ts | 2 ++ src/components/sidebar/Sidebar.tsx | 6 ++--- src/components/sidebar/SidebarView.ts | 14 ++++++++++ src/pages/_app.tsx | 1 + src/pages/administrative/clients/index.tsx | 4 +-- src/pages/dashboard.tsx | 6 +---- src/pages/faq.tsx | 7 +++-- src/pages/grossSavings.tsx | 2 +- src/pages/index.tsx | 13 +--------- src/pages/industryInfo.tsx | 11 +++++--- src/pages/news.tsx | 19 +++++++++++--- src/pages/notifications.tsx | 3 +-- src/pages/resumoOperacao.tsx | 23 +++++++++++----- src/styles/Home.module.css | 8 ++++++ src/styles/globals.ts | 15 +++++++++++ .../ChatTelemetry/ChatTelemetryView.ts | 4 +-- .../layouts/Telemetria/TelemetriaView.ts | 17 ++++++++---- .../layouts/industryInfo/IndustryInfoView.ts | 26 ++++++++++--------- 19 files changed, 127 insertions(+), 59 deletions(-) diff --git a/src/components/banner/BannerView.ts b/src/components/banner/BannerView.ts index a9a5a3e..2598880 100644 --- a/src/components/banner/BannerView.ts +++ b/src/components/banner/BannerView.ts @@ -39,8 +39,13 @@ export const BannerView = styled.div` overflow: hidden; + text-overflow: ellipsis; + p { font-size: 70%; + /* height: 43px; */ + + text-overflow: ellipsis; } * { diff --git a/src/components/buttons/gradientButton/GradientButtonView.ts b/src/components/buttons/gradientButton/GradientButtonView.ts index eec6e29..4954b4f 100644 --- a/src/components/buttons/gradientButton/GradientButtonView.ts +++ b/src/components/buttons/gradientButton/GradientButtonView.ts @@ -9,7 +9,9 @@ export const GradientButtonView = styled.button` border-radius: 2px; width: 30%; + min-width: 240px; height: 110px; + min-height: 110px; margin-bottom: 25px; font-family: 'Poppins'; diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx index d8aaa02..d113e95 100644 --- a/src/components/sidebar/Sidebar.tsx +++ b/src/components/sidebar/Sidebar.tsx @@ -34,7 +34,7 @@ export default function Sidebar() { const { signOut } = useContext(AuthContext) const [ economiaDrawer, setEconomiaDrawer ] = useState(false) - const [ notificationsCount, setNotificationsCount ] = useState() + const [ notificationsCount, setNotificationsCount ] = useState(0) const [ viewModal, setViewModal ] = useState(false) @@ -105,7 +105,7 @@ export default function Sidebar() {
  • Economia Bruta Anual
  • Economia Bruta Mensal
  • Cativo x Livre mensal
  • -
  • Custo R/MWh
  • +
  • Custo R$/MWh
  • {'Telemetria >'}
  • {'Resumo de Op. '}
  • @@ -113,7 +113,7 @@ export default function Sidebar() {
  • {'PLD >'}
  • {'Info Setorial >'}
  • {/*
  • {'Consumo'}
  • */} -
  • {'Notificações >'}

    {notificationsCount}

  • +
  • {'Notificações >'}

    {notificationsCount}

  • {'Sobre Nós >'}
  • {'FAQ >'}
  • diff --git a/src/components/sidebar/SidebarView.ts b/src/components/sidebar/SidebarView.ts index 7ab88a9..5cc3931 100644 --- a/src/components/sidebar/SidebarView.ts +++ b/src/components/sidebar/SidebarView.ts @@ -80,6 +80,13 @@ export const SidebarView = styled.nav` cursor: pointer; padding-left: 40px; + + transition: all 350ms ease-in; + + :hover { + color: rgb(37, 79, 127); + border-left: 8px solid rgb(37, 79, 127); + } } .economiaDrawer { @@ -162,6 +169,13 @@ export const SidebarView = styled.nav` color: #f00; cursor: pointer; + + transition: all 350ms ease-in; + + :hover { + opacity: 0.9; + box-shadow: rgb(0, 0, 0, 0.2) 0px 2px 4px -1px; + } } @media (max-width: 1008px) { diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 3636835..70523a6 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -14,6 +14,7 @@ import ForgotPassword from './forgotPassword' import VerifyEmail from './verifyEmail' import '../styles/globals.ts' +import '../styles/Home.module.css' import '../styles/nprogress/nprogress.css' import { GetServerSideProps } from 'next' import { parseCookies } from 'nookies' diff --git a/src/pages/administrative/clients/index.tsx b/src/pages/administrative/clients/index.tsx index 787cea7..32ab35c 100644 --- a/src/pages/administrative/clients/index.tsx +++ b/src/pages/administrative/clients/index.tsx @@ -173,10 +173,10 @@ export default function clients({clients, userName}) { name: value.target.value }) }} variant="outlined" /> - { + { setClient({ ...client, - email: value.target.value + email: value.target.value.toLowerCase() }) }} variant="outlined" /> { diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 1bdfc69..3c234a4 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -34,7 +34,7 @@ export default function Dashboard({grossAnualGraph, grossAnualYears, grossMensal
    - + { mapsInfo.map(value => { return @@ -82,10 +82,6 @@ export default function Dashboard({grossAnualGraph, grossAnualYears, grossMensal }).map(value => value.mes)} barLabel />
    - - ) } diff --git a/src/pages/faq.tsx b/src/pages/faq.tsx index a21d29b..a762df3 100644 --- a/src/pages/faq.tsx +++ b/src/pages/faq.tsx @@ -4,6 +4,7 @@ import { parseCookies } from 'nookies' import React from 'react' import CommonQuestionsCard from '../components/faqQuestionsCard/FaqQuestionsCard' import Header from '../components/header/Header' +import PageTitle from '../components/pageTitle/PageTitle' import { api } from '../services/api' import getAPIClient from '../services/ssrApi' import { FaqView } from '../styles/layouts/commonQuestions/FaqView' @@ -16,8 +17,9 @@ export default function commonQuestions({faqData, userName}) { Smart Energia - FAQ
    -

    Perguntas Frequentes

    -

    Aqui estão algumas das perguntas que mais recebemos!

    + + {/*

    Perguntas Frequentes

    +

    Aqui estão algumas das perguntas que mais recebemos!

    */}
    { faqData.map((value, index ) => { @@ -31,6 +33,7 @@ export default function commonQuestions({faqData, userName}) { ) } + export const getServerSideProps: GetServerSideProps = async (ctx) => { const apiClient = getAPIClient(ctx) const { ['@smartAuth-token']: token } = parseCookies(ctx) diff --git a/src/pages/grossSavings.tsx b/src/pages/grossSavings.tsx index 5a18bf0..b7413d5 100644 --- a/src/pages/grossSavings.tsx +++ b/src/pages/grossSavings.tsx @@ -47,6 +47,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { }) const years = graphData.map((value) => value.ano) + console.log(years) if (!token) { return { @@ -57,7 +58,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { } } - return { props: { graphData, diff --git a/src/pages/index.tsx b/src/pages/index.tsx index a95fd64..1094dac 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -58,7 +58,6 @@ export default function Home() { }); }; - const handleMouseDownPassword = (event) => { event.preventDefault(); }; @@ -113,16 +112,6 @@ export default function Home() { Prencha os Campos corretamente! - {/* - - notificação excluida com sucesso! - - */} - {/* - - Notificação não excluida! - - */}
    @@ -136,7 +125,7 @@ export default function Home() { { - setEmail(value.target.value) + setEmail(value.target.value.toLowerCase()) }}/> Password diff --git a/src/pages/industryInfo.tsx b/src/pages/industryInfo.tsx index 48960d9..c387fb4 100644 --- a/src/pages/industryInfo.tsx +++ b/src/pages/industryInfo.tsx @@ -10,6 +10,7 @@ import { IndustryInfoView } from '../styles/layouts/industryInfo/IndustryInfoVie import Snackbar from '@mui/material/Snackbar'; import MuiAlert, { AlertProps } from '@mui/material/Alert'; +import { useRouter } from 'next/router' const Alert = React.forwardRef(function Alert( props, @@ -22,19 +23,23 @@ export default function industryInfo({userName}: any) { const [openSnackSuccess, setOpenSnackSuccess] = useState(false); const [openSnackError, setOpenSnackError] = useState(false); + const router = useRouter() + const handleCloseSnack = (event?: React.SyntheticEvent | Event, reason?: string) => { if (reason === 'clickaway') { return; } - setOpenSnackError(false); setOpenSnackSuccess(false); }; function handleDownloadPdf() { api.get('/download').then(res => { + router.replace(res.data.path); + console.log(res.data); setOpenSnackSuccess(true) }).catch(res => { + console.log(res) setOpenSnackError(true) }) } @@ -43,12 +48,12 @@ export default function industryInfo({userName}: any) { - Cliente cadastrada com Sucesso! + Pdf baixado Sucesso! - Cliente não cadastrado! + Pdf não baixado! diff --git a/src/pages/news.tsx b/src/pages/news.tsx index 76176c5..6393ab4 100644 --- a/src/pages/news.tsx +++ b/src/pages/news.tsx @@ -1,3 +1,4 @@ +import axios from 'axios'; import { GetServerSideProps } from 'next'; import Head from 'next/head'; import Link from 'next/link' @@ -7,9 +8,11 @@ import React from 'react' import Banner from '../components/banner/Banner' import BasicButton from '../components/buttons/basicButton/BasicButton'; import Header from '../components/header/Header' +import getAPIClient from '../services/ssrApi'; import { Button, NewsView } from '../styles/layouts/news/NewsView' -export default function aboutUs({userName}: any) { +export default function aboutUs({userName, news}: any) { + console.log(news) return ( @@ -46,7 +49,6 @@ export default function aboutUs({userName}: any) { console.log()}/> -
    { + const apiClient = getAPIClient(ctx) const { ['@smartAuth-token']: token } = parseCookies(ctx) const { ['user-name']: userName } = parseCookies(ctx) + let news; + + await axios.get('https://www.energiasmart.com.br/noticias/feed/').then(res => { + news = res.data + }).catch(res => { + console.log(res) + }) + if (!token) { return { redirect: { @@ -71,8 +82,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { return { props: { - userName + userName, + news } } } - diff --git a/src/pages/notifications.tsx b/src/pages/notifications.tsx index a218ac0..0871470 100644 --- a/src/pages/notifications.tsx +++ b/src/pages/notifications.tsx @@ -16,8 +16,7 @@ export default function Notifications({notificationData, userName}: any) { Smart Energia - Notificações
    - -

    Aqui estão as notificaões publicadas para voce!

    +
    { notificationData.map((value, index ) => { diff --git a/src/pages/resumoOperacao.tsx b/src/pages/resumoOperacao.tsx index 9aa7d9a..db35038 100644 --- a/src/pages/resumoOperacao.tsx +++ b/src/pages/resumoOperacao.tsx @@ -71,12 +71,23 @@ export default function ResumoOperacao({tableData, clientsData, userName, client useEffect(() => { if (unidade!=='' || month!==''){ - api.post('/operation/summary', { + api.post('/operation/summary', month && !unidade? { "filters": [ - {"type" : "=", "field": "mes", "value": `${month}/2022`}, - {"type" : "=", "field": "dados_te.cod_smart_unidade", "value": unidade} - ] - }).then(res => { + {"type" : "=", "field": "mes", "value": month} + ] + } : + !month && unidade? { + "filters": [ + {"type" : "=", "field": "dados_te.cod_smart_unidade", "value": unidade} + ] + } : + month && unidade? { + "filters": [ + {"type" : "=", "field": "mes", "value": month}, + {"type" : "=", "field": "dados_te.cod_smart_unidade", "value": unidade} + ] + } : {} + ).then(res => { setTableDataState(res.data.data) }).catch(res => { console.log(res) @@ -128,7 +139,7 @@ export default function ResumoOperacao({tableData, clientsData, userName, client Nenhum { clientMonth.map((value) => { - return {monthLabels[parseFloat(value.mes.slice(3, 4))-1]} + return {monthLabels[parseFloat(value.mes.slice(3, 4))-1]} }) } diff --git a/src/styles/Home.module.css b/src/styles/Home.module.css index 32a57d5..fbaf78e 100644 --- a/src/styles/Home.module.css +++ b/src/styles/Home.module.css @@ -1,3 +1,10 @@ +.someCSSModulesClass :global .any-global-class { + margin: 0; + padding: 0; + font-family: 'Poppins'; + background-color: #f9f9f9; +} + .container { padding: 0 2rem; } @@ -10,6 +17,7 @@ flex-direction: column; justify-content: center; align-items: center; + font-family: 'Poppins'; } .footer { diff --git a/src/styles/globals.ts b/src/styles/globals.ts index f70de8e..b70c240 100644 --- a/src/styles/globals.ts +++ b/src/styles/globals.ts @@ -1,6 +1,21 @@ import { createGlobalStyle } from 'styled-components' export const GlobalStyle = createGlobalStyle` + body::-webkit-scrollbar { + width: 15px; + } + body::-webkit-scrollbar-track { + background-color: #EFEFEF; + } + body::-webkit-scrollbar-thumb { + background-color: rgb(37,79,127); + border: 3px solid #EFEFEF; + border-radius: 10px; + } + body::-webkit-scrollbar-thumb:hover { + background-color: #1d3e63; + } + body { margin: 0; padding: 0; diff --git a/src/styles/layouts/ChatTelemetry/ChatTelemetryView.ts b/src/styles/layouts/ChatTelemetry/ChatTelemetryView.ts index bc04c88..15f757f 100644 --- a/src/styles/layouts/ChatTelemetry/ChatTelemetryView.ts +++ b/src/styles/layouts/ChatTelemetry/ChatTelemetryView.ts @@ -12,9 +12,9 @@ export const ChatTelemetryView = styled.main` padding-top: 0px!important; .chartContainer { - display: grid; + display: flex; - grid-template-columns: 50% 50%; + flex-direction: column; width: 100%; } diff --git a/src/styles/layouts/Telemetria/TelemetriaView.ts b/src/styles/layouts/Telemetria/TelemetriaView.ts index b7ddc00..fb3f214 100644 --- a/src/styles/layouts/Telemetria/TelemetriaView.ts +++ b/src/styles/layouts/Telemetria/TelemetriaView.ts @@ -36,17 +36,18 @@ export const TelemetriaView = styled.main` section { display: flex; + justify-content: center; align-items: center; + flex-wrap: wrap; + .select { display: flex; justify-content: center; align-items: flex-start; flex-direction: column; - - /* margin-top: 10px; */ } } `; @@ -54,16 +55,22 @@ export const TelemetriaView = styled.main` export const Buttons = styled.div` display: flex; justify-content: space-evenly; - flex-direction: row; - min-width: 14rem; - height: 6rem; + flex-wrap: wrap; + + max-width: 100%; margin-top: 5rem; padding-left: 100px; padding-right: 100px; + @media (max-width: 942px) { + align-items: center; + justify-content: center; + + flex-direction: column; + } `; export const Uploads = styled.div` diff --git a/src/styles/layouts/industryInfo/IndustryInfoView.ts b/src/styles/layouts/industryInfo/IndustryInfoView.ts index e3bedb9..811d516 100644 --- a/src/styles/layouts/industryInfo/IndustryInfoView.ts +++ b/src/styles/layouts/industryInfo/IndustryInfoView.ts @@ -9,19 +9,21 @@ export const IndustryInfoView = styled.main` .title { margin-bottom: 50px; } -button{ - height:60px; - width: 22%; - margin-top: 12rem; - cursor: pointer; - background: #254F7F; - border-radius: 8px; - border-style: none; - font-family: 'Poppins'; - font-size: 90%; + button{ + height: 70px; + width: 30%; + cursor: pointer; - color: #FFFFFF; -} + background: #254F7F; + + border-radius: 8px; + border-style: none; + + font-family: 'Poppins'; + font-size: 90%; + + color: #FFFFFF; + } `