The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(studio): improve Alert Dialog component (#41336)
Danny Whitec6351514b4c9
diff --git a/apps/studio/components/interfaces/APIKeys/CreateNewAPIKeysButton.tsx b/apps/studio/components/interfaces/APIKeys/CreateNewAPIKeysButton.tsxindex a1262b200a8..16456e7045b 100644--- a/apps/studio/components/interfaces/APIKeys/CreateNewAPIKeysButton.tsx+++ b/apps/studio/components/interfaces/APIKeys/CreateNewAPIKeysButton.tsx@@ -5,6 +5,7 @@ import { useParams } from 'common'import { useAPIKeyCreateMutation } from 'data/api-keys/api-key-create-mutation'import {AlertDialog,+ AlertDialogAction,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,@@ -49,16 +50,16 @@ export const CreateNewAPIKeysButton = () => {<AlertDialogHeader><AlertDialogTitle>Create new API keys</AlertDialogTitle><AlertDialogDescription>- This will create a default publishable key and a default secret key named{' '}+ This will create a default publishable key and a default secret key both named{' '}<code className="!break-keep text-code-inline">default</code>. These keys are requiredto connect your application to your Supabase project.</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter><AlertDialogCancel>Cancel</AlertDialogCancel>- <Button onClick={handleCreateNewApiKeys} loading={isCreatingKeys}>+ <AlertDialogAction onClick={handleCreateNewApiKeys} disabled={isCreatingKeys}>{isCreatingKeys ? 'Creating...' : 'Create keys'}- </Button>+ </AlertDialogAction></AlertDialogFooter></AlertDialogContent></AlertDialog>diff --git a/apps/studio/components/interfaces/BranchManagement/OutOfDateNotice.tsx b/apps/studio/components/interfaces/BranchManagement/OutOfDateNotice.tsxindex 1c86de5f881..717875cf348 100644--- a/apps/studio/components/interfaces/BranchManagement/OutOfDateNotice.tsx+++ b/apps/studio/components/interfaces/BranchManagement/OutOfDateNotice.tsx@@ -109,7 +109,7 @@ export const OutOfDateNotice = ({</AlertDialogTrigger><AlertDialogContent><AlertDialogHeader>- <AlertDialogTitle>Update branch with modified functions?</AlertDialogTitle>+ <AlertDialogTitle>Update branch with modified functions</AlertDialogTitle><AlertDialogDescription>This branch has {modifiedFunctionsCount} modified edge function{modifiedFunctionsCount !== 1 ? 's' : ''} that will be overwritten when updating@@ -119,7 +119,7 @@ export const OutOfDateNotice = ({</AlertDialogHeader><AlertDialogFooter><AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction onClick={() => handleUpdate(true)}>+ <AlertDialogAction variant="warning" onClick={() => handleUpdate(true)}>Update anyway</AlertDialogAction></AlertDialogFooter>diff --git a/apps/studio/components/interfaces/Database/Replication/ResetTableButton.tsx b/apps/studio/components/interfaces/Database/Replication/ResetTableButton.tsxindex dcec5c8f44a..6c399ae2bf4 100644--- a/apps/studio/components/interfaces/Database/Replication/ResetTableButton.tsx+++ b/apps/studio/components/interfaces/Database/Replication/ResetTableButton.tsx@@ -61,34 +61,22 @@ export const ResetTableButton = ({ tableId, tableName }: ResetTableButtonProps)</Button><AlertDialogContent><AlertDialogHeader>- <AlertDialogTitle>Reset and restart table "{tableName}"?</AlertDialogTitle>- <AlertDialogDescription className="flex flex-col gap-y-3 py-4 !mt-0">- <p>- This will reset and restart replication for this table only. The table will start- copying from scratch, and any existing data for this table downstream will be deleted.- </p>- <p className="text-foreground-light">- Other tables in the pipeline will not be affected. Only this table will be restarted- and go through the full replication process again, starting with the initial copy- phase.- </p>- <p className="text-foreground-light">- The pipeline will be restarted to apply the table reset.- </p>+ <AlertDialogTitle>Reset table and restart</AlertDialogTitle>+ <AlertDialogDescription>+ This will reset replication for <code className="text-code-inline">{tableName}</code>{' '}+ only. The table will be copied again from scratch, and any existing downstream data for+ it will be deleted. Other tables in the pipeline are not affected, but the pipeline will+ restart to apply this reset.</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter><AlertDialogCancel disabled={isResetting}>Cancel</AlertDialogCancel>- <AlertDialogAction- disabled={isResetting}- onClick={handleReset}- className="bg-destructive hover:bg-destructive/90"- >+ <AlertDialogAction disabled={isResetting} onClick={handleReset} variant="danger">{isRollingBack? 'Resetting table...': isRestartingPipeline? 'Restarting pipeline...'- : 'Confirm reset and restart'}+ : 'Reset and restart'}</AlertDialogAction></AlertDialogFooter></AlertDialogContent>diff --git a/apps/studio/components/interfaces/QueryPerformance/IndexAdvisor/EnableIndexAdvisorButton.tsx b/apps/studio/components/interfaces/QueryPerformance/IndexAdvisor/EnableIndexAdvisorButton.tsxindex 7c6504f105f..9b6ee288f97 100644--- a/apps/studio/components/interfaces/QueryPerformance/IndexAdvisor/EnableIndexAdvisorButton.tsx+++ b/apps/studio/components/interfaces/QueryPerformance/IndexAdvisor/EnableIndexAdvisorButton.tsx@@ -4,6 +4,7 @@ import { toast } from 'sonner'import { useDatabaseExtensionEnableMutation } from 'data/database-extensions/database-extension-enable-mutation'import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-extensions-query'import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'+import { useTrack } from 'lib/telemetry/track'import {AlertDialog,AlertDialogAction,@@ -14,11 +15,9 @@ import {AlertDialogHeader,AlertDialogTitle,AlertDialogTrigger,- Badge,Button,} from 'ui'import { getIndexAdvisorExtensions } from './index-advisor.utils'-import { useTrack } from 'lib/telemetry/track'export const EnableIndexAdvisorButton = () => {const track = useTrack()@@ -79,21 +78,9 @@ export const EnableIndexAdvisorButton = () => {<AlertDialogHeader><AlertDialogTitle>Enable Index Advisor</AlertDialogTitle><AlertDialogDescription>- Index Advisor is a tool that helps you identify and simulate indexes that can improve- query performance. To use Index Advisor, you need to enable the following Postgres- extensions:- <ul className="list-disc pl-6 py-4 flex flex-col gap-2">- <li>- <Badge className="font-mono text-foreground">index_advisor</Badge> - Recommends- database indexes- </li>- <li>- <Badge className="font-mono text-foreground">hypopg</Badge> - For hypothetical- indexes simulation- </li>- </ul>- These extensions help identify and simulate indexes that can improve query performance- without having to create actual indexes.+ This will enable the <code className="text-code-inline">index_advisor</code> and{' '}+ <code className="text-code-inline">hypopg</code> Postgres extensions so Index Advisor+ can analyse queries and suggest performance-improving indexes.</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>@@ -106,7 +93,7 @@ export const EnableIndexAdvisorButton = () => {}}disabled={isEnablingExtension}>- {isEnablingExtension ? 'Enabling...' : 'Enable Extensions'}+ {isEnablingExtension ? 'Enabling...' : 'Enable'}</AlertDialogAction></AlertDialogFooter></AlertDialogContent>diff --git a/apps/studio/components/ui/BannerStack/Banners/BannerIndexAdvisor.tsx b/apps/studio/components/ui/BannerStack/Banners/BannerIndexAdvisor.tsxindex bf7bb5099d1..b2e1fe309c6 100644--- a/apps/studio/components/ui/BannerStack/Banners/BannerIndexAdvisor.tsx+++ b/apps/studio/components/ui/BannerStack/Banners/BannerIndexAdvisor.tsx@@ -1,11 +1,11 @@-import { BannerCard } from '../BannerCard'-import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'import { LOCAL_STORAGE_KEYS } from 'common'import { useParams } from 'common/hooks'-import { Lightbulb } from 'lucide-react'import { EnableIndexAdvisorButton } from 'components/interfaces/QueryPerformance/IndexAdvisor/EnableIndexAdvisorButton'-import { useBannerStack } from '../BannerStackProvider'+import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'import { useTrack } from 'lib/telemetry/track'+import { Lightbulb } from 'lucide-react'+import { BannerCard } from '../BannerCard'+import { useBannerStack } from '../BannerStackProvider'export const BannerIndexAdvisor = () => {const track = useTrack()@@ -26,7 +26,7 @@ export const BannerIndexAdvisor = () => {><div className="flex flex-col gap-y-4"><div className="flex flex-col gap-y-2 items-start">- <div className="p-2 rounded-lg bg-warning-200 text-warning dark:bg-warning-300">+ <div className="p-2 rounded-lg bg-warning-300 text-warning"><Lightbulb size={16} /></div></div>diff --git a/apps/studio/components/ui/ProjectSettings/ToggleLegacyApiKeys.tsx b/apps/studio/components/ui/ProjectSettings/ToggleLegacyApiKeys.tsxindex 935c1082797..1a1890655e8 100644--- a/apps/studio/components/ui/ProjectSettings/ToggleLegacyApiKeys.tsx+++ b/apps/studio/components/ui/ProjectSettings/ToggleLegacyApiKeys.tsx@@ -113,14 +113,14 @@ export const ToggleLegacyApiKeysPanel = () => {<AlertDialogTitle>Apps using Supabase may break</AlertDialogTitle><AlertDialogDescription>Your project uses apps that integrate with Supabase. Disabling the legacy API keys is- a brand new feature and the apps you're using may not have added support for this yet.+ a brand new feature and the apps you’re using may not have added support for this yet.It can cause them to stop functioning. Check before continuing.</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter><AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction onClick={() => setIsConfirmOpen(true)}>- Proceed to disable API keys+ <AlertDialogAction variant="danger" onClick={() => setIsConfirmOpen(true)}>+ Disable API keys</AlertDialogAction></AlertDialogFooter></AlertDialogContent>diff --git a/apps/www/components/Forms/ApplyToSupaSquadForm.tsx b/apps/www/components/Forms/ApplyToSupaSquadForm.tsxindex d93a5a435c5..ac7e74a9991 100644--- a/apps/www/components/Forms/ApplyToSupaSquadForm.tsx+++ b/apps/www/components/Forms/ApplyToSupaSquadForm.tsx@@ -1,40 +1,42 @@-import { FC, useEffect, useState, memo } from 'react'-import { AlertCircle, CheckCircle2 } from 'lucide-react'-import { useForm } from 'react-hook-form'import { zodResolver } from '@hookform/resolvers/zod'+import { AlertCircle } from 'lucide-react'+import { FC, memo, useEffect, useState } from 'react'+import { useForm } from 'react-hook-form'import {Button,Form_Shadcn_,- FormField_Shadcn_,- FormLabel_Shadcn_,FormControl_Shadcn_,+ FormDescription_Shadcn_,+ FormField_Shadcn_,FormItem_Shadcn_,- Input_Shadcn_,+ FormLabel_Shadcn_,FormMessage_Shadcn_,+ Input_Shadcn_,Separator,TextArea_Shadcn_,- FormDescription_Shadcn_,} from 'ui'+import {+ MultiSelector,+ MultiSelectorContent,+ MultiSelectorItem,+ MultiSelectorList,+ MultiSelectorTrigger,+} from 'ui-patterns/multi-select'import { Alert, AlertDescription } from 'ui/src/components/shadcn/ui/alert'import {AlertDialog,AlertDialogAction,AlertDialogContent,AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,AlertDialogTitle,} from 'ui/src/components/shadcn/ui/alert-dialog'import {- MultiSelector,- MultiSelectorContent,- MultiSelectorList,- MultiSelectorTrigger,- MultiSelectorItem,-} from 'ui-patterns/multi-select'-import { CountrySelector } from '../Supasquad/CountrySelector'-import {- supaSquadApplicationSchema,SupaSquadApplication,+ supaSquadApplicationSchema,} from '~/data/open-source/contributing/supasquad.utils'+import { CountrySelector } from '../Supasquad/CountrySelector'interface FormItem_Shadcn_ {type: 'text' | 'textarea'@@ -706,27 +708,17 @@ const ApplyToSupaSquadForm: FC<Props> = ({ className }) => {{/* Confirmation AlertDialog Overlay */}<AlertDialog open={showConfirmation} onOpenChange={() => {}}>- <AlertDialogContent className="z-[60]">- <AlertDialogTitle className="sr-only">Application Submitted</AlertDialogTitle>- <AlertDialogDescription className="sr-only">- Your application has been successfully submitted. Please check your email for- confirmation.- </AlertDialogDescription>- <div className="flex flex-col items-center gap-6 py-4">- <div className="flex items-center justify-center w-16 h-16 bg-green-100 rounded-full">- <CheckCircle2 className="w-8 h-8 text-green-600" />- </div>- <div className="text-center space-y-2">- <h3 className="text-xl font-semibold">Application Submitted!</h3>- <p className="text-muted-foreground">- Thank you for your submission. Please check your email for a confirmation link to- complete your application.- </p>- </div>- <AlertDialogAction onClick={handleConfirmationClose} className="w-full max-w-xs">- Got it, thanks!- </AlertDialogAction>- </div>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Application submitted</AlertDialogTitle>+ <AlertDialogDescription>+ Thank you for your submission! Please check your email for a confirmation link to+ complete your application.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogAction onClick={handleConfirmationClose}>Got it</AlertDialogAction>+ </AlertDialogFooter></AlertDialogContent></AlertDialog></>diff --git a/packages/ui/src/components/shadcn/ui/alert-dialog.tsx b/packages/ui/src/components/shadcn/ui/alert-dialog.tsxindex 80997e3820c..095d30c2475 100644--- a/packages/ui/src/components/shadcn/ui/alert-dialog.tsx+++ b/packages/ui/src/components/shadcn/ui/alert-dialog.tsx@@ -3,10 +3,9 @@import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'import * as React from 'react'+import { cva, VariantProps } from 'class-variance-authority'import { cn } from '../../../lib/utils/cn'-import { buttonVariants } from './../../Button'-import { VariantProps } from 'class-variance-authority'-import { cva } from 'class-variance-authority'+import { ButtonVariantProps, buttonVariants } from './../../Button'const AlertDialog = AlertDialogPrimitive.Root@@ -61,7 +60,7 @@ const AlertDialogContentVariants = cva(},},defaultVariants: {- size: 'medium',+ size: 'small',},})@@ -90,7 +89,7 @@ const AlertDialogContent = React.forwardRef<AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayNameconst AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (- <div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />+ <div className={cn('flex flex-col text-left', className)} {...props} />)AlertDialogHeader.displayName = 'AlertDialogHeader'@@ -123,19 +122,29 @@ const AlertDialogDescription = React.forwardRef<>(({ className, ...props }, ref) => (<AlertDialogPrimitive.Descriptionref={ref}- className={cn('text-sm text-foreground-light px-5 py-3', className)}+ className={cn(+ 'text-sm text-foreground-light px-5',+ // Optically align text vertically+ ' pt-3.5 pb-4',+ className+ )}{...props}/>))AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName+type AlertDialogActionProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> & {+ variant?: NonNullable<ButtonVariantProps['type']>+}+const AlertDialogAction = React.forwardRef<React.ElementRef<typeof AlertDialogPrimitive.Action>,- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>->(({ className, ...props }, ref) => (+ AlertDialogActionProps+>(({ className, variant = 'primary', type = 'button', ...props }, ref) => (<AlertDialogPrimitive.Actionref={ref}- className={cn(buttonVariants({ type: 'primary', size: 'tiny' }), className)}+ type={type}+ className={cn(buttonVariants({ type: variant, size: 'tiny' }), className)}{...props}/>))