From fdf33e72c4d528fcfb3f7baa1bc3fda828eddc09 Mon Sep 17 00:00:00 2001 From: Danny White <3104761+dnywh@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:32:56 +1000 Subject: [PATCH] fix(studio): clean up onboarding returnTo paths (#49283) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What kind of change does this PR introduce? Bug fix. Follow-up to #41041 and DEPR-318. ## What is the current behavior? Marketing "Start your project" links go to `/dashboard`, which redirects unauthenticated users to `/org` and sets `returnTo=/org`. That value survives when they switch from sign-in to sign-up, so email verification still lands on the org list instead of org creation. ## What is the new behavior? - Sign-in's **Sign up** link rewrites `returnTo=/org` (and `/organizations`) to `/new` - Docs mobile menu, www homepage/product CTAs, and solution page CTAs link to `/dashboard/sign-up` for guests - Signed-in visitors get the dashboard URL instead, so they never hit the sign-up form - Shared `DASHBOARD_SIGN_UP_URL` / `getDashboardCtaHref` helpers for www Stacked on #41041. ## To test Stacked on #41041. The studio preview below includes both PRs. www and docs have their own previews. ### Studio: sign-in → sign-up rewrite Using the [studio-staging preview](https://studio-staging-git-dnywh-fixonboarding-return-to-supabase.vercel.app/) from Vercel checks: 1. Open the preview while logged out. It should land on `/dashboard/sign-in?returnTo=%2Forg` 2. Click **Sign up**. Expect the URL to include `returnTo=%2Fnew` ### Optional: www CTAs Using the [www preview](https://zone-www-dot-com-git-dnywh-fixonboarding-return-to-supabase.vercel.app/): 3. Logged out: homepage, product, or solutions **Start your project** should go to `/dashboard/sign-up` 4. Logged in: the same CTAs should go to `/dashboard` (not sign-up) (thought this will be hard if not impossible to test on staging) ### Optional: docs CTAs Using the [docs preview](https://docs-git-dnywh-fixonboarding-return-to-supabase.vercel.app/): 5. On mobile nav while logged out, click **Start your project**. Expect `/dashboard/sign-up` ### Compare on supabase.green Optional. Just to show what happens currently on `master`: 6. Open **supabase.green** while logged out, then click **Sign up** from `/dashboard/sign-in?returnTo=%2Forg`. `returnTo` should stay as `/org` ## Summary by CodeRabbit * **New Features** * Start-project and sign-up links now direct visitors to registration while signed-in users continue to reach the dashboard. * Homepage, product, solution, and mobile navigation CTAs now provide consistent authentication-aware destinations. * Sign-up links preserve return destinations and existing navigation parameters. * **Bug Fixes** * Corrected mobile navigation and marketing CTA links that previously sent visitors to the dashboard root instead of the appropriate sign-up flow. --- .../NavigationMenu/GlobalMobileMenu.tsx | 4 +- apps/studio/pages/sign-in.tsx | 6 +- .../www/app/(home)/_components/CTASection.tsx | 6 +- apps/www/app/(home)/_components/Hero.tsx | 5 +- .../app/(products)/auth/_components/Hero.tsx | 6 +- .../(products)/database/_components/Hero.tsx | 6 +- .../edge-functions/_components/CTASection.tsx | 6 +- .../edge-functions/_components/Hero.tsx | 5 +- .../(products)/realtime/_components/Hero.tsx | 6 +- .../(products)/storage/_components/Hero.tsx | 6 +- apps/www/components/CTABanner/index.tsx | 8 +- apps/www/components/CTASection.tsx | 6 +- .../www/components/Sections/ProductHeader.tsx | 6 +- .../components/Sections/ProductHeader2.tsx | 149 ++++++++++-------- apps/www/components/Sections/ProductsCta2.tsx | 8 +- .../www/components/StartYourProjectButton.tsx | 34 ++++ apps/www/data/solutions/agencies.tsx | 3 +- apps/www/data/solutions/agents.tsx | 3 +- apps/www/data/solutions/ai-builders.tsx | 3 +- apps/www/data/solutions/b2b-saas.tsx | 3 +- apps/www/data/solutions/beginners.tsx | 3 +- apps/www/data/solutions/developers.tsx | 3 +- apps/www/data/solutions/finserv.tsx | 3 +- apps/www/data/solutions/hackathon.tsx | 3 +- apps/www/data/solutions/healthcare.tsx | 3 +- apps/www/data/solutions/hosted-postgres.tsx | 3 +- apps/www/data/solutions/innovation-teams.tsx | 5 +- apps/www/data/solutions/no-code.tsx | 3 +- .../data/solutions/postgres-developers.tsx | 3 +- apps/www/data/solutions/startups.tsx | 3 +- apps/www/data/solutions/vibe-coders.tsx | 3 +- apps/www/lib/dashboard-links.ts | 16 ++ 32 files changed, 215 insertions(+), 115 deletions(-) create mode 100644 apps/www/components/StartYourProjectButton.tsx create mode 100644 apps/www/lib/dashboard-links.ts diff --git a/apps/docs/components/Navigation/NavigationMenu/GlobalMobileMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/GlobalMobileMenu.tsx index 619222551c2..f0bdd88d1a0 100644 --- a/apps/docs/components/Navigation/NavigationMenu/GlobalMobileMenu.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/GlobalMobileMenu.tsx @@ -168,7 +168,9 @@ const GlobalMobileMenu = ({ open, setOpen }: Props) => { Sign in )} diff --git a/apps/studio/pages/sign-in.tsx b/apps/studio/pages/sign-in.tsx index 9cf0b1c6ea5..c000ad453bd 100644 --- a/apps/studio/pages/sign-in.tsx +++ b/apps/studio/pages/sign-in.tsx @@ -16,6 +16,7 @@ import { useInboundBranding } from '@/hooks/misc/useInboundBranding' import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' import { IS_PLATFORM } from '@/lib/constants' import type { ExternalIdentityProviderConfig } from '@/lib/external-identity-providers' +import { getSignUpReturnTo } from '@/lib/gotrue' import type { NextPageWithLayout } from '@/types' const SignInPage: NextPageWithLayout = () => { @@ -131,7 +132,10 @@ const SignInPage: NextPageWithLayout = () => {
Don’t have an account?{' '} Sign up diff --git a/apps/www/app/(home)/_components/CTASection.tsx b/apps/www/app/(home)/_components/CTASection.tsx index 346b93b89f2..2c8baf2412d 100644 --- a/apps/www/app/(home)/_components/CTASection.tsx +++ b/apps/www/app/(home)/_components/CTASection.tsx @@ -1,10 +1,14 @@ 'use client' import { useSendTelemetryEvent } from '~/lib/telemetry' +import { useIsLoggedIn } from 'common' import Link from 'next/link' import { Button } from 'ui' +import { getDashboardCtaHref } from '@/lib/dashboard-links' + export function CTASection() { + const isLoggedIn = useIsLoggedIn() const sendTelemetryEvent = useSendTelemetryEvent() return ( @@ -17,7 +21,7 @@ export function CTASection() {
- + diff --git a/apps/www/app/(products)/database/_components/Hero.tsx b/apps/www/app/(products)/database/_components/Hero.tsx index bd9249d04a9..778c147e7f9 100644 --- a/apps/www/app/(products)/database/_components/Hero.tsx +++ b/apps/www/app/(products)/database/_components/Hero.tsx @@ -2,6 +2,8 @@ import SectionContainerWithCn from '~/components/Layouts/SectionContainerWithCn' import Link from 'next/link' import { Button } from 'ui' +import { StartYourProjectButton } from '@/components/StartYourProjectButton' + export function Hero() { return ( @@ -17,9 +19,7 @@ export function Hero() {

- + diff --git a/apps/www/app/(products)/edge-functions/_components/CTASection.tsx b/apps/www/app/(products)/edge-functions/_components/CTASection.tsx index fcba5d1665f..af5f4df924a 100644 --- a/apps/www/app/(products)/edge-functions/_components/CTASection.tsx +++ b/apps/www/app/(products)/edge-functions/_components/CTASection.tsx @@ -6,6 +6,8 @@ import Link from 'next/link' import { useEffect, useRef, useState } from 'react' import { Button } from 'ui' +import { StartYourProjectButton } from '@/components/StartYourProjectButton' + const TERMINAL_LINES = [ { text: '$ supabase functions new hello-world', delay: 0 }, { text: 'Created function: supabase/functions/hello-world/index.ts', delay: 0.3, dim: true }, @@ -80,9 +82,7 @@ export function CTASection() {
- + diff --git a/apps/www/app/(products)/edge-functions/_components/Hero.tsx b/apps/www/app/(products)/edge-functions/_components/Hero.tsx index 3386fafb288..a5973d1d731 100644 --- a/apps/www/app/(products)/edge-functions/_components/Hero.tsx +++ b/apps/www/app/(products)/edge-functions/_components/Hero.tsx @@ -3,6 +3,7 @@ import Link from 'next/link' import { Button } from 'ui' import { Highlights } from './Highlights' +import { StartYourProjectButton } from '@/components/StartYourProjectButton' export function Hero() { return ( @@ -19,9 +20,7 @@ export function Hero() {

- + diff --git a/apps/www/app/(products)/realtime/_components/Hero.tsx b/apps/www/app/(products)/realtime/_components/Hero.tsx index ab998add2d0..121d517500b 100644 --- a/apps/www/app/(products)/realtime/_components/Hero.tsx +++ b/apps/www/app/(products)/realtime/_components/Hero.tsx @@ -2,6 +2,8 @@ import SectionContainerWithCn from '~/components/Layouts/SectionContainerWithCn' import Link from 'next/link' import { Button } from 'ui' +import { StartYourProjectButton } from '@/components/StartYourProjectButton' + export function Hero() { return ( @@ -17,9 +19,7 @@ export function Hero() {

- + diff --git a/apps/www/app/(products)/storage/_components/Hero.tsx b/apps/www/app/(products)/storage/_components/Hero.tsx index e3f3eb3de7d..d6147591b13 100644 --- a/apps/www/app/(products)/storage/_components/Hero.tsx +++ b/apps/www/app/(products)/storage/_components/Hero.tsx @@ -2,6 +2,8 @@ import SectionContainerWithCn from '~/components/Layouts/SectionContainerWithCn' import Link from 'next/link' import { Button } from 'ui' +import { StartYourProjectButton } from '@/components/StartYourProjectButton' + export function Hero() { return ( @@ -17,9 +19,7 @@ export function Hero() {

- + diff --git a/apps/www/components/CTABanner/index.tsx b/apps/www/components/CTABanner/index.tsx index 42efbe627ff..01532b181c4 100644 --- a/apps/www/components/CTABanner/index.tsx +++ b/apps/www/components/CTABanner/index.tsx @@ -1,8 +1,11 @@ 'use client' +import { useSendTelemetryEvent } from '~/lib/telemetry' +import { useIsLoggedIn } from 'common' import Link from 'next/link' import { Button, cn } from 'ui' -import { useSendTelemetryEvent } from '~/lib/telemetry' + +import { getDashboardCtaHref } from '@/lib/dashboard-links' interface Props { className?: string @@ -10,6 +13,7 @@ interface Props { } const CTABanner = ({ darkerBg, className }: Props) => { + const isLoggedIn = useIsLoggedIn() const sendTelemetryEvent = useSendTelemetryEvent() return (
{
) })}
- )} -
- {props.ctas?.map((cta) => ( - - ))} + {props.footer && footerPosition === 'left' && ( +
+ {props.footer} +
+ )}
- {props.footer && footerPosition === 'left' && ( -
+ {props.image && ( +
+ {props.image} +
+ )} + {props.footer && footerPosition !== 'left' && ( +
{props.footer}
)} -
- {props.image && ( -
- {props.image} -
- )} - {props.footer && footerPosition !== 'left' && ( -
- {props.footer} -
- )} - -
-) + +
+ ) +} export default ProductHeader diff --git a/apps/www/components/Sections/ProductsCta2.tsx b/apps/www/components/Sections/ProductsCta2.tsx index d25b2e25d59..dc85a0aa3e9 100644 --- a/apps/www/components/Sections/ProductsCta2.tsx +++ b/apps/www/components/Sections/ProductsCta2.tsx @@ -5,6 +5,8 @@ import Link from 'next/link' import React from 'react' import { Button, cn } from 'ui' +import { StartYourProjectButton } from '@/components/StartYourProjectButton' + export type Products = PRODUCT_SHORTNAMES interface Props { @@ -26,9 +28,9 @@ function ProductsCta(props: Props) {

Ready to start building?

- + + Start for free + diff --git a/apps/www/components/StartYourProjectButton.tsx b/apps/www/components/StartYourProjectButton.tsx new file mode 100644 index 00000000000..4dc263ffd06 --- /dev/null +++ b/apps/www/components/StartYourProjectButton.tsx @@ -0,0 +1,34 @@ +'use client' + +import { useIsLoggedIn } from 'common' +import Link from 'next/link' +import type { ComponentProps } from 'react' +import { Button } from 'ui' + +import { getDashboardCtaHref } from '@/lib/dashboard-links' + +type StartYourProjectButtonProps = { + children?: React.ReactNode + onClick?: ComponentProps['onClick'] + size?: ComponentProps['size'] + variant?: ComponentProps['variant'] + className?: string +} + +export function StartYourProjectButton({ + children = 'Start your project', + onClick, + size = 'medium', + variant, + className, +}: StartYourProjectButtonProps) { + const isLoggedIn = useIsLoggedIn() + + return ( + + ) +} diff --git a/apps/www/data/solutions/agencies.tsx b/apps/www/data/solutions/agencies.tsx index ff62db32131..dfb7ccd5c3b 100644 --- a/apps/www/data/solutions/agencies.tsx +++ b/apps/www/data/solutions/agencies.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { ArrowLeftRight, Check, @@ -85,7 +86,7 @@ const data: { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as const, }, { diff --git a/apps/www/data/solutions/agents.tsx b/apps/www/data/solutions/agents.tsx index 64f5725029e..df28ea71b52 100644 --- a/apps/www/data/solutions/agents.tsx +++ b/apps/www/data/solutions/agents.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { Check, ClipboardCheck, @@ -91,7 +92,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/ai-builders.tsx b/apps/www/data/solutions/ai-builders.tsx index 6c98074c4a8..594169e65af 100644 --- a/apps/www/data/solutions/ai-builders.tsx +++ b/apps/www/data/solutions/ai-builders.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { Timer } from 'lucide-react' import type { @@ -39,7 +40,7 @@ const data: { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, }, { diff --git a/apps/www/data/solutions/b2b-saas.tsx b/apps/www/data/solutions/b2b-saas.tsx index 1971c2eaa00..ea9aa0971d6 100644 --- a/apps/www/data/solutions/b2b-saas.tsx +++ b/apps/www/data/solutions/b2b-saas.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { useBreakpoint } from 'common' import { Check, @@ -91,7 +92,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/beginners.tsx b/apps/www/data/solutions/beginners.tsx index fd74f32efdc..e67c94e7802 100644 --- a/apps/www/data/solutions/beginners.tsx +++ b/apps/www/data/solutions/beginners.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { useBreakpoint } from 'common' import { Check, Sparkles, Timer } from 'lucide-react' import dynamic from 'next/dynamic' @@ -69,7 +70,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/developers.tsx b/apps/www/data/solutions/developers.tsx index 2975760a26c..6b615404153 100644 --- a/apps/www/data/solutions/developers.tsx +++ b/apps/www/data/solutions/developers.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { useBreakpoint } from 'common' import { Check, @@ -85,7 +86,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/finserv.tsx b/apps/www/data/solutions/finserv.tsx index 60709494d23..32f724e4663 100644 --- a/apps/www/data/solutions/finserv.tsx +++ b/apps/www/data/solutions/finserv.tsx @@ -11,6 +11,7 @@ import { Users, UserX, } from 'lucide-react' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { PRODUCT_SHORTNAMES } from 'shared-data/products' import { Image } from 'ui-patterns/Image' @@ -90,7 +91,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/hackathon.tsx b/apps/www/data/solutions/hackathon.tsx index 7fc5f3517e5..79ff8271300 100644 --- a/apps/www/data/solutions/hackathon.tsx +++ b/apps/www/data/solutions/hackathon.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { useBreakpoint } from 'common' import { Check, InfoIcon, Sparkles, Timer } from 'lucide-react' import dynamic from 'next/dynamic' @@ -65,7 +66,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/healthcare.tsx b/apps/www/data/solutions/healthcare.tsx index c2616d4144e..6caf6f13cf0 100644 --- a/apps/www/data/solutions/healthcare.tsx +++ b/apps/www/data/solutions/healthcare.tsx @@ -10,6 +10,7 @@ import { Users, UserX, } from 'lucide-react' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { Image } from 'ui-patterns/Image' import { getSharedSections } from './shared-sections' @@ -89,7 +90,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/hosted-postgres.tsx b/apps/www/data/solutions/hosted-postgres.tsx index 4a6798134f4..0a64cbfe456 100644 --- a/apps/www/data/solutions/hosted-postgres.tsx +++ b/apps/www/data/solutions/hosted-postgres.tsx @@ -1,4 +1,5 @@ import { useBreakpoint } from 'common' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { Activity, Blocks, @@ -90,7 +91,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/innovation-teams.tsx b/apps/www/data/solutions/innovation-teams.tsx index 8c663a3a677..8171da08384 100644 --- a/apps/www/data/solutions/innovation-teams.tsx +++ b/apps/www/data/solutions/innovation-teams.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { useBreakpoint } from 'common' import { ArrowLeftRight, @@ -134,7 +135,7 @@ const data: () => { ctas: [ { label: 'Start Building', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ @@ -751,7 +752,7 @@ const data: () => { description: 'Start free with any AI builder + Supabase', cta: { label: 'Create Your First App in 5 Minutes', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, }, }, { diff --git a/apps/www/data/solutions/no-code.tsx b/apps/www/data/solutions/no-code.tsx index 5a25f77e2f3..80c5ba8c36b 100644 --- a/apps/www/data/solutions/no-code.tsx +++ b/apps/www/data/solutions/no-code.tsx @@ -1,4 +1,5 @@ import { Check, PointerIcon, TrendingUp, ZapIcon } from 'lucide-react' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import dynamic from 'next/dynamic' import { PRODUCT_SHORTNAMES } from 'shared-data/products' import { cn } from 'ui' @@ -54,7 +55,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/postgres-developers.tsx b/apps/www/data/solutions/postgres-developers.tsx index f0c8b1d6e53..0cd374acaaf 100644 --- a/apps/www/data/solutions/postgres-developers.tsx +++ b/apps/www/data/solutions/postgres-developers.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { useBreakpoint } from 'common' import { Check, @@ -85,7 +86,7 @@ const data: () => { ctas: [ { label: 'Start your project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/startups.tsx b/apps/www/data/solutions/startups.tsx index 1106a1ed28b..7c08a8e5ee6 100644 --- a/apps/www/data/solutions/startups.tsx +++ b/apps/www/data/solutions/startups.tsx @@ -1,4 +1,5 @@ import { CubeIcon } from '@heroicons/react/outline' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { useBreakpoint } from 'common' import { Check, @@ -85,7 +86,7 @@ const data: () => { ctas: [ { label: 'Get started with Supabase', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, onClick: () => sendTelemetryEvent({ diff --git a/apps/www/data/solutions/vibe-coders.tsx b/apps/www/data/solutions/vibe-coders.tsx index aac037de93b..24d6c1b6f49 100644 --- a/apps/www/data/solutions/vibe-coders.tsx +++ b/apps/www/data/solutions/vibe-coders.tsx @@ -1,4 +1,5 @@ import { useBreakpoint } from 'common' +import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links' import { Check, CheckCircle, Sparkles, Timer, Zap } from 'lucide-react' import dynamic from 'next/dynamic' import { PRODUCT_SHORTNAMES } from 'shared-data/products' @@ -62,7 +63,7 @@ const useVibeCodersContent: () => { ctas: [ { label: 'Start Your Project', - href: 'https://supabase.com/dashboard', + href: DASHBOARD_SIGN_UP_URL, type: 'primary' as any, }, ], diff --git a/apps/www/lib/dashboard-links.ts b/apps/www/lib/dashboard-links.ts new file mode 100644 index 00000000000..f31852e4b99 --- /dev/null +++ b/apps/www/lib/dashboard-links.ts @@ -0,0 +1,16 @@ +export const DASHBOARD_URL = 'https://supabase.com/dashboard' +export const DASHBOARD_SIGN_IN_URL = 'https://supabase.com/dashboard/sign-in' +export const DASHBOARD_SIGN_UP_URL = 'https://supabase.com/dashboard/sign-up' + +/** Homepage/product "Start your project" CTA: sign-up for guests, dashboard for signed-in users. */ +export function getDashboardCtaHref(isLoggedIn: boolean): string { + return isLoggedIn ? DASHBOARD_URL : DASHBOARD_SIGN_UP_URL +} + +const DASHBOARD_CTA_HREFS = new Set([DASHBOARD_URL, DASHBOARD_SIGN_UP_URL]) + +/** Rewrite static dashboard/sign-up CTA hrefs when the visitor is already signed in. */ +export function resolveDashboardCtaHref(href: string, isLoggedIn: boolean): string { + if (!DASHBOARD_CTA_HREFS.has(href)) return href + return getDashboardCtaHref(isLoggedIn) +}