mirror of
https://github.com/betagouv/mon-entreprise
synced 2025-03-12 15:05:49 +00:00
refactor: déplace tous les hooks dans le dossier hooks
This commit is contained in:
parent
1503bfd78b
commit
a75618c90e
26 changed files with 22 additions and 23 deletions
|
@ -8,6 +8,7 @@ import { ForceThemeProvider } from '@/components/utils/DarkModeContext'
|
|||
import { Grid } from '@/design-system/layout'
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
import { SimpleRuleEvaluation } from '@/domaine/engine/SimpleRuleEvaluation'
|
||||
import { useInitialRender } from '@/hooks/useInitialRender'
|
||||
import { ajusteLaSituation } from '@/store/actions/actions'
|
||||
|
||||
import { ExplicableRule } from '../conversation/Explicable'
|
||||
|
@ -16,7 +17,6 @@ import LectureGuide from '../LectureGuide'
|
|||
import { Appear } from '../ui/animate'
|
||||
import AnimatedTargetValue from '../ui/AnimatedTargetValue'
|
||||
import { useEngine } from '../utils/EngineContext'
|
||||
import { useInitialRender } from '../utils/useInitialRender'
|
||||
|
||||
type SimulationGoalProps = {
|
||||
dottedName: DottedName
|
||||
|
|
|
@ -4,10 +4,10 @@ import { useTranslation } from 'react-i18next'
|
|||
import { animated, config, useSpring } from 'react-spring'
|
||||
import { styled, useTheme } from 'styled-components'
|
||||
|
||||
import useDisplayOnIntersecting from '@/components/utils/useDisplayOnIntersecting'
|
||||
import { Emoji } from '@/design-system/emoji'
|
||||
import { Spacing } from '@/design-system/layout'
|
||||
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
|
||||
import useDisplayOnIntersecting from '@/hooks/useDisplayOnIntersecting'
|
||||
|
||||
import { DisableAnimationContext } from './utils/DisableAnimationContext'
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { useEffect } from 'react'
|
||||
|
||||
import { useIsEmbedded } from '../hooks/useIsEmbedded'
|
||||
import { useIsEmbedded } from '@/hooks/useIsEmbedded'
|
||||
|
||||
export function IframeResizer() {
|
||||
const isEmbedded = useIsEmbedded()
|
||||
|
|
|
@ -4,11 +4,10 @@ import { styled } from 'styled-components'
|
|||
|
||||
import Banner from '@/components/Banner'
|
||||
import { Link } from '@/design-system/typography/link'
|
||||
import useYear from '@/hooks/useYear'
|
||||
import { enregistreLaRéponse } from '@/store/actions/actions'
|
||||
import { getCurrentYear, getYearsBetween } from '@/utils/dates'
|
||||
|
||||
import useYear from './utils/useYear'
|
||||
|
||||
const Bold = styled.span<{ $bold: boolean }>`
|
||||
${({ $bold }) => ($bold ? 'font-weight: bold;' : '')}
|
||||
`
|
||||
|
|
|
@ -4,7 +4,6 @@ import { useLocation } from 'react-router-dom'
|
|||
import { styled } from 'styled-components'
|
||||
|
||||
import Meta from '@/components/utils/Meta'
|
||||
import useSearchParamsSimulationSharing from '@/components/utils/useSearchParamsSimulationSharing'
|
||||
import { Chip } from '@/design-system'
|
||||
import { Emoji } from '@/design-system/emoji'
|
||||
import { H1 } from '@/design-system/typography/heading'
|
||||
|
@ -14,6 +13,7 @@ import {
|
|||
useCurrentSimulatorData,
|
||||
} from '@/hooks/useCurrentSimulatorData'
|
||||
import { useIsEmbedded } from '@/hooks/useIsEmbedded'
|
||||
import useSearchParamsSimulationSharing from '@/hooks/useSearchParamsSimulationSharing'
|
||||
import useSimulationConfig from '@/hooks/useSimulationConfig'
|
||||
import { Simulation } from '@/store/reducers/simulation.reducer'
|
||||
import { situationSelector } from '@/store/selectors/simulationSelectors'
|
||||
|
|
|
@ -10,6 +10,7 @@ import { Grid } from '@/design-system/layout'
|
|||
import { Strong } from '@/design-system/typography'
|
||||
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
|
||||
import { SimpleRuleEvaluation } from '@/domaine/engine/SimpleRuleEvaluation'
|
||||
import { useInitialRender } from '@/hooks/useInitialRender'
|
||||
import { ajusteLaSituation } from '@/store/actions/actions'
|
||||
import { targetUnitSelector } from '@/store/selectors/simulationSelectors'
|
||||
|
||||
|
@ -20,7 +21,6 @@ import RuleLink from '../RuleLink'
|
|||
import { Appear } from '../ui/animate'
|
||||
import AnimatedTargetValue from '../ui/AnimatedTargetValue'
|
||||
import { useEngine } from '../utils/EngineContext'
|
||||
import { useInitialRender } from '../utils/useInitialRender'
|
||||
|
||||
type SimulationGoalProps = {
|
||||
dottedName: DottedName
|
||||
|
|
|
@ -6,11 +6,11 @@ import { css, styled } from 'styled-components'
|
|||
import { ForceThemeProvider } from '@/components/utils/DarkModeContext'
|
||||
import { Grid } from '@/design-system/layout'
|
||||
import { SmallBody } from '@/design-system/typography/paragraphs'
|
||||
import { WatchInitialRender } from '@/hooks/useInitialRender'
|
||||
import { useIsEmbedded } from '@/hooks/useIsEmbedded'
|
||||
import { firstStepCompletedSelector } from '@/store/selectors/simulationSelectors'
|
||||
|
||||
import { LogoWithLink } from '../Logo'
|
||||
import { WatchInitialRender } from '../utils/useInitialRender'
|
||||
|
||||
type SimulationGoalsProps = {
|
||||
legend: string
|
||||
|
|
|
@ -8,6 +8,7 @@ import { styled } from 'styled-components'
|
|||
import { Grid } from '@/design-system/layout'
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
import { Contexte } from '@/domaine/Contexte'
|
||||
import { useInitialRender } from '@/hooks/useInitialRender'
|
||||
import { targetUnitSelector } from '@/store/selectors/simulationSelectors'
|
||||
|
||||
import LectureGuide from '../LectureGuide'
|
||||
|
@ -15,7 +16,6 @@ import RuleLink from '../RuleLink'
|
|||
import { Appear } from '../ui/animate'
|
||||
import AnimatedTargetValue from '../ui/AnimatedTargetValue'
|
||||
import { useEngine } from '../utils/EngineContext'
|
||||
import { useInitialRender } from '../utils/useInitialRender'
|
||||
|
||||
type SimulationValueProps = {
|
||||
dottedName: DottedName
|
||||
|
|
|
@ -7,7 +7,7 @@ import { animated, useSpring } from 'react-spring'
|
|||
import { styled } from 'styled-components'
|
||||
|
||||
import RuleLink from '@/components/RuleLink'
|
||||
import useDisplayOnIntersecting from '@/components/utils/useDisplayOnIntersecting'
|
||||
import useDisplayOnIntersecting from '@/hooks/useDisplayOnIntersecting'
|
||||
import { targetUnitSelector } from '@/store/selectors/simulationSelectors'
|
||||
|
||||
import { DisableAnimationContext } from './utils/DisableAnimationContext'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useEngine } from './EngineContext'
|
||||
import { useEngine } from '../components/utils/EngineContext'
|
||||
|
||||
export default function useDate() {
|
||||
const date = useEngine().evaluate('date')
|
|
@ -1,6 +1,6 @@
|
|||
import { useSelector } from 'react-redux'
|
||||
|
||||
import { useParamsFromSituation } from '@/components/utils/useSearchParamsSimulationSharing'
|
||||
import { useParamsFromSituation } from '@/hooks/useSearchParamsSimulationSharing'
|
||||
import {
|
||||
companySituationSelector,
|
||||
situationSelector,
|
||||
|
|
|
@ -2,10 +2,10 @@ import { Trans } from 'react-i18next'
|
|||
import { styled } from 'styled-components'
|
||||
|
||||
import { Condition } from '@/components/EngineValue/Condition'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import { Grid } from '@/design-system/layout'
|
||||
import { H2 } from '@/design-system/typography/heading'
|
||||
import { SmallBody } from '@/design-system/typography/paragraphs'
|
||||
import useYear from '@/hooks/useYear'
|
||||
|
||||
import { SimpleField, SubSection } from '../../components/Fields'
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ import RuleInput from '@/components/conversation/RuleInput'
|
|||
import { Condition } from '@/components/EngineValue/Condition'
|
||||
import { WhenAlreadyDefined } from '@/components/EngineValue/WhenAlreadyDefined'
|
||||
import { FromTop } from '@/components/ui/animate'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import { H2 } from '@/design-system/typography/heading'
|
||||
import { SmallBody } from '@/design-system/typography/paragraphs'
|
||||
import useYear from '@/hooks/useYear'
|
||||
import { enregistreLaRéponse } from '@/store/actions/actions'
|
||||
|
||||
import { SimpleField } from '../../components/Fields'
|
||||
|
|
|
@ -3,8 +3,8 @@ import { useSelector } from 'react-redux'
|
|||
|
||||
import SimulateurWarning from '@/components/SimulateurWarning'
|
||||
import Simulation from '@/components/Simulation'
|
||||
import { useParamsFromSituation } from '@/components/utils/useSearchParamsSimulationSharing'
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
import { useParamsFromSituation } from '@/hooks/useSearchParamsSimulationSharing'
|
||||
import useSimulatorsData from '@/hooks/useSimulatorsData'
|
||||
import { useSiteUrl } from '@/hooks/useSiteUrl'
|
||||
import { CessationActivitéGoals } from '@/pages/simulateurs/cessation-activité/Goals'
|
||||
|
|
|
@ -15,10 +15,10 @@ import {
|
|||
SimulationGoals,
|
||||
} from '@/components/Simulation'
|
||||
import { FromTop } from '@/components/ui/animate'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import { H2 } from '@/design-system/typography/heading'
|
||||
import { Link } from '@/design-system/typography/link'
|
||||
import { Body, Intro } from '@/design-system/typography/paragraphs'
|
||||
import useYear from '@/hooks/useYear'
|
||||
import {
|
||||
batchUpdateSituation,
|
||||
enregistreLaRéponse,
|
||||
|
|
|
@ -8,9 +8,9 @@ import { SelectSimulationYear } from '@/components/SelectSimulationYear'
|
|||
import SimulateurWarning from '@/components/SimulateurWarning'
|
||||
import Simulation from '@/components/Simulation'
|
||||
import IndépendantExplanation from '@/components/simulationExplanation/IndépendantExplanation'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
import { SimpleRuleEvaluation } from '@/domaine/engine/SimpleRuleEvaluation'
|
||||
import useYear from '@/hooks/useYear'
|
||||
import { IndépendantSimulationGoals } from '@/pages/simulateurs/indépendant/Goals'
|
||||
import { ajusteLaSituation } from '@/store/actions/actions'
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import { SelectSimulationYear } from '@/components/SelectSimulationYear'
|
|||
import SimulateurWarning from '@/components/SimulateurWarning'
|
||||
import Simulation from '@/components/Simulation'
|
||||
import IndépendantExplanation from '@/components/simulationExplanation/IndépendantExplanation'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import { DarkLi, Ul } from '@/design-system/typography/list'
|
||||
import useYear from '@/hooks/useYear'
|
||||
import { IndépendantSimulationGoals } from '@/pages/simulateurs/indépendant/Goals'
|
||||
|
||||
export const IndépendantPLSimulation = () => {
|
||||
|
|
|
@ -7,10 +7,10 @@ import RéductionBasique from '@/components/RéductionDeCotisations/RéductionBa
|
|||
import RéductionMoisParMois from '@/components/RéductionDeCotisations/RéductionMoisParMois'
|
||||
import { SimulationGoals } from '@/components/Simulation'
|
||||
import { useEngine } from '@/components/utils/EngineContext'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import { Message } from '@/design-system'
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
import { useBarèmeLodeom } from '@/hooks/useBarèmeLodeom'
|
||||
import useYear from '@/hooks/useYear'
|
||||
import { useZoneLodeom } from '@/hooks/useZoneLodeom'
|
||||
import {
|
||||
situationSelector,
|
||||
|
|
|
@ -3,8 +3,8 @@ import { formatValue } from 'publicodes'
|
|||
import { Trans } from 'react-i18next'
|
||||
|
||||
import { useEngine } from '@/components/utils/EngineContext'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import { useBarèmeLodeom } from '@/hooks/useBarèmeLodeom'
|
||||
import useYear from '@/hooks/useYear'
|
||||
import { useZoneLodeom } from '@/hooks/useZoneLodeom'
|
||||
|
||||
export default function WarningSalaireTrans() {
|
||||
|
|
|
@ -6,7 +6,7 @@ import RéductionBasique from '@/components/RéductionDeCotisations/RéductionBa
|
|||
import RéductionMoisParMois from '@/components/RéductionDeCotisations/RéductionMoisParMois'
|
||||
import { SimulationGoals } from '@/components/Simulation'
|
||||
import { useEngine } from '@/components/utils/EngineContext'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import useYear from '@/hooks/useYear'
|
||||
import {
|
||||
situationSelector,
|
||||
targetUnitSelector,
|
||||
|
|
|
@ -2,7 +2,7 @@ import { formatValue } from 'publicodes'
|
|||
import { Trans } from 'react-i18next'
|
||||
|
||||
import { useEngine } from '@/components/utils/EngineContext'
|
||||
import useYear from '@/components/utils/useYear'
|
||||
import useYear from '@/hooks/useYear'
|
||||
|
||||
export default function WarningSalaireTrans() {
|
||||
const year = useYear()
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
getRulesParamNames,
|
||||
getSearchParams,
|
||||
getSituationFromSearchParams,
|
||||
} from '../source/components/utils/useSearchParamsSimulationSharing'
|
||||
} from '../source/hooks/useSearchParamsSimulationSharing'
|
||||
|
||||
describe('identifiant court', () => {
|
||||
const questions = Object.entries(parsePublicodes(rules).parsedRules)
|
||||
|
|
Loading…
Add table
Reference in a new issue