Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update UI for custom domains

Joshen Lim8768bb4783c8
diff --git a/studio/components/interfaces/Database/Backups/BackupsList.tsx b/studio/components/interfaces/Database/Backups/BackupsList.tsx
index 8366811d0f6..8ade283247e 100644
--- a/studio/components/interfaces/Database/Backups/BackupsList.tsx
+++ b/studio/components/interfaces/Database/Backups/BackupsList.tsx
@@ -11,7 +11,7 @@ import BackupsError from './BackupsError'
import BackupsEmpty from './BackupsEmpty'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import InformationBox from 'components/ui/InformationBox'
-import { IconAlertCircle } from 'ui'
+import { IconAlertCircle, IconClock } from 'ui'
interface Props {}
@@ -32,6 +32,7 @@ const BackupsList: FC<Props> = ({}) => {
if (tierKey === 'FREE') {
return (
<UpgradeToPro
+ icon={<IconClock size="large" />}
primaryText="Free Plan does not include project backups."
projectRef={projectRef}
secondaryText="Please upgrade to Pro plan for up to 7 days of backups."
diff --git a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainActivate.tsx b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainActivate.tsx
index 9ac592e5020..fb282d0e9ed 100644
--- a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainActivate.tsx
+++ b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainActivate.tsx
@@ -43,15 +43,15 @@ const CustomDomainActivate = ({ projectRef, customDomain }: CustomDomainActivate
return (
<>
<div className="flex flex-col items-start gap-6">
- <div className="flex flex-col gap-1">
+ <div className="flex flex-col gap-2">
<h4 className="text-scale-1200">
- Setup complete! Press activate to enable {customDomain.hostname} for this project.
+ Setup complete! Press activate to enable the custom domain{' '}
+ <code className="text-sm">{customDomain.hostname}</code> for this project.
</h4>
-
<span className="text-sm text-scale-1100">
- Supabase recommends that your schedule a downtime window of 20-30 minutes for your
- application, as you will need to update any client code (e.g., frontends, mobile apps),
- and any OAuth providers (e.g., google, github) that use the current supabase subdomain.
+ We recommend that you schedule a downtime window of 20 - 30 minutes for your
+ application, as you will need to update any services that need to know about your custom
+ domain (e.g client side code or OAuth providers)
</span>
</div>
@@ -80,9 +80,16 @@ const CustomDomainActivate = ({ projectRef, customDomain }: CustomDomainActivate
</div>
<ConfirmModal
+ size="small"
visible={isActivateConfirmModalVisible}
- title={`Are you sure you want to activate ${customDomain.hostname}?`}
- description="Your existing supabase subdomain will be deactivated."
+ // @ts-ignore
+ title={
+ <div>
+ Are you sure you want to activate the custom domain{' '}
+ <code className="text-sm">{customDomain.hostname}</code> for the project?
+ </div>
+ }
+ description="The existing Supabase subdomain will be deactivated."
buttonLabel="Activate"
buttonLoadingLabel="Activating"
onSelectCancel={() => setIsActivateConfirmModalVisible(false)}
diff --git a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainConfig.tsx b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainConfig.tsx
index ca8cf701205..e14c6e52903 100644
--- a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainConfig.tsx
+++ b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainConfig.tsx
@@ -1,10 +1,13 @@
+import { observer } from 'mobx-react-lite'
+import Link from 'next/link'
+import { useState } from 'react'
+import { Button, IconAlertCircle, IconExternalLink } from 'ui'
+
+import { useParams } from 'hooks'
import Panel from 'components/ui/Panel'
+import UpgradeToPro from 'components/ui/UpgradeToPro'
import { useProjectSettingsQuery } from 'data/config/project-settings-query'
import { useCustomDomainsQuery } from 'data/custom-domains/custom-domains-query'
-import { useParams } from 'hooks'
-import { observer } from 'mobx-react-lite'
-import Link from 'next/link'
-import { IconAlertCircle, IconExternalLink } from 'ui'
import CustomDomainActivate from './CustomDomainActivate'
import CustomDomainDelete from './CustomDomainDelete'
import CustomDomainsConfigureHostname from './CustomDomainsConfigureHostname'
@@ -13,6 +16,7 @@ import CustomDomainVerify from './CustomDomainVerify'
const CustomDomainConfig = () => {
const { ref } = useParams()
+ const [isSuccessfullyAdded, setIsSuccessfullyAdded] = useState(false)
const { isLoading: isSettingsLoading, data: settings } = useProjectSettingsQuery({
projectRef: ref,
@@ -52,6 +56,7 @@ const CustomDomainConfig = () => {
projectRef={ref}
title={CUSTOM_DOMAINS_TITLE}
settings={settings}
+ onSuccessfullyAdded={() => setIsSuccessfullyAdded(true)}
/>
)
}
@@ -63,16 +68,12 @@ const CustomDomainConfig = () => {
{isLoading && <CustomDomainsShimmerLoader />}
{isNotAllowedError && (
- <div className="flex items-center justify-center space-x-2 py-8">
- <IconAlertCircle size={16} strokeWidth={1.5} />
- <p className="text-sm text-scale-1100">
- Custom domain is not enabled for this project. Please{' '}
- <Link href={`/support/new?ref=${ref}&category=sales`}>
- <a className="underline">contact support</a>
- </Link>{' '}
- if you would like to enable this feature.
- </p>
- </div>
+ <UpgradeToPro
+ icon={<IconAlertCircle size={18} strokeWidth={1.5} />}
+ primaryText="Custom domains are a Pro plan add-on"
+ projectRef={ref as string}
+ secondaryText="To configure a custom domain for your project, please upgrade to a Pro plan"
+ />
)}
{isUnknownError && (
@@ -89,12 +90,13 @@ const CustomDomainConfig = () => {
)}
{isSuccess && (
- <div className="flex flex-col gap-6">
+ <div className="flex flex-col gap-4">
{(data.status === '2_initiated' || data.status === '3_challenge_verified') && (
<CustomDomainVerify
projectRef={ref}
customDomain={data.customDomain}
settings={settings}
+ isSuccessfullyAdded={isSuccessfullyAdded}
/>
)}
@@ -119,14 +121,12 @@ const CUSTOM_DOMAINS_TITLE = (
<div className="flex-1 flex items-center justify-between">
<h5 className="mb-0">Custom Domain</h5>
- <a
- href="https://supabase.com/docs/guides/platform/custom-domains"
- target="_blank"
- rel="noreferrer noopener"
- className="flex items-center gap-1 text-sm text-scale-1000 hover:text-scale-1100"
- >
- <span>Docs</span>
- <IconExternalLink className="inline w-4 h-4" />
- </a>
+ <Link href="https://supabase.com/docs/guides/platform/custom-domains">
+ <a target="_blank">
+ <Button type="default" icon={<IconExternalLink />}>
+ Documentation
+ </Button>
+ </a>
+ </Link>
</div>
)
diff --git a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainDelete.tsx b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainDelete.tsx
index 27624328719..917a48e9a58 100644
--- a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainDelete.tsx
+++ b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainDelete.tsx
@@ -43,24 +43,40 @@ const CustomDomainDelete = ({ projectRef, customDomain }: CustomDomainDeleteProp
return (
<>
<div className="flex items-center justify-between">
- <div>
- <code className="text-sm bg-green-400">{customDomain.hostname}</code> is activate and
- serving traffic.
+ <div className="w-full space-y-2">
+ <p className="text-xs text-scale-1100">Active custom domain:</p>
+ <div className="flex items-center space-x-2">
+ <code className="text-lg mx-0 flex items-center space-x-2">
+ <div className="h-2 w-2 rounded-full bg-brand-900" />
+ <span>{customDomain.hostname}</span>
+ </code>
+ </div>
+ <p className="text-sm !mt-4">
+ Your custom domain is currently active and is serving traffic
+ </p>
</div>
- <Button
- type="danger"
- icon={<IconTrash />}
- onClick={() => setIsDeleteConfirmModalVisible(true)}
- >
- Delete Custom Domain
- </Button>
+ <div>
+ <Button
+ type="danger"
+ icon={<IconTrash />}
+ onClick={() => setIsDeleteConfirmModalVisible(true)}
+ >
+ Delete Custom Domain
+ </Button>
+ </div>
</div>
<ConfirmModal
danger
visible={isDeleteConfirmModalVisible}
- title={`Are you sure you want to delete ${customDomain.hostname}?`}
+ // @ts-ignore
+ title={
+ <div>
+ Are you sure you want to delete the custom domain{' '}
+ <code className="text-sm">{customDomain.hostname}</code> for the project?
+ </div>
+ }
description="Your custom domain will be deactivated. You will need to re-verify your domain if you want to use it again."
buttonLabel="Delete"
buttonLoadingLabel="Deleting"
diff --git a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainVerify.tsx b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainVerify.tsx
index 87d2b437167..52b621efdc0 100644
--- a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainVerify.tsx
+++ b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainVerify.tsx
@@ -1,19 +1,38 @@
import { ProjectSettingsResponse } from 'data/config/project-settings-query'
import { CustomDomainResponse } from 'data/custom-domains/custom-domains-query'
import { useCustomDomainReverifyMutation } from 'data/custom-domains/custom-domains-reverify-mutation'
+import { useStore } from 'hooks'
import { observer } from 'mobx-react-lite'
-import { Button, IconAlertCircle, IconRefreshCw } from 'ui'
+import { Alert, Button, IconAlertCircle, IconRefreshCw } from 'ui'
import DNSRecord from './DNSRecord'
export type CustomDomainVerifyProps = {
projectRef?: string
customDomain: CustomDomainResponse
settings?: ProjectSettingsResponse
+ isSuccessfullyAdded: boolean
}
-const CustomDomainVerify = ({ projectRef, customDomain, settings }: CustomDomainVerifyProps) => {
+const CustomDomainVerify = ({
+ projectRef,
+ customDomain,
+ settings,
+ isSuccessfullyAdded,
+}: CustomDomainVerifyProps) => {
+ const { ui } = useStore()
+
const { mutate: reverifyCustomDomain, isLoading: isReverifyLoading } =
- useCustomDomainReverifyMutation()
+ useCustomDomainReverifyMutation({
+ onSuccess: (res) => {
+ if (res.status === '2_initiated') {
+ // [Joshen TODO] - Is this what it means? Do we also need to cover for 3_challenge_verified?
+ ui.setNotification({
+ category: 'info',
+ message: 'Unable to verify records from DNS provider yet',
+ })
+ }
+ },
+ })
const onReverifyCustomDomain = () => {
if (!projectRef) {
@@ -25,6 +44,11 @@ const CustomDomainVerify = ({ projectRef, customDomain, settings }: CustomDomain
return (
<>
+ {isSuccessfullyAdded && (
+ <Alert withIcon variant="success" title="Your custom domain has been successfully added">
+ Please verify the domain by adding the listed records below to your domain's DNS settings.
+ </Alert>
+ )}
<div>
<h4 className="text-scale-1200">Set the following record(s) in your DNS provider:</h4>
<span className="text-sm text-scale-1100">
@@ -36,6 +60,7 @@ const CustomDomainVerify = ({ projectRef, customDomain, settings }: CustomDomain
'custom hostname does not CNAME to this zone.'
) && (
<DNSRecord
+ showLabel
type="CNAME"
name={customDomain.hostname}
value={settings?.autoApiService.app_config.endpoint ?? 'Loading...'}
diff --git a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainsConfigureHostname.tsx b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainsConfigureHostname.tsx
index 0858608dc7b..24643af856e 100644
--- a/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainsConfigureHostname.tsx
+++ b/studio/components/interfaces/Settings/API/CustomDomainConfig/CustomDomainsConfigureHostname.tsx
@@ -5,30 +5,33 @@ import {
FormSectionContent,
FormSectionLabel,
} from 'components/ui/Forms'
+import InformationBox from 'components/ui/InformationBox'
import { ProjectSettingsResponse } from 'data/config/project-settings-query'
import { useCustomDomainCreateMutation } from 'data/custom-domains/custom-domains-create-mutation'
import { useStore } from 'hooks'
import { observer } from 'mobx-react-lite'
import { ReactNode } from 'react'
-import { Alert, Form, Input } from 'ui'
+import { Form, IconAlertCircle, Input } from 'ui'
import * as yup from 'yup'
const FORM_ID = 'custom-domains-form'
const schema = yup.object({
- domain: yup.string().required('Custom domain is required'),
+ domain: yup.string().required('A value for your custom domain is required'),
})
export type CustomDomainsConfigureHostnameProps = {
projectRef?: string
title: ReactNode
settings?: ProjectSettingsResponse
+ onSuccessfullyAdded: () => void
}
const CustomDomainsConfigureHostname = ({
projectRef,
title,
settings,
+ onSuccessfullyAdded,
}: CustomDomainsConfigureHostnameProps) => {
const { ui } = useStore()
@@ -44,12 +47,7 @@ const CustomDomainsConfigureHostname = ({
projectRef,
customDomain: values.domain,
})
-
- ui.setNotification({
- category: 'success',
- message: `Successfully created custom domain. Please verify the domain by adding the listed records to your domain's DNS settings.`,
- duration: 10000,
- })
+ onSuccessfullyAdded()
} catch (error: any) {
ui.setNotification({
category: 'error',
@@ -100,17 +98,22 @@ const CustomDomainsConfigureHostname = ({
name="domain"
placeholder="subdomain.example.com"
/>
-
- <Alert
- withIcon
- variant="info"
- title="Setup CNAME record before adding a custom domain"
- >
- Create a CNAME record in your DNS provider pointing to{' '}
- <code>{settings?.autoApiService.app_config.endpoint ?? 'Loading...'}</code>,
- then add your custom domain above.
- </Alert>
</FormSectionContent>
+ <div className="col-span-12">
+ <InformationBox
+ hideCollapse
+ defaultVisibility
+ icon={<IconAlertCircle strokeWidth={2} />}
+ title="Setup a CNAME record first before adding a custom domain"
+ description={
+ <p>
+ Create a CNAME record in your DNS provider pointing to{' '}
+ <code>{settings?.autoApiService.app_config.endpoint ?? 'Loading...'}</code>{' '}
+ with as low a TTL as possible before adding your custom domain above.
+ </p>
+ }
+ />
+ </div>
</FormSection>
</FormPanel>
</>
diff --git a/studio/components/interfaces/Settings/API/CustomDomainConfig/DNSRecord.tsx b/studio/components/interfaces/Settings/API/CustomDomainConfig/DNSRecord.tsx
index 54064f1052b..87cc04eef38 100644
--- a/studio/components/interfaces/Settings/API/CustomDomainConfig/DNSRecord.tsx
+++ b/studio/components/interfaces/Settings/API/CustomDomainConfig/DNSRecord.tsx
@@ -4,33 +4,34 @@ export type DNSRecordProps = {
type: string
name: string
value: string
+ showLabel?: boolean
}
-const DNSRecord = ({ type, name, value }: DNSRecordProps) => {
+const DNSRecord = ({ type, name, value, showLabel = false }: DNSRecordProps) => {
return (
<div className="flex gap-4">
<Input
- label="Type"
readOnly
disabled
+ label={showLabel ? 'Type' : ''}
className="input-mono"
value={type.toUpperCase()}
layout="vertical"
/>
<Input
- label="Name"
readOnly
copy
disabled
+ label={showLabel ? 'Name' : ''}
className="input-mono flex-1"
value={name}
layout="vertical"
/>
<Input
- label="Value"
readOnly
copy
disabled
+ label={showLabel ? 'Value' : ''}
className="input-mono flex-1"
value={value}
layout="vertical"
diff --git a/studio/components/interfaces/Settings/API/JWTSettings.tsx b/studio/components/interfaces/Settings/API/JWTSettings.tsx
index 7b53b539d3b..d01d9f1fedc 100644
--- a/studio/components/interfaces/Settings/API/JWTSettings.tsx
+++ b/studio/components/interfaces/Settings/API/JWTSettings.tsx
@@ -151,7 +151,7 @@ const JWTSettings: FC<Props> = ({}) => {
<div className="w-full space-y-2">
<div className="flex w-full items-center justify-between">
<div className="flex flex-col space-y-1">
- <p>Generate a new JWT secret</p>
+ <p className="text-sm">Generate a new JWT secret</p>
<p className="text-sm opacity-50">
A random secret will be created, or you can create your own.
</p>
diff --git a/studio/components/to-be-cleaned/Storage/StorageSettings/StorageSettings.tsx b/studio/components/to-be-cleaned/Storage/StorageSettings/StorageSettings.tsx
index 6f78c2dd369..be80781933a 100644
--- a/studio/components/to-be-cleaned/Storage/StorageSettings/StorageSettings.tsx
+++ b/studio/components/to-be-cleaned/Storage/StorageSettings/StorageSettings.tsx
@@ -1,6 +1,6 @@
import useSWR from 'swr'
import { FC, useState } from 'react'
-import { Button, Form, Input, Listbox } from 'ui'
+import { Button, Form, IconClock, Input, Listbox } from 'ui'
import { useStore } from 'hooks'
import { patch, get } from 'lib/common/fetch'
@@ -173,6 +173,7 @@ const StorageConfig = ({ config, projectRef }: any) => {
{isFreeTier && (
<div className="px-6 pb-6">
<UpgradeToPro
+ icon={<IconClock size="large" />}
primaryText="Free Plan has a fixed upload file size limit of 50 MB."
projectRef={projectRef}
secondaryText="Please upgrade to Pro plan for a configurable upload file size limit of up to 5 GB."
diff --git a/studio/components/ui/Dialogs/ConfirmDialog.js b/studio/components/ui/Dialogs/ConfirmDialog.js
index c9f8d79ee45..33e4df18d70 100644
--- a/studio/components/ui/Dialogs/ConfirmDialog.js
+++ b/studio/components/ui/Dialogs/ConfirmDialog.js
@@ -56,13 +56,20 @@ const ConfirmModal = ({
<Modal.Separator />
<Modal.Content>
<div className="flex items-center gap-2">
- <Button htmlType="button" type="default" onClick={onSelectCancel} block>
+ <Button
+ block
+ htmlType="button"
+ type="default"
+ onClick={onSelectCancel}
+ disabled={loading}
+ >
Cancel
</Button>
<Button
htmlType="submit"
block
type={danger ? 'danger' : 'primary'}
+ disabled={loading}
loading={loading}
>
{buttonLoadingLabel && loading
diff --git a/studio/components/ui/UpgradeToPro.tsx b/studio/components/ui/UpgradeToPro.tsx
index 931e1f41be5..ef6360ddb07 100644
--- a/studio/components/ui/UpgradeToPro.tsx
+++ b/studio/components/ui/UpgradeToPro.tsx
@@ -1,14 +1,15 @@
import { Button, IconClock } from 'ui'
import Link from 'next/link'
-import { FC } from 'react'
+import { FC, ReactNode } from 'react'
interface Props {
+ icon?: ReactNode
primaryText: string
projectRef: string
secondaryText: string
}
-const UpgradeToPro: FC<Props> = ({ primaryText, projectRef, secondaryText }) => (
+const UpgradeToPro: FC<Props> = ({ icon, primaryText, projectRef, secondaryText }) => (
<div
className={[
'block w-full rounded border border-opacity-20 py-4 px-6',
@@ -17,9 +18,7 @@ const UpgradeToPro: FC<Props> = ({ primaryText, projectRef, secondaryText }) =>
].join(' ')}
>
<div className="flex space-x-3">
- <div className="mt-1">
- <IconClock size="large" />
- </div>
+ {icon && <div className="mt-1">{icon}</div>}
<div className="flex w-full items-center justify-between">
<div className="space-y-1">
<p className="text-sm">{primaryText}</p>