🔥(frontend) remove coming-soon

Remove the coming-soon page and the redirection to it.
This commit is contained in:
Anthony LC
2024-07-02 10:06:19 +02:00
committed by Anthony LC
parent b4e4ba3516
commit 43ba36af61
2 changed files with 3 additions and 56 deletions

View File

@@ -1,35 +1,17 @@
import { Loader } from '@openfun/cunningham-react';
import { usePathname, useRouter } from 'next/navigation';
import { PropsWithChildren, useEffect, useState } from 'react';
import { PropsWithChildren, useEffect } 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(() => {
if (window.location.origin.includes(domainComingSoon)) {
router.push(pathComingSoon);
return;
}
initAuth();
}, [initAuth, router]);
}, [initAuth]);
useEffect(() => {
setIsDomainComingSoon(
window.location.origin.includes(domainComingSoon) &&
pathname === pathComingSoon,
);
}, [pathname]);
if (!authenticated && !isDomainComingSoon) {
if (!authenticated) {
return (
<Box $height="100vh" $width="100vw" $align="center" $justify="center">
<Loader />

View File

@@ -1,35 +0,0 @@
import { ReactElement } from 'react';
import { useTranslation } from 'react-i18next';
import Icon404 from '@/assets/icons/icon-404.svg';
import { Box, Text } from '@/components';
import { NextPageWithLayout } from '@/types/next';
const Page: NextPageWithLayout = () => {
const { t } = useTranslation();
return (
<Box $margin="auto">
<Box $align="center" $gap="3rem">
<Icon404 aria-label="Image 404" role="img" />
<Box $direction="row" $align="flex-end" $gap="1rem">
<Text
as="h1"
$margin="auto"
$direction="row"
$align="center"
$gap="1rem"
>
{t('Coming soon ...')}
</Text>
</Box>
</Box>
</Box>
);
};
Page.getLayout = function getLayout(page: ReactElement) {
return <Box $minHeight="100vh">{page}</Box>;
};
export default Page;