Skip to content

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

chore(studio): handle additional dynamic button variants (#42061)

Danny White8867183cdd3b
diff --git a/apps/studio/components/interfaces/Auth/PerformanceSettingsForm.tsx b/apps/studio/components/interfaces/Auth/PerformanceSettingsForm.tsx
index d8a70ac15c4..ad34c047186 100644
--- a/apps/studio/components/interfaces/Auth/PerformanceSettingsForm.tsx
+++ b/apps/studio/components/interfaces/Auth/PerformanceSettingsForm.tsx
@@ -203,7 +203,7 @@ export const PerformanceSettingsForm = () => {
</ScaffoldSection>
<ScaffoldSection isFullWidth>
- <ScaffoldSectionTitle className="mb-4">Request Duration</ScaffoldSectionTitle>
+ <ScaffoldSectionTitle className="mb-4">Request duration</ScaffoldSectionTitle>
<Form_Shadcn_ {...requestDurationForm}>
<form onSubmit={requestDurationForm.handleSubmit(onSubmitRequestDurationForm)}>
@@ -217,28 +217,31 @@ export const PerformanceSettingsForm = () => {
layout="flex-row-reverse"
label="Maximum allowed duration for an Auth request"
description={
- <>
- <p>
- Requests that exceed this time limit will be terminated. Used to manage
- server load.
- </p>
- <p>We recommend a minimum of 10 seconds.</p>
- </>
+ <p className="text-balance">
+ Requests that exceed this time limit are terminated to help manage server
+ load.
+ </p>
}
>
- <FormControl_Shadcn_>
- <div className="relative">
- <PrePostTab postTab="seconds">
- <Input_Shadcn_
- type="number"
- min={5}
- max={30}
- {...field}
- disabled={!canUpdateConfig || promptProPlanUpgrade}
- />
- </PrePostTab>
- </div>
- </FormControl_Shadcn_>
+ <div className="flex flex-col gap-2">
+ <FormControl_Shadcn_>
+ <div className="relative">
+ <PrePostTab postTab="seconds">
+ <Input_Shadcn_
+ type="number"
+ min={5}
+ max={30}
+ {...field}
+ disabled={!canUpdateConfig || promptProPlanUpgrade}
+ />
+ </PrePostTab>
+ </div>
+ </FormControl_Shadcn_>
+
+ <p className="text-xs text-right text-foreground-muted">
+ 10+ seconds recommended
+ </p>
+ </div>
</FormItemLayout>
)}
/>
@@ -251,7 +254,7 @@ export const PerformanceSettingsForm = () => {
</Button>
)}
<Button
- type="primary"
+ type={promptProPlanUpgrade ? 'default' : 'primary'}
htmlType="submit"
disabled={
!canUpdateConfig ||
@@ -270,7 +273,7 @@ export const PerformanceSettingsForm = () => {
</ScaffoldSection>
<ScaffoldSection isFullWidth>
- <ScaffoldSectionTitle className="mb-4">Connection Management</ScaffoldSectionTitle>
+ <ScaffoldSectionTitle className="mb-4">Connection management</ScaffoldSectionTitle>
<Form_Shadcn_ {...databaseForm}>
<form onSubmit={databaseForm.handleSubmit(onSubmitDatabaseForm)} className="space-y-4">
@@ -284,15 +287,11 @@ export const PerformanceSettingsForm = () => {
layout="flex-row-reverse"
label="Allocation strategy"
description={
- <>
- <p>
- Choose to allocate a percentage or an absolute number of connections to
- the Auth server.
- </p>
- <p>
- We recommend a percentage strategy as it grows with your instance size.
- </p>
- </>
+ <p className="text-balance">
+ Choose whether to allocate a percentage or a fixed number of connections
+ to the Auth server. We recommend a percentage, as it scales automatically
+ with your instance size.
+ </p>
}
>
<FormControl_Shadcn_>
@@ -345,6 +344,8 @@ export const PerformanceSettingsForm = () => {
</FormItemLayout>
)}
/>
+ </CardContent>
+ <CardContent>
<FormField_Shadcn_
control={databaseForm.control}
name="DB_MAX_POOL_SIZE"
@@ -353,16 +354,13 @@ export const PerformanceSettingsForm = () => {
layout="flex-row-reverse"
label="Maximum connections"
description={
- <>
- <p>
- Maximum number of connections that the Auth server will take up under
- highest load.
- </p>
- <p>
- <em className="text-brand !not-italic">Connections are not reserved</em>{' '}
- and returned to Postgres a few minutes after being idle.
- </p>
- </>
+ <p className="text-balance">
+ The maximum number of connections the Auth server can use under peak load.{' '}
+ <em className="text-foreground-light font-medium not-italic">
+ Connections are not reserved
+ </em>{' '}
+ and are returned to Postgres after a short idle period.
+ </p>
}
>
<FormControl_Shadcn_>
@@ -385,16 +383,16 @@ export const PerformanceSettingsForm = () => {
{isLoadingMaxConns ? (
<ShimmeringLoader className="py-2 w-16 ml-auto" />
) : (
- <div className="text-xs text-muted w-full text-end">
- <span className="text-brand">
+ <p className="text-xs text-right text-foreground-muted">
+ <span className="text-foreground-light">
{chosenUnit === 'percent'
? Math.floor(
maxConnectionLimit * (Math.min(100, field.value!) / 100)
).toString()
: Math.min(maxConnectionLimit, field.value!)}
</span>{' '}
- / {maxConnectionLimit} max
- </div>
+ / {maxConnectionLimit}
+ </p>
)}
</div>
</FormControl_Shadcn_>
@@ -410,7 +408,7 @@ export const PerformanceSettingsForm = () => {
</Button>
)}
<Button
- type="primary"
+ type={promptProPlanUpgrade ? 'default' : 'primary'}
htmlType="submit"
disabled={
!canUpdateConfig || isUpdatingDatabaseForm || !databaseForm.formState.isDirty
diff --git a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
index db0ed47fdf7..d437e1c7973 100644
--- a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
+++ b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
@@ -249,6 +249,13 @@ export const CreateBranchModal = () => {
}
}, [form, showCreateBranchModal])
+ let tooltipText: string | undefined
+ if (promptPlanUpgrade) {
+ tooltipText = 'Upgrade to unlock branching'
+ } else if (!gitlessBranching && !githubConnection) {
+ tooltipText = 'Set up a GitHub connection first to create branches'
+ }
+
return (
<Dialog open={showCreateBranchModal} onOpenChange={(open) => setShowCreateBranchModal(open)}>
<DialogContent
@@ -585,15 +592,12 @@ export const CreateBranchModal = () => {
form={formId}
disabled={isDisabled}
loading={isCreatingBranch}
- type="primary"
+ type={promptPlanUpgrade ? 'default' : 'primary'}
htmlType="submit"
tooltip={{
content: {
side: 'bottom',
- text:
- !gitlessBranching && !githubConnection
- ? 'Set up a GitHub connection first to create branches'
- : undefined,
+ text: tooltipText,
},
}}
>
diff --git a/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert.tsx b/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert.tsx
index 3b8c8dbfa41..b616e306244 100644
--- a/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert.tsx
+++ b/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert.tsx
@@ -120,14 +120,13 @@ export const ProjectUpgradeAlert = () => {
Your project can be upgraded to the latest version of Postgres
</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
- <p className="mb-3">
- The latest version of Postgres ({latestPgVersion}) is available for your project.
- </p>
+ <p>The latest version of Postgres ({latestPgVersion}) is available for your project.</p>
<Tooltip>
<TooltipTrigger asChild>
<Button
size="tiny"
type="primary"
+ className="mt-2"
onClick={() => setShowUpgradeModal(true)}
disabled={projectUpgradeDisabled}
>
diff --git a/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx b/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx
index aae64e39b26..7d10ab43f25 100644
--- a/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx
+++ b/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx
@@ -93,7 +93,9 @@ export const AWSPrivateLinkSection = () => {
<div className={cn(promptPlanUpgrade && 'opacity-25 pointer-events-none')}>
<div className="flex items-center justify-between mb-3">
<h3 className="text-foreground text-sm">AWS Accounts</h3>
- <Button onClick={onAddAccount}>Add Account</Button>
+ <Button type={promptPlanUpgrade ? 'default' : 'primary'} onClick={onAddAccount}>
+ Add Account
+ </Button>
</div>
{(accounts?.length ?? 0) > 0 ? (
<ResourceList>
diff --git a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
index 739749753ff..d10f505827a 100644
--- a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
+++ b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
@@ -6,6 +6,7 @@ import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
+import { IS_PLATFORM } from 'common'
import { useBranchCreateMutation } from 'data/branches/branch-create-mutation'
import { useBranchUpdateMutation } from 'data/branches/branch-update-mutation'
import { useBranchesQuery } from 'data/branches/branches-query'
@@ -74,6 +75,9 @@ const GitHubIntegrationConnectionForm = ({
const [repoComboBoxOpen, setRepoComboboxOpen] = useState(false)
const isParentProject = !selectedProject?.parent_project_ref
+ const isProPlanAndUp = selectedOrganization?.plan?.id !== 'free'
+ const promptProPlanUpgrade = IS_PLATFORM && !isProPlanAndUp
+
const { can: canUpdateGitHubConnection } = useAsyncCheckPermissions(
PermissionAction.UPDATE,
'integrations.github_connections'
@@ -719,7 +723,7 @@ const GitHubIntegrationConnectionForm = ({
</Button>
)}
<Button
- type="primary"
+ type={promptProPlanUpgrade ? 'default' : 'primary'}
htmlType="submit"
disabled={
disabled ||