diff --git a/source/components/LangSwitcher.js b/source/components/LangSwitcher.js index ab6c9fea4..26f0a1b82 100644 --- a/source/components/LangSwitcher.js +++ b/source/components/LangSwitcher.js @@ -3,7 +3,6 @@ import React, { Component } from 'react' import emoji from 'react-easy-emoji' import { withTranslation } from 'react-i18next' import { connect } from 'react-redux' -import { withRouter } from 'react-router' const languageCodeToEmoji = { en: '🇬🇧', @@ -11,7 +10,6 @@ const languageCodeToEmoji = { } export default compose( - withRouter, withTranslation(), connect( null, diff --git a/source/components/QuickLinks.js b/source/components/QuickLinks.js index 4d080eb9b..91e6228be 100644 --- a/source/components/QuickLinks.js +++ b/source/components/QuickLinks.js @@ -4,7 +4,6 @@ import { T } from 'Components' import { compose, contains, filter, reject, toPairs } from 'ramda' import React from 'react' import { connect } from 'react-redux' -import { withRouter } from 'react-router' import { currentQuestionSelector, nextStepsSelector @@ -60,18 +59,15 @@ const QuickLinks = ({ ) } -export default (compose( - withRouter, - connect( - (state, props) => ({ - key: props.language, - currentQuestion: currentQuestionSelector(state), - nextSteps: nextStepsSelector(state), - quickLinks: state.simulation?.config.questions?.["à l'affiche"], - quickLinksToHide: state.conversationSteps.foldedSteps - }), - { - goToQuestion - } - ) +export default (connect( + (state, props) => ({ + key: props.language, + currentQuestion: currentQuestionSelector(state), + nextSteps: nextStepsSelector(state), + quickLinks: state.simulation?.config.questions?.["à l'affiche"], + quickLinksToHide: state.conversationSteps.foldedSteps + }), + { + goToQuestion + } )(QuickLinks): React$ComponentType) diff --git a/source/components/simulationConfigs/withSimulationConfig.js b/source/components/simulationConfigs/withSimulationConfig.js index 880df12b5..e769717fc 100644 --- a/source/components/simulationConfigs/withSimulationConfig.js +++ b/source/components/simulationConfigs/withSimulationConfig.js @@ -2,7 +2,6 @@ import { resetSimulation, setSimulationConfig } from 'Actions/actions' import { compose } from 'ramda' import React from 'react' import { connect } from 'react-redux' -import { withRouter } from 'react-router-dom' import { noUserInputSelector } from 'Selectors/analyseSelectors' export default config => SimulationComponent => @@ -16,8 +15,7 @@ export default config => SimulationComponent => setSimulationConfig, resetSimulation } - ), - withRouter + ) )(function DecoratedSimulation(props) { if (config !== props.config) { props.setSimulationConfig(config) diff --git a/source/sites/mon-entreprise.fr/layout/Header/Header.js b/source/sites/mon-entreprise.fr/layout/Header/Header.js index 3fd9ff988..fe0b61c5b 100644 --- a/source/sites/mon-entreprise.fr/layout/Header/Header.js +++ b/source/sites/mon-entreprise.fr/layout/Header/Header.js @@ -8,7 +8,6 @@ import estimateSvg from 'Images/estimate.svg' import hiringSvg from 'Images/hiring.svg' import { compose } from 'ramda' import { connect } from 'react-redux' -import { withRouter } from 'react-router' import { NavLink } from 'react-router-dom' import { régimeSelector } from 'Selectors/companyStatusSelectors' import './Header.css' @@ -65,7 +64,6 @@ const StepsHeader = ({ showHiring, tracker, sitePaths }: Props) => ( export default (compose( withTracker, - withRouter, connect( state => ({ showHiring: régimeSelector(state) !== 'auto-entrepreneur' }), {} diff --git a/source/sites/mon-entreprise.fr/layout/Navigation/Navigation.js b/source/sites/mon-entreprise.fr/layout/Navigation/Navigation.js index d96cd3e63..06f54bba8 100644 --- a/source/sites/mon-entreprise.fr/layout/Navigation/Navigation.js +++ b/source/sites/mon-entreprise.fr/layout/Navigation/Navigation.js @@ -7,7 +7,6 @@ import hiringSvg from 'Images/hiring.svg' import { compose } from 'ramda' import { useTranslation } from 'react-i18next' import { connect } from 'react-redux' -import { withRouter } from 'react-router' import { NavLink } from 'react-router-dom' import './Navigation.css' import NavOpener from './NavOpener' @@ -282,7 +281,6 @@ const StepsHeader = ({ sitePaths, companyStatusChoice }: Props) => { } export default (compose( - withRouter, withSitePaths, connect( state => ({ diff --git a/source/sites/mon-entreprise.fr/layout/Navigation/SideBar.js b/source/sites/mon-entreprise.fr/layout/Navigation/SideBar.js index 0e25f47b7..008456a7a 100644 --- a/source/sites/mon-entreprise.fr/layout/Navigation/SideBar.js +++ b/source/sites/mon-entreprise.fr/layout/Navigation/SideBar.js @@ -4,20 +4,18 @@ import classnames from 'classnames' import withTracker from 'Components/utils/withTracker' import { compose } from 'ramda' import React, { useCallback, useEffect, useRef, useState } from 'react' -import { withRouter } from 'react-router' +import { useLocation } from 'react-router' import backSvg from './back.svg' import mobileMenuSvg from './mobile-menu.svg' import './SideBar.css' import type Tracker from '../../../../Tracker' -import type { Location } from 'react-router-dom' type OwnProps = {| children: React$Node |} type Props = OwnProps & { - tracker: Tracker, - location: Location + tracker: Tracker } const bigScreen = window.matchMedia('(min-width: 1500px)') @@ -31,7 +29,8 @@ const isParent = (parentNode, children) => { return isParent(parentNode, children.parentNode) } -function SideBar({ location, tracker, children }: Props) { +function SideBar({ tracker, children }: Props) { + const location = useLocation() const [opened, setOpened] = useState(false) const [sticky, setSticky] = useState(bigScreen.matches) const [previousLocation, setPreviousLocation] = useState(location) @@ -89,7 +88,4 @@ function SideBar({ location, tracker, children }: Props) { ) } -export default (compose( - withTracker, - withRouter -)(SideBar): React$ComponentType) +export default (compose(withTracker)(SideBar): React$ComponentType) diff --git a/source/sites/mon-entreprise.fr/pages/Company/Find.js b/source/sites/mon-entreprise.fr/pages/Company/Find.js index 494c26aca..1afca0c2f 100644 --- a/source/sites/mon-entreprise.fr/pages/Company/Find.js +++ b/source/sites/mon-entreprise.fr/pages/Company/Find.js @@ -7,7 +7,6 @@ import { useState } from 'react' import { Helmet } from 'react-helmet' import { useTranslation } from 'react-i18next' import { connect } from 'react-redux' -import { withRouter } from 'react-router' import { Link } from 'react-router-dom' import ReactSelect from 'react-select' // $FlowFixMe @@ -163,7 +162,6 @@ function Search({ sitePaths, onCompanyDetailsConfirmation }) { export default (compose( withSitePaths, - withRouter, connect( null, {