DeleteProjectPanel.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { Alert, AlertDescription, AlertTitle, CriticalIcon } from 'ui'
  2. import {
  3. PageSection,
  4. PageSectionContent,
  5. PageSectionDescription,
  6. PageSectionMeta,
  7. PageSectionSummary,
  8. PageSectionTitle,
  9. } from 'ui-patterns/PageSection'
  10. import { DeleteProjectButton } from './DeleteProjectButton'
  11. import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
  12. import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
  13. export const DeleteProjectPanel = () => {
  14. const { data: project } = useSelectedProjectQuery()
  15. const { data: selectedOrganization } = useSelectedOrganizationQuery()
  16. if (project === undefined) return null
  17. const title =
  18. selectedOrganization?.managed_by === 'vercel-marketplace'
  19. ? 'Deleting this project will also remove your database and uninstall the resource on Vercel.'
  20. : 'Deleting this project will also remove your database.'
  21. const description =
  22. selectedOrganization?.managed_by === 'vercel-marketplace'
  23. ? 'Make sure you have made a backup if you want to keep your data, and that no Vercel project is connected to this resource.'
  24. : 'Make sure you have made a backup if you want to keep your data.'
  25. return (
  26. <PageSection id="delete-project">
  27. <PageSectionMeta>
  28. <PageSectionSummary>
  29. <PageSectionTitle>Delete project</PageSectionTitle>
  30. <PageSectionDescription>
  31. Permanently remove your project and its database
  32. </PageSectionDescription>
  33. </PageSectionSummary>
  34. </PageSectionMeta>
  35. <PageSectionContent>
  36. <Alert variant="destructive">
  37. <CriticalIcon />
  38. <AlertTitle>{title}</AlertTitle>
  39. <AlertDescription>{description}</AlertDescription>
  40. <div className="mt-2">
  41. <DeleteProjectButton />
  42. </div>
  43. </Alert>
  44. </PageSectionContent>
  45. </PageSection>
  46. )
  47. }