The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(studio): getting started completed state (#41007)
Danny Whiteb42038514483
diff --git a/apps/studio/components/interfaces/HomeNew/GettingStarted/GettingStarted.tsx b/apps/studio/components/interfaces/HomeNew/GettingStarted/GettingStarted.tsxindex 1b65332cb5f..12ce5856838 100644--- a/apps/studio/components/interfaces/HomeNew/GettingStarted/GettingStarted.tsx+++ b/apps/studio/components/interfaces/HomeNew/GettingStarted/GettingStarted.tsx@@ -1,9 +1,10 @@-import { BASE_PATH } from 'lib/constants'import { Check, ChevronLeft, ChevronRight } from 'lucide-react'import Image from 'next/image'import Link from 'next/link'import { useEffect, useState } from 'react'-import { Badge, Button, Card, CardContent, cn } from 'ui'++import { BASE_PATH } from 'lib/constants'+import { Badge, Button, Card, CardContent, cn, IconDiscord } from 'ui'import { GettingStartedAction, GettingStartedStep } from './GettingStarted.types'// Determine action type for tracking@@ -39,7 +40,8 @@ export interface GettingStartedProps {}export function GettingStarted({ steps, onStepClick }: GettingStartedProps) {- const [activeStepKey, setActiveStepKey] = useState<string | null>(steps[0]?.key ?? null)+ const allStepsComplete = steps.length > 0 && steps.every((step) => step.status === 'complete')+ const [activeStepKey, setActiveStepKey] = useState<string | null>(null)useEffect(() => {if (steps.length === 0) {@@ -47,14 +49,23 @@ export function GettingStarted({ steps, onStepClick }: GettingStartedProps) {return}- const hasActiveStep = activeStepKey ? steps.some((step) => step.key === activeStepKey) : false+ // Check if the current active step key is still valid in the new steps array+ const isActiveStepValid = activeStepKey && steps.some((step) => step.key === activeStepKey)- if (!hasActiveStep) {- setActiveStepKey(steps[0]?.key ?? null)+ // If no step is selected or the active step is no longer valid (e.g., after tab switch)+ if (!isActiveStepValid) {+ // If all steps are complete, don't select any step+ if (allStepsComplete) {+ setActiveStepKey(null)+ } else {+ // Select the first incomplete step, or the first step if all are complete+ const firstIncompleteStep = steps.find((step) => step.status !== 'complete')+ setActiveStepKey(firstIncompleteStep?.key ?? steps[0]?.key ?? null)+ }}- }, [steps, activeStepKey])+ }, [steps, allStepsComplete, activeStepKey])- const activeStep = steps.find((step) => step.key === activeStepKey) ?? steps[0]+ const activeStep = activeStepKey ? steps.find((step) => step.key === activeStepKey) : nullconst activeStepIndex = activeStep ? steps.findIndex((step) => step.key === activeStep.key) : -1const previousStep = activeStepIndex > 0 ? steps[activeStepIndex - 1] : nullconst nextStep =@@ -72,9 +83,7 @@ export function GettingStarted({ steps, onStepClick }: GettingStartedProps) {}}- if (!activeStep) {- return null- }+ const showCongratulations = allStepsComplete && !activeStepreturn (<Card className="overflow-hidden @container">@@ -82,7 +91,7 @@ export function GettingStarted({ steps, onStepClick }: GettingStartedProps) {<aside className="hidden border-r @2xl:block @2xl:w-[calc(1/3*100%-16px)]"><ol>{steps.map((step, index) => {- const isActive = step.key === activeStep.key+ const isActive = activeStep ? step.key === activeStep.key : falseconst isComplete = step.status === 'complete'return (@@ -102,7 +111,7 @@ export function GettingStarted({ steps, onStepClick }: GettingStartedProps) {)}>{isComplete ? (- <Check size={16} strokeWidth={1.5} className="text-brand" />+ <Check size={16} strokeWidth={1.5} className="text-brand-link" />) : (index + 1)}@@ -130,124 +139,160 @@ export function GettingStarted({ steps, onStepClick }: GettingStartedProps) {</aside><CardContent className="flex flex-1 flex-col gap-0 p-0 overflow-y-auto border-b-0">- <div className="flex items-center justify-between gap-2 border-b px-2 py-2 @2xl:hidden">- <span className="text-xs shrink-0 font-mono text-foreground-light w-7 h-7 bg border flex items-center justify-center rounded-md">- {activeStepIndex + 1}- </span>- <div className="flex items-center gap-2">- <Button- type="outline"- onClick={handleSelectPrevious}- disabled={!previousStep}- className="gap-2"- aria-label="Previous step"- >- <ChevronLeft size={16} strokeWidth={1.5} />- </Button>- <Button- type="outline"- onClick={handleSelectNext}- disabled={!nextStep}- className="gap-2"- aria-label="Next step"- >- <ChevronRight size={16} strokeWidth={1.5} />- </Button>- </div>- </div>- <div className="relative w-full flex-1 min-h-[100px] shrink-0 overflow-hidden">- {activeStep.image ? (- <Image- className="w-full select-none invert dark:invert-0"- src={activeStep.image}- fill- objectFit="cover"- objectPosition="top"- alt={activeStep.title}- />- ) : (- <div className="absolute top-0 left-0 right-0 overflow-hidden">- <img- src={`${BASE_PATH}/img/reports/bg-grafana-dark.svg`}- alt="Supabase Grafana"- className="w-full h-full object-cover object-right hidden dark:block user-select-none"- />- <img- src={`${BASE_PATH}/img/reports/bg-grafana-light.svg`}- alt="Supabase Grafana"- className="w-full h-full object-cover object-right dark:hidden user-select-none"- />+ {showCongratulations ? (+ <div className="relative w-full flex-1 min-h-[100px] shrink-0 overflow-hidden bg-200 flex flex-col justify-end">+ <div className="p-10">+ <div className="w-8 h-8 rounded-md bg-brand/15 flex items-center justify-center shrink-0 mb-4">+ <Check size={16} strokeWidth={1.5} className="text-brand-link" />+ </div>+ <div className="flex flex-row items-center gap-4 mb-1">+ <h3>All steps complete</h3>+ </div>+ <p className="text-foreground-light max-w-prose mb-4 text-balance">+ Drop into our Discord community to share your progress and learn from fellow+ developers.+ </p>++ <Button+ asChild+ type="default"+ icon={<IconDiscord size={14} />}+ className="text-foreground-light hover:text-foreground"+ >+ <Link href={'https://discord.supabase.com/'} target="_blank">+ Join our Discord+ </Link>+ </Button></div>- )}- <div className="absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background-surface-100 to-transparent" />- </div>- <div className="p-10">- <div className="flex flex-row items-center gap-4 mb-1">- <h3>{activeStep.title}</h3>- <Badge- variant={activeStep.status === 'complete' ? 'success' : 'default'}- className="hidden @2xl:inline-flex"- >- {activeStep.status}- </Badge></div>- <p className="text-foreground-light max-w-prose mb-4">{activeStep.description}</p>- <div className="mt-auto flex flex-wrap gap-2 pt-2">- {activeStep.actions.map((action, i) => {- if (action.component) {- return <div key={`${activeStep.key}-action-${i}`}>{action.component}</div>- }-- const actionType = getActionType(action)-- if (action.href) {- return (- <Button- asChild- key={`${activeStep.key}-action-${i}`}- type={action.variant ?? 'default'}- icon={action.icon}- className="text-foreground-light hover:text-foreground"- >- <Link- href={action.href}- onClick={() => {- onStepClick({- stepIndex: activeStepIndex,- stepTitle: activeStep.title,- actionType,- wasCompleted: activeStep.status === 'complete',- })- }}- >- {action.label}- </Link>- </Button>- )- }-- return (+ ) : (+ <>+ <div className="flex items-center justify-between gap-2 border-b px-2 py-2 @2xl:hidden">+ <span className="text-xs shrink-0 font-mono text-foreground-light w-7 h-7 bg border flex items-center justify-center rounded-md">+ {activeStepIndex + 1}+ </span>+ <div className="flex items-center gap-2"><Button- key={`${activeStep.key}-action-${i}`}- type={action.variant ?? 'default'}- icon={action.icon}- onClick={() => {- action.onClick?.()- onStepClick({- stepIndex: activeStepIndex,- stepTitle: activeStep.title,- actionType,- wasCompleted: activeStep.status === 'complete',- })- }}- className="text-foreground-light hover:text-foreground"+ type="outline"+ onClick={handleSelectPrevious}+ disabled={!previousStep}+ className="gap-2"+ aria-label="Previous step">- {action.label}+ <ChevronLeft size={16} strokeWidth={1.5} /></Button>- )- })}- </div>- </div>+ <Button+ type="outline"+ onClick={handleSelectNext}+ disabled={!nextStep}+ className="gap-2"+ aria-label="Next step"+ >+ <ChevronRight size={16} strokeWidth={1.5} />+ </Button>+ </div>+ </div>+ <div className="relative w-full flex-1 min-h-[100px] shrink-0 overflow-hidden">+ {activeStep?.image ? (+ <Image+ className="w-full select-none invert dark:invert-0"+ src={activeStep.image}+ fill+ objectFit="cover"+ objectPosition="top"+ alt={activeStep.title}+ />+ ) : (+ <div className="absolute top-0 left-0 right-0 overflow-hidden">+ <img+ src={`${BASE_PATH}/img/reports/bg-grafana-dark.svg`}+ alt="Supabase Grafana"+ className="w-full h-full object-cover object-right hidden dark:block user-select-none"+ />+ <img+ src={`${BASE_PATH}/img/reports/bg-grafana-light.svg`}+ alt="Supabase Grafana"+ className="w-full h-full object-cover object-right dark:hidden user-select-none"+ />+ </div>+ )}+ <div className="absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background-surface-100 to-transparent" />+ </div>+ <div className="p-10">+ {activeStep && (+ <>+ <div className="flex flex-row items-center gap-4 mb-1">+ <h3>{activeStep.title}</h3>+ <Badge+ variant={activeStep.status === 'complete' ? 'success' : 'default'}+ className="capitalize hidden @2xl:inline-flex"+ >+ {activeStep.status}+ </Badge>+ </div>+ <p className="text-foreground-light max-w-prose mb-4 text-balance">+ {activeStep.description}+ </p>+ <div className="mt-auto flex flex-wrap gap-2 pt-2">+ {activeStep.actions.map((action, i) => {+ if (action.component) {+ return <div key={`${activeStep.key}-action-${i}`}>{action.component}</div>+ }++ const actionType = getActionType(action)++ if (action.href) {+ return (+ <Button+ asChild+ key={`${activeStep.key}-action-${i}`}+ type={action.variant ?? 'default'}+ icon={action.icon}+ className="text-foreground-light hover:text-foreground"+ >+ <Link+ href={action.href}+ onClick={() => {+ onStepClick({+ stepIndex: activeStepIndex,+ stepTitle: activeStep.title,+ actionType,+ wasCompleted: activeStep.status === 'complete',+ })+ }}+ >+ {action.label}+ </Link>+ </Button>+ )+ }++ return (+ <Button+ key={`${activeStep.key}-action-${i}`}+ type={action.variant ?? 'default'}+ icon={action.icon}+ onClick={() => {+ action.onClick?.()+ onStepClick({+ stepIndex: activeStepIndex,+ stepTitle: activeStep.title,+ actionType,+ wasCompleted: activeStep.status === 'complete',+ })+ }}+ className="text-foreground-light hover:text-foreground"+ >+ {action.label}+ </Button>+ )+ })}+ </div>+ </>+ )}+ </div>+ </>+ )}</CardContent></div></Card>diff --git a/apps/studio/components/interfaces/HomeNew/GettingStarted/GettingStarted.utils.tsx b/apps/studio/components/interfaces/HomeNew/GettingStarted/GettingStarted.utils.tsxindex 4bdb2dc8238..0386d57c12a 100644--- a/apps/studio/components/interfaces/HomeNew/GettingStarted/GettingStarted.utils.tsx+++ b/apps/studio/components/interfaces/HomeNew/GettingStarted/GettingStarted.utils.tsx@@ -334,7 +334,7 @@ export const getNoCodeWorkflowSteps = ({icon: <Upload strokeWidth={1} className="text-foreground-muted" size={16} />,description:"Let's add file storage to your app by creating a bucket and uploading your first file from the buckets dashboard.",- actions: [{ label: 'Buckets', href: `/project/${ref}/storage/buckets`, variant: 'default' }],+ actions: [{ label: 'Buckets', href: `/project/${ref}/storage/files`, variant: 'default' }],},{key: 'create-edge-function',diff --git a/apps/studio/components/interfaces/HomeNew/ProjectUsageSection.tsx b/apps/studio/components/interfaces/HomeNew/ProjectUsageSection.tsxindex f3a1e6da98a..654d4fab77d 100644--- a/apps/studio/components/interfaces/HomeNew/ProjectUsageSection.tsx+++ b/apps/studio/components/interfaces/HomeNew/ProjectUsageSection.tsx@@ -226,8 +226,8 @@ export const ProjectUsageSection = () => {const prevTotalRequests = enabledPrev.reduce((sum, s) => sum + (s.total || 0), 0)const totalRequestsChangePct = computeChangePercent(totalRequests, prevTotalRequests)- const totalDeltaClass = totalRequestsChangePct >= 0 ? 'text-brand' : 'text-destructive'- const nonSuccessClass = nonSuccessRate > 0 ? 'text-destructive' : 'text-brand'+ const totalDeltaClass = totalRequestsChangePct >= 0 ? 'text-brand-link' : 'text-destructive'+ const nonSuccessClass = nonSuccessRate > 0 ? 'text-destructive' : 'text-brand-link'return (<div className="space-y-6">diff --git a/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx b/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsxindex 698208a3e89..0be567883fa 100644--- a/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx+++ b/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx@@ -351,7 +351,7 @@ export const StorageSettings = () => {<p>Remove or decrease the limit on{' '}<InlineLink- href={`/project/${projectRef}/storage/buckets/${affectedBuckets[0]}`}+ href={`/project/${projectRef}/storage/files/buckets/${affectedBuckets[0]}`}className="text-destructive decoration-destructive-500 hover:decoration-destructive">{affectedBuckets[0]}@@ -382,7 +382,7 @@ export const StorageSettings = () => {className="hover:underline underline-offset-2"><Link- href={`/project/${projectRef}/storage/buckets/${name}`}+ href={`/project/${projectRef}/storage/files/buckets/${name}`}>{bucket?.name} ({formattedLimit.value}{formattedLimit.unit})