feat: show mon-entreprise logo in every iframe integration

pull/2854/head
Johan Girod 2023-12-21 10:38:53 +01:00
parent cd7e826b14
commit da5e24772f
5 changed files with 41 additions and 22 deletions

View File

@ -27,6 +27,7 @@ import Budget from '@/pages/budget/index'
import IntegrationTest from '@/pages/dev/IntegrationTest'
import Documentation from '@/pages/Documentation'
import Iframes from '@/pages/iframes'
import IframeFooter from '@/pages/iframes/IframeFooter'
import Integration from '@/pages/integration/index'
import Nouveautés from '@/pages/nouveautés/index'
import { CatchOffline } from '@/pages/Offline'
@ -183,7 +184,7 @@ const App = () => {
</Container>
</main>
{!isEmbedded && <Footer />}
{isEmbedded ? <IframeFooter /> : <Footer />}
</StyledLayout>
)
}

View File

@ -65,7 +65,12 @@ function infereSimulateurRevenuFromSituation(
) {
return 'eurl'
}
if (engine.evaluate('entreprise . catégorie juridique . SAS').nodeValue) {
if (
engine.evaluate('entreprise . catégorie juridique . SAS').nodeValue ||
engine.evaluate('entreprise . catégorie juridique . SAS . SASU')
.nodeValue ||
engine.evaluate('entreprise . catégorie juridique . SAS . SAS').nodeValue
) {
return 'sasu'
}
if (engine.evaluate('entreprise . catégorie juridique . EI').nodeValue) {

View File

@ -5,6 +5,7 @@ import logoSvgFRDark from '@/assets/images/logo-monentreprise_white.svg'
import logoSvgFR from '@/assets/images/logo-monentreprise.svg'
import logoSvgENDark from '@/assets/images/logo-mycompany_white.svg'
import logoSvgEN from '@/assets/images/logo-mycompany.svg'
import { Link } from '@/design-system/typography/link'
import { useDarkMode } from '@/hooks/useDarkMode'
/* Figma source: https://www.figma.com/file/YJUpRNO12lcPUDsEYEXzT9/logo-monentreprisee-urssaf-edition */
@ -37,3 +38,25 @@ export function Logo() {
const StyledLogo = styled.img`
height: 100%;
`
export function LogoWithLink() {
const { t } = useTranslation()
return (
<LogoContainer
href={import.meta.env.VITE_FR_BASE_URL}
target="_blank"
rel="noreferrer"
aria-label={t('Accéder au site mon-entreprise, nouvelle fenêtre')}
>
<Logo />
</LogoContainer>
)
}
const LogoContainer = styled(Link)`
display: block;
height: 4rem;
padding: ${({ theme }) => theme.spacings.md} 0;
text-align: center;
`

View File

@ -1,16 +1,15 @@
import React from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
import { css, styled } from 'styled-components'
import { ForceThemeProvider } from '@/components/utils/DarkModeContext'
import { Grid } from '@/design-system/layout'
import { Link } from '@/design-system/typography/link'
import { SmallBody } from '@/design-system/typography/paragraphs'
import { useIsEmbedded } from '@/hooks/useIsEmbedded'
import { firstStepCompletedSelector } from '@/store/selectors/simulationSelectors'
import { Logo } from '../Logo'
import { LogoWithLink } from '../Logo'
import { WatchInitialRender } from '../utils/useInitialRender'
type SimulationGoalsProps = {
@ -98,8 +97,6 @@ export const SimulationGoalsContainer = styled.div<{
function TopSection({ toggles }: { toggles?: React.ReactNode }) {
const inIframe = useIsEmbedded()
const { t } = useTranslation()
return (
<Section container>
{inIframe && (
@ -111,14 +108,7 @@ function TopSection({ toggles }: { toggles?: React.ReactNode }) {
alignItems: 'flex-end',
}}
>
<LogoContainer
href={import.meta.env.VITE_FR_BASE_URL}
target="_blank"
rel="noreferrer"
aria-label={t("Accéder à la page d'accueil, nouvelle fenêtre")}
>
<Logo />
</LogoContainer>
<LogoWithLink />
</Grid>
)}
{toggles && (
@ -173,10 +163,3 @@ export const ToggleSection = styled.div`
}
}
`
const LogoContainer = styled(Link)`
display: block;
height: 4rem;
padding: ${({ theme }) => theme.spacings.md} 0;
text-align: center;
`

View File

@ -1,8 +1,12 @@
import FeedbackButton from '@/components/Feedback'
import Privacy from '@/components/layout/Footer/Privacy'
import { LogoWithLink } from '@/components/Logo'
import { Spacing } from '@/design-system/layout'
import { useCurrentSimulatorData } from '@/hooks/useCurrentSimulatorData'
export default function IframeFooter() {
const { currentSimulatorData } = useCurrentSimulatorData()
return (
<>
<div
@ -18,6 +22,9 @@ export default function IframeFooter() {
<Spacing md />
<Privacy noUnderline={false} />
<Spacing lg />
{!currentSimulatorData?.pathId.startsWith('simulateur') && (
<LogoWithLink />
)}
</div>
</>
)