diff --git a/site/source/components/CompanyDetails.tsx b/site/source/components/CompanyDetails.tsx index 6e16cf89a..f4f7a6a0b 100644 --- a/site/source/components/CompanyDetails.tsx +++ b/site/source/components/CompanyDetails.tsx @@ -4,30 +4,20 @@ import { H3 } from 'DesignSystem/typography/heading' import { Body } from 'DesignSystem/typography/paragraphs' import { useMemo } from 'react' import { Trans, useTranslation } from 'react-i18next' +import { Company } from 'Reducers/inFranceAppReducer' import styled from 'styled-components' -type Company = { - activite_principale: string - denomination: string - prenom_usuel: string - nom: string - date_creation: string - etablissement_siege: { - libelle_commune: string - code_postal: string - } -} export default function CompanyDetails({ entreprise, }: { - entreprise: FabriqueSocialEntreprise + entreprise: FabriqueSocialEntreprise | Company }) { const { i18n } = useTranslation() const { siren, - highlightLabel, + label, dateCreationUniteLegale, firstMatchingEtablissement, allMatchingEtablissements, @@ -61,7 +51,7 @@ export default function CompanyDetails({ `} > <> - {highlightLabel ? highlightLabelToJSX(highlightLabel) : ''}{' '} + {'highlightLabel' in entreprise ? highlightLabelToJSX(entreprise.highlightLabel) : label}{' '} ({siren}) {' '} diff --git a/site/source/pages/Gerer/Home.tsx b/site/source/pages/Gerer/Home.tsx index 4ec1e7843..cac8a5751 100644 --- a/site/source/pages/Gerer/Home.tsx +++ b/site/source/pages/Gerer/Home.tsx @@ -329,7 +329,7 @@ export const CompanySection = ({ company, isPL }: CompanySectionProps) => { {company && ( <> - + Changer l'entreprise sélectionnée diff --git a/site/source/reducers/inFranceAppReducer.ts b/site/source/reducers/inFranceAppReducer.ts index fb6e2b73c..ce426f8e5 100644 --- a/site/source/reducers/inFranceAppReducer.ts +++ b/site/source/reducers/inFranceAppReducer.ts @@ -1,7 +1,7 @@ import { Action } from 'Actions/actions' import { FabriqueSocialEntreprise } from 'API/fabrique-social' import { ApiCommuneJson } from 'Components/conversation/select/SelectCommune' -import { omit } from 'ramda' +import { omit } from '../utils' import { combineReducers } from 'redux' import { LegalStatus } from 'Selectors/companyStatusSelectors' import { LegalStatusRequirements } from 'Types/companyTypes' @@ -125,7 +125,7 @@ const infereLegalStatusFromCategorieJuridique = ( return 'NON_IMPLÉMENTÉ' } -export type Company = FabriqueSocialEntreprise & { +export type Company = Omit & { statutJuridique?: StatutJuridique isAutoEntrepreneur?: boolean isDirigeantMajoritaire?: boolean @@ -147,8 +147,8 @@ function existingCompany( const statutJuridique = infereLegalStatusFromCategorieJuridique( action.entreprise.categorieJuridiqueUniteLegale ) - return { - ...action.entreprise, + return { + ...omit('highlightLabel', action.entreprise), statutJuridique, } } diff --git a/site/source/utils.ts b/site/source/utils.ts index 23e054c45..a46b7ad34 100644 --- a/site/source/utils.ts +++ b/site/source/utils.ts @@ -70,3 +70,9 @@ export function hash(str: string): number { } return hash } + +export function omit(key: K, obj: T): Omit{ + const returnObject = {...obj}; + delete returnObject[key] + return returnObject +}