Enlève le surlignage hors du champs de recherche entreprise

pull/1928/head
Johan Girod 2022-01-11 10:06:18 +01:00
parent a2e65667d1
commit 660f88a69e
4 changed files with 15 additions and 19 deletions

View File

@ -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}{' '}
<small>({siren})</small>
</>{' '}
</H3>

View File

@ -329,7 +329,7 @@ export const CompanySection = ({ company, isPL }: CompanySectionProps) => {
{company && (
<>
<CompanyDetails siren={company.siren} />
<CompanyDetails entreprise={company} />
<Link to={sitePaths.index}>
<Trans i18nKey="gérer.entreprise.changer">
Changer l'entreprise sélectionnée

View File

@ -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<FabriqueSocialEntreprise, 'highlightLabel'> & {
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,
}
}

View File

@ -70,3 +70,9 @@ export function hash(str: string): number {
}
return hash
}
export function omit<T, K extends keyof T>(key: K, obj: T): Omit<T, K>{
const returnObject = {...obj};
delete returnObject[key]
return returnObject
}