From 1bd150e4eb1470def69d26b8b2533a80b2e5973e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Corte?= Date: Thu, 12 May 2022 18:36:02 +0000 Subject: [PATCH] Release/0.1.0 --- .babelrc | 14 +- babel.config.js | 2 +- package.json | 9 + src/components/banner/Banner.tsx | 1 - .../buttons/basicButton/BasicButtonView.ts | 1 - .../buttons/loginButton/LoginButtonView.ts | 1 - .../graph/graphCard/ChartCardView.ts | 1 - src/components/header/Header.tsx | 2 - src/components/mapCard/MapCard.tsx | 2 +- .../mapCard/{style.ts => MapCardView.ts} | 0 src/components/sidebar/SidebarView.ts | 2 - {pages => src/pages}/_app.tsx | 2 +- {pages => src/pages}/_document.tsx | 36 +- {pages => src/pages}/aboutUs.tsx | 4 +- {pages => src/pages}/accumulatedSavings.tsx | 6 +- {pages => src/pages}/api/hello.js | 1 - {pages => src/pages}/areaTest.tsx | 9 +- {pages => src/pages}/consumption.tsx | 6 +- {pages => src/pages}/costIndicator.tsx | 6 +- {pages => src/pages}/dashboard.tsx | 8 +- {pages => src/pages}/estimatedCost.tsx | 6 +- {pages => src/pages}/faq.tsx | 4 +- {pages => src/pages}/grossSavings.tsx | 6 +- {pages => src/pages}/index.tsx | 2 +- {pages => src/pages}/news.tsx | 6 +- {pages => src/pages}/resumoOperacao.tsx | 8 +- {pages => src/pages}/telemetria.tsx | 6 +- {styles => src/styles}/Home.module.css | 0 {styles => src/styles}/app/AppView.ts | 0 {styles => src/styles}/globals.ts | 11 - .../ResumoOperacao/ResumoOperacaoView.ts | 42 - .../layouts/Telemetria/TelemetriaView.ts | 49 ++ .../styles}/layouts/aboutUs/AboutUsView.ts | 0 .../layouts/commonQuestions/FaqView.ts | 0 .../layouts/consumption/ConsumptionView.ts | 0 .../styles/layouts/dashboard/DashboardView.js | 1 - .../AccumulatedSavingsView.ts | 0 .../costIndicator/CostIndicatorView.ts | 0 .../estimatedCost/EstimatedCostView.ts | 0 .../economy/grossSavings/GrossSavings.ts | 0 .../styles/layouts/login}/LoginView.ts | 2 - .../styles}/layouts/news/NewsView.ts | 0 .../styles}/nprogress/nprogress.css | 3 - styles/layouts/Telemetria/TelemetriaView.ts | 154 ---- tsconfig.json | 4 +- yarn.lock | 744 +++++++++++++++++- 46 files changed, 844 insertions(+), 317 deletions(-) rename src/components/mapCard/{style.ts => MapCardView.ts} (100%) rename {pages => src/pages}/_app.tsx (96%) rename {pages => src/pages}/_document.tsx (67%) rename {pages => src/pages}/aboutUs.tsx (96%) rename {pages => src/pages}/accumulatedSavings.tsx (74%) rename {pages => src/pages}/api/hello.js (54%) rename {pages => src/pages}/areaTest.tsx (86%) rename {pages => src/pages}/consumption.tsx (69%) rename {pages => src/pages}/costIndicator.tsx (71%) rename {pages => src/pages}/dashboard.tsx (83%) rename {pages => src/pages}/estimatedCost.tsx (71%) rename {pages => src/pages}/faq.tsx (81%) rename {pages => src/pages}/grossSavings.tsx (72%) rename {pages => src/pages}/index.tsx (97%) rename {pages => src/pages}/news.tsx (91%) rename {pages => src/pages}/resumoOperacao.tsx (92%) rename {pages => src/pages}/telemetria.tsx (94%) rename {styles => src/styles}/Home.module.css (100%) rename {styles => src/styles}/app/AppView.ts (100%) rename {styles => src/styles}/globals.ts (56%) rename {styles => src/styles}/layouts/ResumoOperacao/ResumoOperacaoView.ts (71%) create mode 100644 src/styles/layouts/Telemetria/TelemetriaView.ts rename {styles => src/styles}/layouts/aboutUs/AboutUsView.ts (100%) rename {styles => src/styles}/layouts/commonQuestions/FaqView.ts (100%) rename {styles => src/styles}/layouts/consumption/ConsumptionView.ts (100%) rename styles/layouts/Dashboard/DashboardView.ts => src/styles/layouts/dashboard/DashboardView.js (97%) rename {styles => src/styles}/layouts/economy/accumulatedSavings/AccumulatedSavingsView.ts (100%) rename {styles => src/styles}/layouts/economy/costIndicator/CostIndicatorView.ts (100%) rename {styles => src/styles}/layouts/economy/estimatedCost/EstimatedCostView.ts (100%) rename {styles => src/styles}/layouts/economy/grossSavings/GrossSavings.ts (100%) rename {styles/layouts/Login => src/styles/layouts/login}/LoginView.ts (98%) rename {styles => src/styles}/layouts/news/NewsView.ts (100%) rename {styles => src/styles}/nprogress/nprogress.css (93%) delete mode 100644 styles/layouts/Telemetria/TelemetriaView.ts diff --git a/.babelrc b/.babelrc index 4722ed5..ce3e539 100644 --- a/.babelrc +++ b/.babelrc @@ -1,15 +1,3 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - [ - "styled-components", - { - "ssr": true, - "displayName": true, - "preprocess": false - } - ] - ] + "plugins": [["styled-components", {"ssr": true}]] } diff --git a/babel.config.js b/babel.config.js index e0b108e..8be3d2f 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,4 +1,4 @@ module.exports = { "presets": ["next/babel"], "plugins": [["styled-components", {"ssr": true}]] -} \ No newline at end of file +} diff --git a/package.json b/package.json index 18374c0..d57d55f 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "styled-components": "^5.3.5" }, "devDependencies": { + "@babel/preset-env": "^7.17.10", "@types/chartjs": "^0.0.31", "@types/faker": "5.5.3", "@types/node": "^17.0.31", @@ -66,5 +67,13 @@ "eslint", "prettier --write" ] + }, + "optimization": { + "scripts": true, + "styles": { + "minify": false, + "inlineCritical": false + }, + "fonts": true } } diff --git a/src/components/banner/Banner.tsx b/src/components/banner/Banner.tsx index f97b093..0fef8e4 100644 --- a/src/components/banner/Banner.tsx +++ b/src/components/banner/Banner.tsx @@ -12,7 +12,6 @@ interface BannerInterface { export default function Banner({ title, subtitle, imgSource }: BannerInterface) { return ( - {/* */}
diff --git a/src/components/buttons/basicButton/BasicButtonView.ts b/src/components/buttons/basicButton/BasicButtonView.ts index dba8475..26f514a 100644 --- a/src/components/buttons/basicButton/BasicButtonView.ts +++ b/src/components/buttons/basicButton/BasicButtonView.ts @@ -15,7 +15,6 @@ export const BasicButtonView = styled.button` font-family: 'Poppins'; font-size: 90%; - /* identical to box height */ color: #FFFFFF; diff --git a/src/components/buttons/loginButton/LoginButtonView.ts b/src/components/buttons/loginButton/LoginButtonView.ts index 35e9fb7..73b8132 100644 --- a/src/components/buttons/loginButton/LoginButtonView.ts +++ b/src/components/buttons/loginButton/LoginButtonView.ts @@ -20,5 +20,4 @@ export const LoginButtonView = styled.button` cursor: pointer; color: #FFFFFF; - ` diff --git a/src/components/graph/graphCard/ChartCardView.ts b/src/components/graph/graphCard/ChartCardView.ts index d325e49..8649d1d 100644 --- a/src/components/graph/graphCard/ChartCardView.ts +++ b/src/components/graph/graphCard/ChartCardView.ts @@ -8,7 +8,6 @@ export const ChartCardView = styled.article` flex-direction: column; width: 100%; - /* max-width: ; */ height: fit-content; min-height: 34.5rem; diff --git a/src/components/header/Header.tsx b/src/components/header/Header.tsx index 4bc5ffb..ad1ab95 100644 --- a/src/components/header/Header.tsx +++ b/src/components/header/Header.tsx @@ -10,7 +10,6 @@ function stringToColor(string: string) { let hash = 0; let i; - /* eslint-disable no-bitwise */ for (i = 0; i < string.length; i += 1) { hash = string.charCodeAt(i) + ((hash << 5) - hash); } @@ -21,7 +20,6 @@ function stringToColor(string: string) { const value = (hash >> (i * 8)) & 0xff; color += `00${value.toString(16)}`.slice(-2); } - /* eslint-enable no-bitwise */ return color; } diff --git a/src/components/mapCard/MapCard.tsx b/src/components/mapCard/MapCard.tsx index a70a738..1c5fb45 100644 --- a/src/components/mapCard/MapCard.tsx +++ b/src/components/mapCard/MapCard.tsx @@ -1,6 +1,6 @@ import React from 'react' import Image from 'next/image' -import { MapCardView } from './style' +import { MapCardView } from './MapCardView' interface MapCardInterface { title: string, diff --git a/src/components/mapCard/style.ts b/src/components/mapCard/MapCardView.ts similarity index 100% rename from src/components/mapCard/style.ts rename to src/components/mapCard/MapCardView.ts diff --git a/src/components/sidebar/SidebarView.ts b/src/components/sidebar/SidebarView.ts index d2d2df8..b3aa4c3 100644 --- a/src/components/sidebar/SidebarView.ts +++ b/src/components/sidebar/SidebarView.ts @@ -126,8 +126,6 @@ export const SidebarView = styled.nav` align-items: flex-start; width: 100%; - /* height: 0%; */ - /* height: ${props => props.modalOpen? '100%' : null}; */ padding: 18px; diff --git a/pages/_app.tsx b/src/pages/_app.tsx similarity index 96% rename from pages/_app.tsx rename to src/pages/_app.tsx index d322577..9061251 100644 --- a/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -4,7 +4,7 @@ import { AppProps } from 'next/app' import NProgress from 'nprogress' -import Sidebar from '../src/components/sidebar/Sidebar' +import Sidebar from '../components/sidebar/Sidebar' import { GlobalStyle } from '../styles/globals' import { AppView } from '../styles/app/AppView' import '../styles/nprogress/nprogress.css' diff --git a/pages/_document.tsx b/src/pages/_document.tsx similarity index 67% rename from pages/_document.tsx rename to src/pages/_document.tsx index 05a36b0..26f9fab 100644 --- a/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -5,21 +5,31 @@ import { ServerStyleSheet } from 'styled-components'; import Document, { Html, Head, Main, NextScript } from 'next/document' export default class MyDocument extends Document { - // static getInitialProps({ renderPage }) { - // // Step 1: Create an instance of ServerStyleSheet - // const sheet = new ServerStyleSheet(); + static async GetInitialProps(ctx) { + const sheet = new ServerStyleSheet(); + const originalRenderPage = ctx.renderPage; - // // Step 2: Retrieve styles from components in the page - // const page = renderPage((App) => (props) => - // sheet.collectStyles(), - // ); + try { + ctx.renderPage = () => + originalRenderPage({ + enhanceApp: App => props => sheet.collectStyles() + }); - // // Step 3: Extract the styles as