restore-to-new-project.tsx59 lines · main
| 1 | import { useParams } from 'common' |
| 2 | import { PageContainer } from 'ui-patterns/PageContainer' |
| 3 | import { |
| 4 | PageHeader, |
| 5 | PageHeaderMeta, |
| 6 | PageHeaderNavigationTabs, |
| 7 | PageHeaderSummary, |
| 8 | PageHeaderTitle, |
| 9 | } from 'ui-patterns/PageHeader' |
| 10 | import { PageSection, PageSectionContent } from 'ui-patterns/PageSection' |
| 11 | |
| 12 | import DatabaseBackupsNav from '@/components/interfaces/Database/Backups/DatabaseBackupsNav' |
| 13 | import { RestoreToNewProject } from '@/components/interfaces/Database/RestoreToNewProject/RestoreToNewProject' |
| 14 | import DatabaseLayout from '@/components/layouts/DatabaseLayout/DatabaseLayout' |
| 15 | import DefaultLayout from '@/components/layouts/DefaultLayout' |
| 16 | import { UnknownInterface } from '@/components/ui/UnknownInterface' |
| 17 | import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' |
| 18 | import type { NextPageWithLayout } from '@/types' |
| 19 | |
| 20 | const RestoreToNewProjectPage: NextPageWithLayout = () => { |
| 21 | const { ref } = useParams() |
| 22 | const { databaseRestoreToNewProject } = useIsFeatureEnabled(['database:restore_to_new_project']) |
| 23 | |
| 24 | if (!databaseRestoreToNewProject) { |
| 25 | return <UnknownInterface urlBack={`/project/${ref}/database/backups/scheduled`} /> |
| 26 | } |
| 27 | |
| 28 | return ( |
| 29 | <> |
| 30 | <PageHeader> |
| 31 | <PageHeaderMeta> |
| 32 | <PageHeaderSummary> |
| 33 | <PageHeaderTitle>Database Backups</PageHeaderTitle> |
| 34 | </PageHeaderSummary> |
| 35 | </PageHeaderMeta> |
| 36 | <PageHeaderNavigationTabs> |
| 37 | <DatabaseBackupsNav active="rtnp" /> |
| 38 | </PageHeaderNavigationTabs> |
| 39 | </PageHeader> |
| 40 | <PageContainer> |
| 41 | <PageSection> |
| 42 | <PageSectionContent> |
| 43 | <div className="space-y-8"> |
| 44 | <RestoreToNewProject /> |
| 45 | </div> |
| 46 | </PageSectionContent> |
| 47 | </PageSection> |
| 48 | </PageContainer> |
| 49 | </> |
| 50 | ) |
| 51 | } |
| 52 | |
| 53 | RestoreToNewProjectPage.getLayout = (page) => ( |
| 54 | <DefaultLayout> |
| 55 | <DatabaseLayout title="Backups">{page}</DatabaseLayout> |
| 56 | </DefaultLayout> |
| 57 | ) |
| 58 | |
| 59 | export default RestoreToNewProjectPage |