Skip to content

Commit

Permalink
feat: add env var pour avenir pro
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurlbrjc committed Dec 5, 2024
1 parent bffdef2 commit daac7cc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 21 deletions.
55 changes: 35 additions & 20 deletions app/(connexion)/login/passemploi/LoginPassEmploiPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ import FailureAlert from 'components/ui/Notifications/FailureAlert'
import { signin } from 'utils/auth/auth'
import { useLoginErrorMessage } from 'utils/auth/loginErrorMessageContext'

function LoginPage() {
type LoginPassEmploiPageProps = {
ssoAvenirProEstActif?: boolean
}

function LoginPassEmploiPage({
ssoAvenirProEstActif,
}: LoginPassEmploiPageProps) {
const [errorMsg, setErrorMsg] = useLoginErrorMessage()
const searchParams = useSearchParams()

Expand Down Expand Up @@ -85,7 +91,9 @@ function LoginPage() {
<h2 className='text-l-bold text-primary_darken text-center my-6 mx-4'>
Connexion conseiller AIJ
</h2>
<ul className='px-6 pt-6 flex flex-col gap-4 layout_s:border-r-2 layout_s:border-grey_100'>
<ul
className={`px-6 pt-6 flex flex-col gap-4 ${ssoAvenirProEstActif ? 'layout_s:border-r-2 layout_s:border-grey_100' : ''}`}
>
<li>
<LoginButton
altText='France Travail AIJ'
Expand All @@ -100,28 +108,35 @@ function LoginPage() {
</li>
</ul>

<h2 className='text-l-bold text-primary_darken text-center my-6 mx-4'>
Connexion conseiller Avenir Pro
</h2>
<ul className='px-6 pt-6 flex flex-col gap-4'>
<li>
<LoginButton
altText='France Travail Avenir Pro'
label='France Travail'
className='whitespace-nowrap'
style={ButtonStyle.SECONDARY}
illustrationName={IllustrationName.LogoFT}
handleSubmit={(event) =>
handleSignin(event, 'avenirpro-conseiller')
}
/>
</li>
</ul>
{ssoAvenirProEstActif && (
<>
<h2 className='text-l-bold text-primary_darken text-center my-6 mx-4'>
Connexion conseiller Avenir Pro
</h2>
<ul className='px-6 pt-6 flex flex-col gap-4'>
<li>
<LoginButton
altText='France Travail Avenir Pro'
label='France Travail'
className='whitespace-nowrap'
style={ButtonStyle.SECONDARY}
illustrationName={IllustrationName.LogoFT}
handleSubmit={(event) =>
handleSignin(event, 'avenirpro-conseiller')
}
/>
</li>
</ul>
</>
)}
</main>
</div>
</div>
</div>
)
}

export default withTransaction(LoginPage.name, 'page')(LoginPage)
export default withTransaction(
LoginPassEmploiPage.name,
'page'
)(LoginPassEmploiPage)
8 changes: 7 additions & 1 deletion app/(connexion)/login/passemploi/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@ export default async function LoginPassEmploi({
}) {
await redirectIfAlreadyConnected(searchParams)

return <LoginPassEmploiPage />
return (
<LoginPassEmploiPage
ssoAvenirProEstActif={
process.env.NEXT_PUBLIC_ENABLE_AVENIR_PRO_SSO === 'true'
}
/>
)
}

0 comments on commit daac7cc

Please sign in to comment.