From 7f7b526c5cbd1688b91f88e7d48e75d0ce41463e Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Thu, 22 Aug 2024 07:50:24 +0000 Subject: [PATCH] chore(deps): remove browser detect --- package.json | 1 - .../ElecHalfHourChart.spec.tsx.snap | 24 +++++++++---------- .../MaxConsumptionCard.spec.tsx.snap | 14 +++++------ src/components/Charts/Bar.tsx | 6 +---- src/components/Charts/UpcomingBar.tsx | 8 +------ .../Charts/__snapshots__/Bar.spec.tsx.snap | 4 ++-- src/locales/fr.json | 2 +- src/styles/components/_barchart.scss | 21 ---------------- yarn.lock | 5 ---- 9 files changed, 24 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index ddf9f112e..125e826d2 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "cozy-scripts": "8.3", "cozy-ui": "^86.0.0", "d3": "^7.9.0", - "detect-browser": "^5.1.1", "file-saver": "^2.0.5", "global": "^4.4.0", "handlebars": "^4.7.7", diff --git a/src/components/Analysis/ElecHalfHourMonthlyAnalysis/__snapshots__/ElecHalfHourChart.spec.tsx.snap b/src/components/Analysis/ElecHalfHourMonthlyAnalysis/__snapshots__/ElecHalfHourChart.spec.tsx.snap index f41564a34..493674eb3 100644 --- a/src/components/Analysis/ElecHalfHourMonthlyAnalysis/__snapshots__/ElecHalfHourChart.spec.tsx.snap +++ b/src/components/Analysis/ElecHalfHourMonthlyAnalysis/__snapshots__/ElecHalfHourChart.spec.tsx.snap @@ -112,7 +112,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY weekend bounce-3 delay--0" + class="bar-ELECTRICITY weekend bounce-1 delay--0" d=" M0,4 a4,4 0 0 1 4,-4 @@ -133,7 +133,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </title> <defs> <lineargradient - class="bar-ELECTRICITY weekend bounce-3 delay--0" + class="bar-ELECTRICITY weekend bounce-1 delay--0" id="gradient" x1="0" x2="0" @@ -151,7 +151,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY weekend bounce-3 delay--0" + class="bar-ELECTRICITY weekend bounce-1 delay--0" d=" M0,4 a4,4 0 0 1 4,-4 @@ -200,7 +200,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY weekend bounce-3 delay--1" + class="bar-ELECTRICITY weekend bounce-1 delay--1" d=" M0,4 a4,4 0 0 1 4,-4 @@ -221,7 +221,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </title> <defs> <lineargradient - class="bar-ELECTRICITY weekend bounce-3 delay--1" + class="bar-ELECTRICITY weekend bounce-1 delay--1" id="gradient" x1="0" x2="0" @@ -239,7 +239,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY weekend bounce-3 delay--1" + class="bar-ELECTRICITY weekend bounce-1 delay--1" d=" M0,4 a4,4 0 0 1 4,-4 @@ -288,7 +288,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY weekend bounce-3 delay--2" + class="bar-ELECTRICITY weekend bounce-1 delay--2" d=" M0,4 a4,4 0 0 1 4,-4 @@ -309,7 +309,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </title> <defs> <lineargradient - class="bar-ELECTRICITY weekend bounce-3 delay--2" + class="bar-ELECTRICITY weekend bounce-1 delay--2" id="gradient" x1="0" x2="0" @@ -327,7 +327,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY weekend bounce-3 delay--2" + class="bar-ELECTRICITY weekend bounce-1 delay--2" d=" M0,4 a4,4 0 0 1 4,-4 @@ -376,7 +376,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY weekend bounce-3 delay--3" + class="bar-ELECTRICITY weekend bounce-1 delay--3" d=" M0,4 a4,4 0 0 1 4,-4 @@ -397,7 +397,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </title> <defs> <lineargradient - class="bar-ELECTRICITY weekend bounce-3 delay--3" + class="bar-ELECTRICITY weekend bounce-1 delay--3" id="gradient" x1="0" x2="0" @@ -415,7 +415,7 @@ exports[`ElecHalfHourChart component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY weekend bounce-3 delay--3" + class="bar-ELECTRICITY weekend bounce-1 delay--3" d=" M0,4 a4,4 0 0 1 4,-4 diff --git a/src/components/Analysis/MaxConsumptionCard/__snapshots__/MaxConsumptionCard.spec.tsx.snap b/src/components/Analysis/MaxConsumptionCard/__snapshots__/MaxConsumptionCard.spec.tsx.snap index b2774e5cd..4692b5f9f 100644 --- a/src/components/Analysis/MaxConsumptionCard/__snapshots__/MaxConsumptionCard.spec.tsx.snap +++ b/src/components/Analysis/MaxConsumptionCard/__snapshots__/MaxConsumptionCard.spec.tsx.snap @@ -154,7 +154,7 @@ exports[`MaxConsumptionCard component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY disabled bounce-3 delay--0" + class="bar-ELECTRICITY disabled bounce-1 delay--0" d=" M0,4 a4,4 0 0 1 4,-4 @@ -175,7 +175,7 @@ exports[`MaxConsumptionCard component should be rendered correctly 1`] = ` </title> <defs> <lineargradient - class="bar-ELECTRICITY disabled bounce-3 delay--0" + class="bar-ELECTRICITY disabled bounce-1 delay--0" id="gradient" x1="0" x2="0" @@ -193,7 +193,7 @@ exports[`MaxConsumptionCard component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY disabled bounce-3 delay--0" + class="bar-ELECTRICITY disabled bounce-1 delay--0" d=" M0,4 a4,4 0 0 1 4,-4 @@ -242,7 +242,7 @@ exports[`MaxConsumptionCard component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY disabled bounce-3 delay--1" + class="bar-ELECTRICITY disabled bounce-1 delay--1" d=" M0,4 a4,4 0 0 1 4,-4 @@ -263,7 +263,7 @@ exports[`MaxConsumptionCard component should be rendered correctly 1`] = ` </title> <defs> <lineargradient - class="bar-ELECTRICITY disabled bounce-3 delay--1" + class="bar-ELECTRICITY disabled bounce-1 delay--1" id="gradient" x1="0" x2="0" @@ -281,7 +281,7 @@ exports[`MaxConsumptionCard component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY disabled bounce-3 delay--1" + class="bar-ELECTRICITY disabled bounce-1 delay--1" d=" M0,4 a4,4 0 0 1 4,-4 @@ -330,7 +330,7 @@ exports[`MaxConsumptionCard component should be rendered correctly 1`] = ` </lineargradient> </defs> <path - class="bar-ELECTRICITY bar-UPCOMING disabled bounce-3 delay--2" + class="bar-ELECTRICITY bar-UPCOMING disabled bounce-1 delay--2" d=" M0,4 a4,4 0 0 1 4,-4 diff --git a/src/components/Charts/Bar.tsx b/src/components/Charts/Bar.tsx index 927b47f45..def83ebcd 100644 --- a/src/components/Charts/Bar.tsx +++ b/src/components/Charts/Bar.tsx @@ -1,6 +1,5 @@ import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { ScaleBand, ScaleLinear } from 'd3-scale' -import { detect } from 'detect-browser' import { FluidType, TimeStep } from 'enums' import { DateTime } from 'luxon' import { Dataload } from 'models' @@ -60,7 +59,6 @@ const Bar = ({ const [clicked, setClicked] = useState(false) const [animationEnded, setAnimationEnded] = useState(false) const [compareAnimationEnded, setCompareAnimationEnded] = useState(false) - const browser = detect() const isMulti = fluidType === FluidType.MULTIFLUID const FLUIDNAME = getFluidName(fluidType).toUpperCase() @@ -135,8 +133,6 @@ const Bar = ({ const getBarClass = () => { const upcoming = dataload.value === -1 ? 'bar-UPCOMING' : '' - const edgeBrowser = browser && browser.name !== 'edge' - const bounce = edgeBrowser ? '1' : '3' const baseStyles = [ `bar-${FLUIDNAME}`, @@ -154,7 +150,7 @@ const Bar = ({ if (animationEnded) { return baseStyles } - return `${baseStyles} bounce-${bounce} delay--${index}` + return `${baseStyles} bounce-1 delay--${index}` } const getCompareBarClass = () => { diff --git a/src/components/Charts/UpcomingBar.tsx b/src/components/Charts/UpcomingBar.tsx index 7022e3766..bb56d86da 100644 --- a/src/components/Charts/UpcomingBar.tsx +++ b/src/components/Charts/UpcomingBar.tsx @@ -1,5 +1,4 @@ import { ScaleBand, ScaleLinear } from 'd3-scale' -import { detect } from 'detect-browser' import { DateTime } from 'luxon' import { Dataload } from 'models' import React, { useState } from 'react' @@ -22,16 +21,11 @@ const UpcomingBar = ({ average, }: BarProps) => { const [animationEnded, setAnimationEnded] = useState(false) - const browser = detect() const onAnimationEnd = () => { setAnimationEnded(true) } - let animationClass = '' - if (!animationEnded) { - animationClass = browser?.name !== 'edge' ? 'bounce-1' : 'bounce-3' - animationClass += ` delay--${index % 13}` - } + const animationClass = !animationEnded ? `bounce-1 delay--${index % 13}` : '' const barClass = `bar-UPCOMING ${animationClass}` const topRoundedRectDashedLine = ( diff --git a/src/components/Charts/__snapshots__/Bar.spec.tsx.snap b/src/components/Charts/__snapshots__/Bar.spec.tsx.snap index 25e4f95f7..db2b14af8 100644 --- a/src/components/Charts/__snapshots__/Bar.spec.tsx.snap +++ b/src/components/Charts/__snapshots__/Bar.spec.tsx.snap @@ -40,7 +40,7 @@ exports[`Bar component test should correctly render Bar with isDuel 1`] = ` </lineargradient> </defs> <path - class="bar-MULTIFLUID bounce-3 delay--4" + class="bar-MULTIFLUID bounce-1 delay--4" d=" M0,-12.295074999999997 a-12.295074999999997,-12.295074999999997 0 0 1 -12.295074999999997,12.295074999999997 @@ -61,7 +61,7 @@ exports[`Bar component test should correctly render Bar with isDuel 1`] = ` </title> <defs> <lineargradient - class="bar-MULTIFLUID bounce-3 delay--4" + class="bar-MULTIFLUID bounce-1 delay--4" id="gradient" x1="0" x2="0" diff --git a/src/locales/fr.json b/src/locales/fr.json index ea1093caf..a37abcc8d 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -922,7 +922,7 @@ "p6b": "Maintenance technique : ", "p6": "Délégation Développement économique, emploi & savoirs - Innovation numérique & systèmes d’information - Usages et services numériques - Développement des services numériques", "title1": "Crédits", - "part1": "Ce site est le résultat de développements spécifiques réalisés dans les langages Go, TypeScript, HTML et Sass. Les développements s’appuient sur plusieurs bibliothèques et frameworks libres : axios, cozy-bar, cozy-client, cozy-harvest-lib, cozy-scripts, cozy-ui, d3, detect-browser, global, lodash, luxon, moment, moment-timezone, node-sass, object-hash, react, react-dom, react-redux, react-router-dom, react-swipeable-views, redux-devtools-extension, sass-loader. Les tests de l’application s’appuient sur les bibliothèques et frameworks libres suivants: jest-junit, react-test-renderer, redux-mock-store. La pile technique intègre également les applications Cozy stack, Yarn, Docker, ACH. Les déploiements sont réalisés sur le registre hébergé chez Cozy. L’équipe de réalisation utilise au quotidien les applications GitLab, IceScrum, RocketChat, SonarQube.", + "part1": "Ce site est le résultat de développements spécifiques réalisés dans les langages Go, TypeScript, HTML et Sass. Les développements s’appuient sur plusieurs bibliothèques et frameworks libres : axios, cozy-bar, cozy-client, cozy-harvest-lib, cozy-scripts, cozy-ui, d3, global, lodash, luxon, node-sass, object-hash, react, react-dom, react-redux, react-router-dom, react-swipeable-views, redux-devtools-extension, sass-loader. Les tests de l’application s’appuient sur les bibliothèques et frameworks libres suivants: jest-junit, react-test-renderer, redux-mock-store. La pile technique intègre également les applications Cozy stack, Yarn, Docker, ACH. Les déploiements sont réalisés sur le registre hébergé chez Cozy. L’équipe de réalisation utilise au quotidien les applications GitLab, IceScrum, RocketChat, SonarQube.", "title2": "Traitement des données personnelles et droit d’accès, de modification et de suppression", "part2": "Conformément à la réglementation en vigueur en matière de protection des données personnelles, le service Ecolyo a fait l’objet d’une inscription au registre des traitements de la Métropole de Lyon. Ecolyo fait partie de l’écosystème de services orientés « self data » déployés par la Métropole de Lyon avec l’ambition d’offrir aux usagers métropolitains les outils et les services leur permettant d’exercer directement leur droit à la portabilité, dans un cadre apte à garantir aussi bien la transparence et le contrôle sur l’usage de leurs données personnelles que l’exploitation directe du contenu de ces données selon leurs libres choix. Le self data est en effet selon la Fondation Internet Nouvelle Génération (FING) « la production, l’exploitation et le partage de données personnelles par les individus, sous leur contrôle et à leurs propres fins ». Au sein de cet environnement self data, la gestion des données s’appuie sur l’organisation suivante des rôles et responsabilités associées : ", "part2-1": "Les partenaires du service GRDF et Eau Publique du Grand Lyon sont responsables exclusivement des seuls traitements de Données Personnelles relatifs à la collecte des données de consommation de gaz et d’eau de l’utilisateur et à leur transmission sur la plateforme de cloud personnel, après consentement de l’utilisateur.", diff --git a/src/styles/components/_barchart.scss b/src/styles/components/_barchart.scss index b0fbcdcf3..87ac7032d 100644 --- a/src/styles/components/_barchart.scss +++ b/src/styles/components/_barchart.scss @@ -230,27 +230,6 @@ } } -.bounce-3 { - animation-name: bounce-3; - animation-timing-function: cubic-bezier(1, 1, 0.42, 1); - animation-iteration-count: 1; - transform-origin: bottom center; -} -@keyframes bounce-3 { - 0% { - opacity: 0.6; - transform: scaleY(1); - } - 50% { - transform: scaleY(1.1); - opacity: 0.8; - } - 100% { - transform: scaleY(1); - opacity: 1; - } -} - /** Animation delay **/ .delay { animation-duration: 0.4s; diff --git a/yarn.lock b/yarn.lock index c537abab2..ce62c772a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7271,11 +7271,6 @@ destroy@1.2.0: resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== -detect-browser@^5.1.1: - version "5.3.0" - resolved "https://registry.yarnpkg.com/detect-browser/-/detect-browser-5.3.0.tgz#9705ef2bddf46072d0f7265a1fe300e36fe7ceca" - integrity sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w== - detect-indent@^6.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" -- GitLab