From 875d9e45aba0fc58366b0ae85532ee236afe163d Mon Sep 17 00:00:00 2001 From: joseCorte-exe Date: Mon, 16 May 2022 08:26:09 -0300 Subject: [PATCH 1/4] :feature: add pld pages feature --- package.json | 6 + src/components/mapCard/MapCard.tsx | 40 +- src/components/mapCard/MapCardView.ts | 2 + src/components/sidebar/Sidebar.tsx | 22 +- src/pages/_document.tsx | 45 +- src/pages/pld/[region].tsx | 229 +++ .../ResumoOperacao/ResumoOperacaoView.ts | 146 +- .../{DashboardView.js => DashboardView.ts} | 8 +- src/styles/layouts/pld/PldView.ts | 184 +++ src/utils/renderIf.ts | 3 + yarn.lock | 1264 ++++++++++++++++- 11 files changed, 1805 insertions(+), 144 deletions(-) create mode 100644 src/pages/pld/[region].tsx rename src/styles/layouts/dashboard/{DashboardView.js => DashboardView.ts} (97%) create mode 100644 src/styles/layouts/pld/PldView.ts create mode 100644 src/utils/renderIf.ts diff --git a/package.json b/package.json index d57d55f..b87ac3b 100644 --- a/package.json +++ b/package.json @@ -17,20 +17,26 @@ ] }, "dependencies": { + "@date-io/date-fns": "^2.14.0", "@emotion/react": "^11.9.0", "@emotion/styled": "^11.8.1", "@material-ui/core": "^4.12.4", "@material-ui/icons": "^4.11.3", "@mui/material": "^5.6.4", + "@mui/x-data-grid": "^5.11.0", + "@mui/x-date-pickers": "^5.0.0-alpha.3", "@typescript-eslint/eslint-plugin": "^5.22.0", "@typescript-eslint/parser": "^5.22.0", "chart.js": "^3.7.1", "eslint-plugin-react": "^7.29.4", "eslit": "^6.0.0", "faker": "5.5.3", + "install": "^0.13.0", "next": "12.1.6", + "npm": "^8.10.0", "nprogress": "^0.2.0", "react": "18.1.0", + "react-calendar": "^3.7.0", "react-chartjs-2": "^4.1.0", "react-dom": "18.1.0", "react-icons": "^4.3.1", diff --git a/src/components/mapCard/MapCard.tsx b/src/components/mapCard/MapCard.tsx index 1c5fb45..743612b 100644 --- a/src/components/mapCard/MapCard.tsx +++ b/src/components/mapCard/MapCard.tsx @@ -1,6 +1,7 @@ import React from 'react' import Image from 'next/image' import { MapCardView } from './MapCardView' +import Link from 'next/link' interface MapCardInterface { title: string, @@ -10,25 +11,28 @@ interface MapCardInterface { } export default function MapCard({ title, subtitle, statistic, imgSource }: MapCardInterface) { + const route = title==='R$/MWh'? '/consumption': `pld/${title.slice(0,2).toLocaleLowerCase()}-${title.slice(3,5).toLocaleLowerCase()}` return ( - - -
-

{title}

- {subtitle} -
- { - statistic? - <> - -

{statistic}

- - : - null - } -
-
-
+ + + +
+

{title}

+ {subtitle} +
+ { + statistic? + <> + +

{statistic}

+ + : + null + } +
+
+
+ ) } diff --git a/src/components/mapCard/MapCardView.ts b/src/components/mapCard/MapCardView.ts index 36e3f69..22aea15 100644 --- a/src/components/mapCard/MapCardView.ts +++ b/src/components/mapCard/MapCardView.ts @@ -9,6 +9,8 @@ export const MapCardView = styled.figure` margin-right: 25px; + cursor: pointer; + * { margin: 0; padding: 0; diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx index a867c68..9070f5e 100644 --- a/src/components/sidebar/Sidebar.tsx +++ b/src/components/sidebar/Sidebar.tsx @@ -26,21 +26,21 @@ export default function Sidebar() {