Skip to content

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

Add info boxes in Payment Summary Panel to clarify PITR

Joshen Lim0ba683484c65
diff --git a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx
index 31e8c7c3271..5bad8c2ad9c 100644
--- a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx
+++ b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx
@@ -164,8 +164,8 @@ const EnterpriseUpdate: FC<Props> = ({
enterTo="transform opacity-100 translate-x-0"
className="flex w-full items-start justify-between"
>
- <div className="2xl:min-w-5xl mx-auto mt-10">
- <div className="relative space-y-4 px-5">
+ <div className="2xl:min-w-5xl mx-auto mt-10 px-32">
+ <div className="relative space-y-4">
<div className="space-y-8">
<h4 className="text-scale-900 text-lg">Change your project's subscription</h4>
<div
@@ -209,7 +209,7 @@ const EnterpriseUpdate: FC<Props> = ({
</div>
</div>
</div>
- <div className="w-[32rem]">
+ <div className="w-[34rem]">
<PaymentSummaryPanel
isSpendCapEnabled={true}
isSubmitting={isSubmitting}
diff --git a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx
index c0fe582964b..634ac3e3ebf 100644
--- a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx
+++ b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx
@@ -19,6 +19,7 @@ import { getProductPrice } from '../Billing.utils'
import PaymentTotal from './PaymentTotal'
import InformationBox from 'components/ui/InformationBox'
import { DatabaseAddon } from '../AddOns/AddOns.types'
+import { getPITRDays } from './PaymentSummaryPanel.utils'
interface Props {
isRefreshingPreview: boolean
@@ -75,6 +76,9 @@ const PaymentSummaryPanel: FC<Props> = ({
const [showConfirmModal, setShowConfirmModal] = useState(false)
+ const currentPITRDays = getPITRDays(currentPITRDuration)
+ const selectedPITRDays = getPITRDays(selectedPITRDuration)
+
const isEnterprise = currentPlan.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISE
const isChangingPlan =
(currentPlan.prod_id !== STRIPE_PRODUCT_IDS.PAYG &&
@@ -99,7 +103,7 @@ const PaymentSummaryPanel: FC<Props> = ({
return (
<>
<div
- className="w-full space-y-8 border-l bg-panel-body-light px-6 py-10 dark:bg-panel-body-dark lg:px-12"
+ className="w-full space-y-8 border-l bg-panel-body-light px-6 py-10 dark:bg-panel-body-dark lg:px-12 overflow-y-auto"
style={{ height: 'calc(100vh - 57px)' }}
>
<p>Payment Summary</p>
@@ -175,8 +179,33 @@ const PaymentSummaryPanel: FC<Props> = ({
</p>
</div>
)}
- {isChangingComputeSize && (
- <div className="!mt-4">
+
+ {/* Show information boxes with regards to change in subscriptions */}
+ <div className="!mt-4 space-y-4">
+ {isChangingPITRDuration && (
+ <InformationBox
+ hideCollapse
+ defaultVisibility
+ icon={<IconAlertCircle strokeWidth={2} />}
+ title={
+ currentPITRDuration.id === undefined
+ ? 'Enabling PITR'
+ : selectedPITRDuration.id === undefined
+ ? 'Disabling PITR'
+ : 'Updating PITR duration'
+ }
+ description={
+ selectedPITRDays >= currentPITRDays
+ ? `The days for which PITR is available for will only start at the time of enabling the add-on (e.g You will have access to the full ${selectedPITRDays} days of PITR after ${
+ selectedPITRDays - currentPITRDays
+ } days from today)`
+ : selectedPITRDays === 0
+ ? 'All available PITR back ups for your project will be removed and are non-recoverable'
+ : `Only the latest ${selectedPITRDays} days of PITR from today will be retained (all backups that are later than ${selectedPITRDays} days will be removed and are non-recoverable)`
+ }
+ />
+ )}
+ {isChangingComputeSize && (
<InformationBox
hideCollapse
defaultVisibility
@@ -184,8 +213,8 @@ const PaymentSummaryPanel: FC<Props> = ({
title="Changing your compute size"
description="It will take up to 2 minutes for changes to take place, and your project will be unavailable during that time"
/>
- </div>
- )}
+ )}
+ </div>
</div>
)}
diff --git a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.utils.ts b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.utils.ts
new file mode 100644
index 00000000000..a6088970839
--- /dev/null
+++ b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.utils.ts
@@ -0,0 +1,7 @@
+import { DatabaseAddon } from '../AddOns/AddOns.types'
+
+export const getPITRDays = (pitrAddon: DatabaseAddon) => {
+ const prodId = pitrAddon.metadata.supabase_prod_id
+ const daysString = prodId.split('_')[2]
+ return Number(daysString.split('days')[0])
+}
diff --git a/studio/components/interfaces/Billing/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade.tsx
index c5e160ab00d..ee8ce6280b9 100644
--- a/studio/components/interfaces/Billing/ProUpgrade.tsx
+++ b/studio/components/interfaces/Billing/ProUpgrade.tsx
@@ -180,7 +180,7 @@ const ProUpgrade: FC<Props> = ({
enterTo="transform opacity-100 translate-x-0"
className="flex w-full items-start justify-between"
>
- <div className="2xl:min-w-5xl mx-auto mt-10 px-36">
+ <div className="2xl:min-w-5xl mx-auto mt-10 px-32">
<div className="relative space-y-4">
<BackButton onClick={() => onSelectBack()} />
<div className="space-y-8">
@@ -254,7 +254,7 @@ const ProUpgrade: FC<Props> = ({
</div>
</div>
</div>
- <div className="w-[32rem]">
+ <div className="w-[34rem]">
<PaymentSummaryPanel
isRefreshingPreview={isRefreshingPreview}
subscriptionPreview={subscriptionPreview}