Files
supabase/apps/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectPanel.tsx
Joshen Lim cab0585533 Fe 1799/consolidate to useselectedprojectquery and (#37684)
* Replace all usage of useProjectContext with useSelectedProjectQuery

* Replace all usage of useSelectedProject with useSelectedProjectQuery

* Replace all usage of useProjectByRef with useProjectByRefQuery

* Replace all usage of useSelectedOrganization with useSelectedOrganizationQuery

* Deprecate useSelectedProject, useSelectedOrganization, and useProjectByRef hooks

* Deprecate ProjecContext
2025-08-06 10:53:10 +07:00

37 lines
1.5 KiB
TypeScript

import { FormHeader } from 'components/ui/Forms/FormHeader'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, CriticalIcon } from 'ui'
import DeleteProjectButton from './DeleteProjectButton'
export const DeleteProjectPanel = () => {
const { data: project } = useSelectedProjectQuery()
const { data: selectedOrganization } = useSelectedOrganizationQuery()
if (project === undefined) return null
const title =
selectedOrganization?.managed_by === 'vercel-marketplace'
? 'Deleting this project will also remove your database and uninstall the resource on Vercel.'
: 'Deleting this project will also remove your database.'
const description =
selectedOrganization?.managed_by === 'vercel-marketplace'
? 'Make sure you have made a backup if you want to keep your data, and that no Vercel project is connected to this resource.'
: 'Make sure you have made a backup if you want to keep your data.'
return (
<section id="delete-project">
<FormHeader title="Delete Project" description="" />
<Alert_Shadcn_ variant="destructive">
<CriticalIcon />
<AlertTitle_Shadcn_ className="mt-2">{title}</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>{description}</AlertDescription_Shadcn_>
<div className="mt-2">
<DeleteProjectButton />
</div>
</Alert_Shadcn_>
</section>
)
}