From 0c336cee5fedd6bfe1fcf6dcd06cd5d1c35b6e8d Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Fri, 9 Dec 2022 13:55:11 +0800 Subject: [PATCH] Prevent changing of custom domain for subscription if already has custom domain add on but with 0 --- .../Billing/AddOns/CustomDomainSelection.tsx | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/studio/components/interfaces/Billing/AddOns/CustomDomainSelection.tsx b/studio/components/interfaces/Billing/AddOns/CustomDomainSelection.tsx index a43d9f17f34..1cf3b9ad9fc 100644 --- a/studio/components/interfaces/Billing/AddOns/CustomDomainSelection.tsx +++ b/studio/components/interfaces/Billing/AddOns/CustomDomainSelection.tsx @@ -1,14 +1,16 @@ +import Link from 'next/link' import { FC } from 'react' -import { Badge, Radio } from 'ui' +import { Badge, Button, Radio } from 'ui' -import { useStore, useFlag } from 'hooks' +import { useFlag, useParams } from 'hooks' import { getProductPrice } from '../Billing.utils' import DisabledWarningDueToIncident from 'components/ui/DisabledWarningDueToIncident' +import { DatabaseAddon } from './AddOns.types' interface Props { - options: any[] - currentOption?: any - selectedOption: any + options: DatabaseAddon[] + currentOption?: DatabaseAddon + selectedOption: DatabaseAddon onSelectOption: (option: any) => void } @@ -18,7 +20,9 @@ const CustomDomainSelection: FC = ({ selectedOption, onSelectOption, }) => { + const { ref } = useParams() const addonUpdateDisabled = useFlag('disableProjectCreationAndUpdate') + return (
@@ -30,6 +34,31 @@ const CustomDomainSelection: FC = ({
{addonUpdateDisabled ? ( + ) : currentOption?.isLocked ? ( +
+
+
+ Your project currently has custom domains enabled +
+

+ If you would like to disable custom domains, do reach out to us +

+
+ +
) : ( {options.map((option: any) => {