diff --git a/src/frontend/apps/impress/src/components/Box.tsx b/src/frontend/apps/impress/src/components/Box.tsx index 0191d77f..1417c23e 100644 --- a/src/frontend/apps/impress/src/components/Box.tsx +++ b/src/frontend/apps/impress/src/components/Box.tsx @@ -26,6 +26,8 @@ export interface BoxProps { $justify?: CSSProperties['justifyContent']; $overflow?: CSSProperties['overflow']; $margin?: MarginPadding; + $maxHeight?: CSSProperties['maxHeight']; + $minHeight?: CSSProperties['minHeight']; $maxWidth?: CSSProperties['maxWidth']; $minWidth?: CSSProperties['minWidth']; $padding?: MarginPadding; @@ -53,6 +55,8 @@ export const Box = styled('div')` $hasTransition && `transition: all 0.3s ease-in-out;`} ${({ $justify }) => $justify && `justify-content: ${$justify};`} ${({ $margin }) => $margin && stylesMargin($margin)} + ${({ $maxHeight }) => $maxHeight && `max-height: ${$maxHeight};`} + ${({ $minHeight }) => $minHeight && `min-height: ${$minHeight};`} ${({ $maxWidth }) => $maxWidth && `max-width: ${$maxWidth};`} ${({ $minWidth }) => $minWidth && `min-width: ${$minWidth};`} ${({ $overflow }) => $overflow && `overflow: ${$overflow};`} diff --git a/src/frontend/apps/impress/src/core/auth/Auth.tsx b/src/frontend/apps/impress/src/core/auth/Auth.tsx index 865a815f..7cc312dc 100644 --- a/src/frontend/apps/impress/src/core/auth/Auth.tsx +++ b/src/frontend/apps/impress/src/core/auth/Auth.tsx @@ -1,18 +1,35 @@ import { Loader } from '@openfun/cunningham-react'; -import { PropsWithChildren, useEffect } from 'react'; +import { usePathname, useRouter } from 'next/navigation'; +import { PropsWithChildren, useEffect, useState } from 'react'; import { Box } from '@/components'; import { useAuthStore } from './useAuthStore'; - export const Auth = ({ children }: PropsWithChildren) => { const { authenticated, initAuth } = useAuthStore(); + const router = useRouter(); + const [isDomainComingSoon, setIsDomainComingSoon] = useState(false); + const domainComingSoon = 'docs.numerique.gouv.fr'; + const pathComingSoon = '/coming-soon/'; + const pathname = usePathname(); useEffect(() => { - initAuth(); - }, [initAuth]); + if (window.location.origin.includes(domainComingSoon)) { + router.push(pathComingSoon); + return; + } - if (!authenticated) { + initAuth(); + }, [initAuth, router]); + + useEffect(() => { + setIsDomainComingSoon( + window.location.origin.includes(domainComingSoon) && + pathname === pathComingSoon, + ); + }, [pathname]); + + if (!authenticated && !isDomainComingSoon) { return ( diff --git a/src/frontend/apps/impress/src/layouts/PageLayout.tsx b/src/frontend/apps/impress/src/layouts/PageLayout.tsx index 5a6340dc..16dcf81d 100644 --- a/src/frontend/apps/impress/src/layouts/PageLayout.tsx +++ b/src/frontend/apps/impress/src/layouts/PageLayout.tsx @@ -6,9 +6,9 @@ import { Header } from '@/features/header'; export function PageLayout({ children }: PropsWithChildren) { return ( - +
- + {children}