mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem Account, project and organisation deletion settings use different warning layouts and action placement. In the organisation panel, the button sits inside the admonition description, so it stays below the copy at wide widths. ## Solution ```text Delete account / project / organisation └─ Danger admonition ├─ Consequence and supporting copy └─ Action below the copy at narrow widths, beside it at wide widths ``` Standardise the affected settings section descriptions and preserve the Vercel Marketplace action for partner-managed organisations. The account confirmation flow is reviewed separately in #52350. Both PRs target `master`. | Before | After | | --- | --- | | <img width="1458" height="484" alt="CleanShot 2026-11-10 at 14 15 06@2x" src="https://github.com/user-attachments/assets/2e7e627d-5079-464c-b7ef-51b93ca62e9a" /> | <img width="1450" height="410" alt="CleanShot 2026-11-10 at 14 13 15@2x" src="https://github.com/user-attachments/assets/88cdcd4a-463c-47be-9c95-3eab172bed29" /> | | <img width="1462" height="430" alt="CleanShot 2026-11-10 at 14 14 51@2x" src="https://github.com/user-attachments/assets/84109e7e-2e42-4252-9f1b-9760ded1f2e7" /> | <img width="1452" height="392" alt="CleanShot 2026-11-10 at 14 13 37@2x" src="https://github.com/user-attachments/assets/d2238d64-5a32-456f-addc-6fd3ce1de1fe" /> | | <img width="1868" height="394" alt="CleanShot 2026-11-10 at 14 15 22@2x" src="https://github.com/user-attachments/assets/a2ab7a9d-2d79-46fc-b600-ace07e098e55" /> | <img width="1872" height="412" alt="CleanShot 2026-11-10 at 13 26 40@2x" src="https://github.com/user-attachments/assets/fad70041-d0ea-4da6-b429-2b2fc39d2103" /> | ## Review instructions 1. Open the deletion sections in **Account preferences**, a project's **Settings → General** and an organisation's **General settings**. 2. At narrow and wide widths, check that the buttons sit below and beside the copy respectively. 3. For a Vercel-managed organisation, check that the panel still directs users to Vercel Marketplace. 4. In project and branch general settings, check the updated punctuation in the affected section descriptions.
208 lines
7.7 KiB
TypeScript
208 lines
7.7 KiB
TypeScript
import { SupportCategories } from '@supabase/shared-types/out/constants'
|
|
import { useFlag, useParams } from 'common'
|
|
import { AlertCircleIcon } from 'lucide-react'
|
|
import { Card, CardContent } from 'ui'
|
|
import {
|
|
PageSection,
|
|
PageSectionContent,
|
|
PageSectionDescription,
|
|
PageSectionMeta,
|
|
PageSectionSummary,
|
|
PageSectionTitle,
|
|
} from 'ui-patterns/PageSection'
|
|
|
|
import { CustomDomainActivate } from './CustomDomainActivate'
|
|
import { CustomDomainDelete } from './CustomDomainDelete'
|
|
import { CustomDomainsConfigureHostname } from './CustomDomainsConfigureHostname'
|
|
import { CustomDomainsShimmerLoader } from './CustomDomainsShimmerLoader'
|
|
import { CustomDomainVerify } from './CustomDomainVerify'
|
|
import { SupportLink } from '@/components/interfaces/Support/SupportLink'
|
|
import { HighAvailabilityDisabledEmptyState } from '@/components/ui/HighAvailability/HighAvailabilityDisabledEmptyState'
|
|
import { InlineLinkClassName } from '@/components/ui/InlineLink'
|
|
import { UpgradeToPro } from '@/components/ui/UpgradeToPro'
|
|
import {
|
|
useCustomDomainsQuery,
|
|
type CustomDomainsData,
|
|
} from '@/data/custom-domains/custom-domains-query'
|
|
import { useProjectAddonsQuery } from '@/data/subscriptions/project-addons-query'
|
|
import { useHighAvailability } from '@/hooks/misc/useHighAvailability'
|
|
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
|
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
|
|
|
|
export const CustomDomainConfig = () => {
|
|
const { ref } = useParams()
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const { isHighAvailability, isPending: isHighAvailabilityPending } = useHighAvailability()
|
|
const { data: organization } = useSelectedOrganizationQuery()
|
|
const isBranch = Boolean(project?.parent_project_ref)
|
|
const entityLabel = isBranch ? 'branch' : 'project'
|
|
|
|
const customDomainsDisabledDueToQuota = useFlag('customDomainsDisabledDueToQuota')
|
|
|
|
const plan = organization?.plan?.id
|
|
const canLoadCustomDomains = !isHighAvailability && !isHighAvailabilityPending
|
|
|
|
const { data: addons, isPending: isLoadingAddons } = useProjectAddonsQuery(
|
|
{ projectRef: ref },
|
|
{ enabled: canLoadCustomDomains }
|
|
)
|
|
const hasCustomDomainAddon = !!addons?.selected_addons.find((x) => x.type === 'custom_domain')
|
|
|
|
const {
|
|
data: customDomainData,
|
|
isPending: isCustomDomainsLoading,
|
|
isError,
|
|
isSuccess,
|
|
status: customDomainStatus,
|
|
} = useCustomDomainsQuery(
|
|
{ projectRef: ref },
|
|
{
|
|
enabled: canLoadCustomDomains,
|
|
refetchInterval: (query) => {
|
|
const data = query.state.data
|
|
// while setting up the ssl certificate, we want to poll every 5 seconds
|
|
if (data?.customDomain?.ssl.status) {
|
|
return 10000 // 10 seconds
|
|
}
|
|
|
|
return false
|
|
},
|
|
}
|
|
)
|
|
|
|
const { status } = customDomainData || {}
|
|
|
|
if (isHighAvailability) {
|
|
return (
|
|
<PageSection id="custom-domains">
|
|
<PageSectionMeta>
|
|
<PageSectionSummary>
|
|
<PageSectionTitle>Custom domains</PageSectionTitle>
|
|
<PageSectionDescription>
|
|
Present a branded experience to your users.
|
|
</PageSectionDescription>
|
|
</PageSectionSummary>
|
|
</PageSectionMeta>
|
|
<PageSectionContent>
|
|
<HighAvailabilityDisabledEmptyState
|
|
title="Custom domains unavailable on High Availability projects"
|
|
description="We're working to bring custom domains to High Availability projects. Contact support if this is blocking your work."
|
|
className="max-w-none mx-0 py-6"
|
|
/>
|
|
</PageSectionContent>
|
|
</PageSection>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<PageSection id="custom-domains">
|
|
<PageSectionMeta>
|
|
<PageSectionSummary>
|
|
<PageSectionTitle>Custom domains</PageSectionTitle>
|
|
<PageSectionDescription>
|
|
Present a branded experience to your users.
|
|
</PageSectionDescription>
|
|
</PageSectionSummary>
|
|
</PageSectionMeta>
|
|
<PageSectionContent>
|
|
{isHighAvailabilityPending || isLoadingAddons ? (
|
|
<Card>
|
|
<CardContent className="space-y-6">
|
|
<CustomDomainsShimmerLoader />
|
|
</CardContent>
|
|
</Card>
|
|
) : !hasCustomDomainAddon ? (
|
|
<UpgradeToPro
|
|
primaryText={
|
|
customDomainsDisabledDueToQuota
|
|
? 'New custom domains are temporarily disabled'
|
|
: 'Custom domains are a Pro Plan add-on'
|
|
}
|
|
secondaryText={
|
|
customDomainsDisabledDueToQuota
|
|
? 'We are working with our upstream DNS provider before we are able to sign up new custom domains. Please check back in a few hours.'
|
|
: plan === 'free'
|
|
? 'Paid Plans come with free vanity subdomains or Custom Domains for an additional $10/month per domain.'
|
|
: `To configure a custom domain for your ${entityLabel}, please enable the add-on. Each Custom Domain costs $10 per month.`
|
|
}
|
|
addon="customDomain"
|
|
source="customDomain"
|
|
featureProposition="enable custom domains"
|
|
disabled={customDomainsDisabledDueToQuota}
|
|
/>
|
|
) : isCustomDomainsLoading ? (
|
|
<Card>
|
|
<CardContent className="space-y-6">
|
|
<CustomDomainsShimmerLoader />
|
|
</CardContent>
|
|
</Card>
|
|
) : isError ? (
|
|
<Card>
|
|
<CardContent className="space-y-6">
|
|
<div className="flex items-center justify-center space-x-2 py-8">
|
|
<AlertCircleIcon size={16} strokeWidth={1.5} />
|
|
<p className="text-sm text-foreground-light">
|
|
Failed to retrieve custom domain configuration. Please try again later or{' '}
|
|
<SupportLink
|
|
queryParams={{ projectRef: ref, category: SupportCategories.SALES_ENQUIRY }}
|
|
className={InlineLinkClassName}
|
|
>
|
|
contact support
|
|
</SupportLink>
|
|
.
|
|
</p>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
) : status === '0_no_hostname_configured' ? (
|
|
<CustomDomainsConfigureHostname />
|
|
) : (
|
|
<Card>
|
|
<CardContent className="p-0">
|
|
{isSuccess ? (
|
|
<div className="flex flex-col">
|
|
{(status === '1_not_started' ||
|
|
status === '2_initiated' ||
|
|
status === '3_challenge_verified') && <CustomDomainVerify />}
|
|
|
|
{customDomainData.status === '4_origin_setup_completed' && (
|
|
<CustomDomainActivate
|
|
projectRef={ref}
|
|
customDomain={customDomainData.customDomain}
|
|
/>
|
|
)}
|
|
|
|
{customDomainData.status === '5_services_reconfigured' && (
|
|
<CustomDomainDelete
|
|
projectRef={ref}
|
|
customDomain={customDomainData.customDomain}
|
|
/>
|
|
)}
|
|
</div>
|
|
) : (
|
|
<CustomDomainConfigFallthrough
|
|
fetchStatus={customDomainStatus}
|
|
data={customDomainData}
|
|
/>
|
|
)}
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
</PageSectionContent>
|
|
</PageSection>
|
|
)
|
|
}
|
|
|
|
interface CustomDomainConfigFallthroughProps {
|
|
fetchStatus: 'error' | 'success' | 'pending'
|
|
data: CustomDomainsData | undefined
|
|
}
|
|
|
|
function CustomDomainConfigFallthrough({ fetchStatus, data }: CustomDomainConfigFallthroughProps) {
|
|
console.error(`Failing to display UI for custom domains:
|
|
Fetch status: ${fetchStatus}
|
|
Custom domain status: ${data?.status}`)
|
|
|
|
return null
|
|
}
|