From cb0bdcbdd8c702c4b62793a5802e6f0527f94447 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Fri, 30 Nov 2018 12:46:19 +0100 Subject: [PATCH] =?UTF-8?q?:engine:=20Ajoute=20les=20derni=C3=A8res=20bran?= =?UTF-8?q?ches=20manquante=20et=20leurs=20traductions.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajoute les liens vers les pages règles de branche depuis la distribution et le bulletin de paie --- source/components/Distribution.css | 4 +- source/components/Distribution.js | 62 ++------- source/components/PaySlip.js | 6 +- source/components/rule/Header.css | 2 +- source/components/rule/Header.js | 60 +++++---- source/components/rule/References.css | 14 +- source/components/rule/References.js | 39 +----- source/components/rule/Rule.js | 6 +- source/engine/rules.js | 58 +++++---- source/locales/en.yaml | 30 ----- source/règles/base.yaml | 156 ++++++++++++++--------- source/règles/externalized.yaml | 111 ++++++++++++++++ source/selectors/ficheDePaieSelectors.js | 37 +++--- source/selectors/regleSelectors.js | 5 + source/selectors/repartitionSelectors.js | 40 ++++-- source/types/RegleTypes.js | 4 +- source/types/ResultViewTypes.js | 21 ++- test/ficheDePaieSelector.test.js | 7 +- 18 files changed, 372 insertions(+), 290 deletions(-) diff --git a/source/components/Distribution.css b/source/components/Distribution.css index 7c1480a39..74c50f7e5 100644 --- a/source/components/Distribution.css +++ b/source/components/Distribution.css @@ -26,7 +26,7 @@ } .distribution-chart__counterparts { - width: 20em; + width: 25em; line-height: 1.2em; font-weight: 300; } @@ -56,6 +56,7 @@ justify-content: flex-start !important; position: initial !important; flex-direction: column !important; + padding-right: 0 !important; width: auto !important; height: initial !important; } @@ -98,7 +99,6 @@ .distribution-chart__branche-name { font-weight: 500; - text-transform: capitalize; } .distribution-chart__icon { font-size: 200%; diff --git a/source/components/Distribution.js b/source/components/Distribution.js index 89b07b37a..0a70d8d4f 100644 --- a/source/components/Distribution.js +++ b/source/components/Distribution.js @@ -14,47 +14,13 @@ import './Distribution.css' import Montant from './Montant' import './PaySlip' import RuleLink from './RuleLink' - -import type { Répartition, Branche } from 'Types/ResultViewTypes.js' - -const brancheToEmoji: { [Branche]: string } = { - retraite: '👵', - santé: '🏥', - famille: '👶', - formation: '👩‍🎓', - logement: '🏡', - 'accidents du travail / maladies professionnelles': '☣️', - 'assurance chômage': '💸', - transport: '🚌', - autres: '🔧' -} - -const brancheToCounterparts: { [Branche]: string } = { - retraite: "Garantit en moyenne 60 à 70 % de votre dernier revenu d'activité.", - santé: - "Couvre la plupart des soins de santé de la vie quotidienne et 100 % des maladies graves comme les séjours à l'hôpital.", - famille: - "Offre une vie professionnelle et familiale équilibrée. Finance des crèches et divers services de garde d'enfants.", - formation: "Donne aux employés l'accès à la formation professionnelle.", - logement: 'Aide à la construction de logements neufs et abordables.', - 'accidents du travail / maladies professionnelles': - 'Offre une couverture complète des maladies ou accidents du travail.', - 'assurance chômage': - "Assure un revenu aux travailleurs à la recherche d'un nouvel emploi.", - transport: "Permet de baisser le prix d'un ticket de transport en commun.", - autres: 'Autres contributions au système social.' -} - -const brancheToLabel: { [Branche]: string } = { - 'accidents du travail / maladies professionnelles': 'accidents', - 'assurance chômage': 'chômage' -} +import type { Répartition } from 'Types/ResultViewTypes.js' type Props = ?Répartition & { colours: { colour: string } } type State = { - branchesInViewport: Array + branchesInViewport: Array } const ANIMATION_SPRING = config.gentle @@ -93,15 +59,15 @@ class Distribution extends Component {
{répartition.map(([branche, { partPatronale, partSalariale }]) => { const brancheInViewport = - this.state.branchesInViewport.indexOf(branche) !== -1 + this.state.branchesInViewport.indexOf(branche.id) !== -1 const montant = brancheInViewport ? partPatronale + partSalariale : 0 return ( + onChange={this.handleBrancheInViewport(branche.id)}> { style={{ opacity: styles.opacity }}> - +

- - {brancheToLabel[branche] || branche} - - .{' '} + - - {brancheToCounterparts[branche]} - + {' : '} + {branche.descriptionCourte}

@@ -191,10 +153,8 @@ let ChartItemBar = ({ styles, colour, montant, total }) => (
) -let ChartItemLegend = ({ branche }) => ( +let BranchIcône = ({ icône }) => (
- - {emoji(brancheToEmoji[branche])} - + {emoji(icône)}
) diff --git a/source/components/PaySlip.js b/source/components/PaySlip.js index 61b983ef5..3a2563301 100644 --- a/source/components/PaySlip.js +++ b/source/components/PaySlip.js @@ -81,10 +81,10 @@ const PaySlip = ({

Part salariale

- {cotisations.map(([section, cotisationList]) => ( - + {cotisations.map(([branche, cotisationList]) => ( +
- {section} +
{cotisationList.map(cotisation => ( diff --git a/source/components/rule/Header.css b/source/components/rule/Header.css index 4ceef28dc..07aef1234 100644 --- a/source/components/rule/Header.css +++ b/source/components/rule/Header.css @@ -20,7 +20,6 @@ #ruleHeader__content { display: flex; - padding-top: 1rem; } @media (max-width: 500px) { #ruleHeader__content { @@ -31,6 +30,7 @@ } #ruleHeader__description { flex: 1; + padding-top: 1rem; } #ruleHeader__infobox { padding: 1rem; diff --git a/source/components/rule/Header.js b/source/components/rule/Header.js index e386f68af..34ba09666 100644 --- a/source/components/rule/Header.js +++ b/source/components/rule/Header.js @@ -1,3 +1,4 @@ +import PeriodSwitch from 'Components/PeriodSwitch' import withColours from 'Components/utils/withColours' import { createMarkdownDiv } from 'Engine/marked' import { path } from 'ramda' @@ -8,7 +9,6 @@ import { capitalise0 } from '../../utils' import Destinataire from './Destinataire' import './Header.css' import Namespace from './Namespace' -import PeriodSwitch from 'Components/PeriodSwitch' let RuleHeader = withColours( ({ @@ -40,35 +40,39 @@ let RuleHeader = withColours(
{createMarkdownDiv(description || question)}
-
- {type && ( -
-

Type :

- {capitalise0(type)} -
- )} - {do { - let period = flatRule['période'] - period && ( + {(type || flatRule['période']) && ( +
+ {type && (
-

Période :

- {valuesToShow && period === 'flexible' ? ( - - ) : ( -
- - {period} - -
- )} +

Type :

+ {capitalise0(type)}
- ) - }} - -
+ )} + {do { + let period = flatRule['période'] + period && ( +
+

Période :

+ {valuesToShow && period === 'flexible' ? ( + + ) : ( +
+ + {period} + +
+ )} +
+ ) + }} + +
+ )} ) diff --git a/source/components/rule/References.css b/source/components/rule/References.css index e07cd25d8..861291afb 100644 --- a/source/components/rule/References.css +++ b/source/components/rule/References.css @@ -30,16 +30,18 @@ font-size: 95%; } .references .imageWrapper { - width: 8em; - display: inline-block; + width: 6rem; + height: 3rem; + display: flex; + align-items: center; + justify-content: center; + margin-right: 1rem; } .references img { + max-height: 3rem; vertical-align: sub; - max-height: 3em; - max-width: 5em; + max-width: 100%; border-radius: 0.3em; - margin: 0 auto; - display: block; } li#complementary { diff --git a/source/components/rule/References.js b/source/components/rule/References.js index 01c28cc8c..65ab9d5e8 100644 --- a/source/components/rule/References.js +++ b/source/components/rule/References.js @@ -1,6 +1,6 @@ -import { groupBy, toPairs } from 'ramda' +import { toPairs } from 'ramda' import React from 'react' -import { Trans, withNamespaces } from 'react-i18next' +import { withNamespaces } from 'react-i18next' import references from 'Règles/ressources/références/références.yaml' import { capitalise0 } from '../../utils' import './References.css' @@ -12,39 +12,8 @@ export default withNamespaces()( } render() { let { refs } = this.props, - { complementary, official = [] } = groupBy(([, link]) => - this.findRefKey(link) ? 'official' : 'complementary' - )(toPairs(refs)), - showComplementary = this.state.showComplementary, - showComplementaryButton = !this.state.showComplementary && complementary - - return ( -