index.tsx40 lines · main
| 1 | import { useParams } from 'common' |
| 2 | import { useRouter } from 'next/router' |
| 3 | import { useEffect } from 'react' |
| 4 | import { PageContainer } from 'ui-patterns/PageContainer' |
| 5 | import { PageSection, PageSectionContent } from 'ui-patterns/PageSection' |
| 6 | import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader' |
| 7 | |
| 8 | import { DefaultLayout } from '@/components/layouts/DefaultLayout' |
| 9 | import { ProjectIntegrationsLayoutDispatch } from '@/components/layouts/ProjectIntegrationsLayoutDispatch' |
| 10 | import type { NextPageWithLayout } from '@/types' |
| 11 | |
| 12 | const IntegrationPage: NextPageWithLayout = () => { |
| 13 | const router = useRouter() |
| 14 | const { ref, id } = useParams() |
| 15 | |
| 16 | useEffect(() => { |
| 17 | // Always redirect to the overview page since this route should not render content |
| 18 | if (router?.isReady) { |
| 19 | router.replace(`/project/${ref}/integrations/${id}/overview`) |
| 20 | } |
| 21 | }, [router, ref, id]) |
| 22 | |
| 23 | return ( |
| 24 | <PageContainer size="full"> |
| 25 | <PageSection> |
| 26 | <PageSectionContent> |
| 27 | <GenericSkeletonLoader /> |
| 28 | </PageSectionContent> |
| 29 | </PageSection> |
| 30 | </PageContainer> |
| 31 | ) |
| 32 | } |
| 33 | |
| 34 | IntegrationPage.getLayout = (page) => ( |
| 35 | <DefaultLayout> |
| 36 | <ProjectIntegrationsLayoutDispatch>{page}</ProjectIntegrationsLayoutDispatch> |
| 37 | </DefaultLayout> |
| 38 | ) |
| 39 | |
| 40 | export default IntegrationPage |