ConfirmRestoreDialog.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import {
  2. Button,
  3. Dialog,
  4. DialogContent,
  5. DialogDescription,
  6. DialogFooter,
  7. DialogHeader,
  8. DialogSection,
  9. DialogTitle,
  10. } from 'ui'
  11. import { AdditionalMonthlySpend } from './AdditionalMonthlySpend'
  12. import { NewProjectPrice } from './RestoreToNewProject.utils'
  13. import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
  14. import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
  15. interface ConfirmRestoreDialogProps {
  16. open: boolean
  17. onOpenChange: (value: boolean) => void
  18. onSelectContinue: () => void
  19. additionalMonthlySpend: NewProjectPrice
  20. }
  21. export const ConfirmRestoreDialog = ({
  22. open,
  23. onOpenChange,
  24. onSelectContinue,
  25. additionalMonthlySpend,
  26. }: ConfirmRestoreDialogProps) => {
  27. const { data: project } = useSelectedProjectQuery()
  28. const { data: organization } = useSelectedOrganizationQuery()
  29. return (
  30. <Dialog open={open} onOpenChange={onOpenChange}>
  31. <DialogContent>
  32. <DialogHeader className="border-b">
  33. <DialogTitle>Confirm restore to a new project</DialogTitle>
  34. <DialogDescription>
  35. This process will create a new project and restore your database to it.
  36. </DialogDescription>
  37. </DialogHeader>
  38. <DialogSection className="prose pb-6 space-y-4 text-sm">
  39. <ul className="space-y-2">
  40. <li>
  41. Project organization will stay the same: <code>{organization?.name}</code>
  42. </li>
  43. <li>
  44. Project region will stay the same: <code>{project?.region || ''}</code>
  45. </li>
  46. </ul>
  47. <ul>
  48. <li>What will be transferred?</li>
  49. <ul className="ml-4">
  50. <li>Database schema (tables, views, procedures)</li>
  51. <li>All data and indexes</li>
  52. <li>Database roles, permissions and users</li>
  53. </ul>
  54. </ul>
  55. <ul>
  56. <li>What needs manual reconfiguration?</li>
  57. <ul className="ml-4">
  58. <li>Storage objects & settings</li>
  59. <li>Edge Functions</li>
  60. <li>Auth settings & API keys</li>
  61. <li>Database extensions and settings</li>
  62. <li>Read replicas</li>
  63. </ul>
  64. </ul>
  65. </DialogSection>
  66. <AdditionalMonthlySpend additionalMonthlySpend={additionalMonthlySpend} />
  67. <DialogFooter>
  68. <Button type="outline" onClick={() => onOpenChange(false)}>
  69. Cancel
  70. </Button>
  71. <Button onClick={() => onSelectContinue()}>Continue</Button>
  72. </DialogFooter>
  73. </DialogContent>
  74. </Dialog>
  75. )
  76. }