From a81c73fb56ec720245894024e26e7ddff632f4ec Mon Sep 17 00:00:00 2001 From: sandcha <sandcha@users.noreply.github.com> Date: Tue, 26 Jul 2022 17:02:17 +0200 Subject: [PATCH] Deactivate PLF from reinit input values menu --- .../article-header/ArticleHeader.tsx | 13 ++++++++++++- redux/reducers/parameters/plf/ir.ts | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/components/common/simulation-page/article-header/ArticleHeader.tsx b/components/common/simulation-page/article-header/ArticleHeader.tsx index 08877573..99f55cd2 100644 --- a/components/common/simulation-page/article-header/ArticleHeader.tsx +++ b/components/common/simulation-page/article-header/ArticleHeader.tsx @@ -15,9 +15,20 @@ import styles from "./ArticleHeader.module.scss"; type Props = { topic: keyof ParametersState; + // "impot_revenu" | "dotations" + // Cf. redux/reducers/parameters/interfaces/index.ts } -const mapStateToProps = ({ parameters }: RootState) => ({ displayPLF: !!parameters.plf }); +// Met à jour les props d'après l'état de l'application IR ou dotations +const mapStateToProps = ({ parameters }: RootState, ownProps: Props) => ( + { displayPLF: ( + !!parameters.plf + && ( + JSON.stringify(parameters.plf[ownProps.topic]) !== JSON.stringify(parameters.base[ownProps.topic]) + ) + ) + } +); const mapDispatchToProps = (dispatch, ownProps: Props) => ({ resetAmendementToBase: () => dispatch(resetAmendementToBase(ownProps.topic)), diff --git a/redux/reducers/parameters/plf/ir.ts b/redux/reducers/parameters/plf/ir.ts index 86f8645e..e5dd4a09 100644 --- a/redux/reducers/parameters/plf/ir.ts +++ b/redux/reducers/parameters/plf/ir.ts @@ -2,7 +2,8 @@ import { IRState } from "../interfaces"; export const PLF_IR_DEFAULT_STATE: IRState = { - // PLF = 2022 + // PLF 2022 désactivé tant que égal à la loi en vigueur + // dans : redux/reducers/parameters/base/ir.ts bareme: { seuils: [10225, 26070, 74545, 160336], taux: [11, 30, 41, 45], -- GitLab