Skip to content

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

Move pricing page to app router (#42425)

Terry Sutton3f828ff8f5a8
diff --git a/apps/www/pages/pricing.tsx b/apps/www/app/pricing/PricingContent.tsx
similarity index 81%
rename from apps/www/pages/pricing.tsx
rename to apps/www/app/pricing/PricingContent.tsx
index e3b5dfd47e7..56ec66b8390 100644
--- a/apps/www/pages/pricing.tsx
+++ b/apps/www/app/pricing/PricingContent.tsx
@@ -1,8 +1,9 @@
+'use client'
+
import { ArrowDownIcon } from '@heroicons/react/outline'
import { ArrowUpRight } from 'lucide-react'
-import { NextSeo } from 'next-seo'
import dynamic from 'next/dynamic'
-import { useRouter } from 'next/router'
+import { usePathname } from 'next/navigation'
import { useEffect } from 'react'
import { Button } from 'ui'
@@ -17,13 +18,8 @@ const PricingFAQs = dynamic(() => import('~/components/Pricing/PricingFAQs'))
const CTABanner = dynamic(() => import('~/components/CTABanner'))
const PricingDiskSection = dynamic(() => import('~/components/Pricing/PricingDiskSection'))
-export default function IndexPage() {
- const router = useRouter()
- const { asPath } = useRouter()
-
- const meta_title = 'Pricing & Fees | Supabase'
- const meta_description =
- 'Explore Supabase fees and pricing information. Find our competitive pricing Plans, with no hidden pricing. We have a generous Free Plan for those getting started, and Pay As You Go for those scaling up.'
+export default function PricingContent() {
+ const pathname = usePathname()
// Ability to scroll into pricing sections like storage
useEffect(() => {
@@ -32,7 +28,7 @@ export default function IndexPage() {
* on both mobile and desktop. To handle both cases, we actually need to check screen size
*/
- const hash = asPath.split('#')[1]
+ const hash = window.location.hash.slice(1)
if (!hash) return
let device = 'desktop'
@@ -44,28 +40,13 @@ export default function IndexPage() {
if (element) {
element.scrollIntoView({ behavior: 'smooth' })
}
- }, [asPath])
+ }, [pathname])
const { isLoading, organizations } = useOrganizations()
const hasExistingOrganizations = !isLoading && organizations.length > 0
return (
<DefaultLayout>
- <NextSeo
- title={meta_title}
- description={meta_description}
- openGraph={{
- title: meta_title,
- description: meta_description,
- url: `https://supabase.com/${router.pathname}`,
- images: [
- {
- url: `https://supabase.com/images/og/supabase-og.png`,
- },
- ],
- }}
- />
-
<div className="relative z-10 pt-8 pb-4 xl:py-16">
<div className="mx-auto max-w-7xl px-8 text-center sm:px-6 lg:px-8">
<div className="mx-auto max-w-3xl space-y-2 lg:max-w-none">
diff --git a/apps/www/app/pricing/page.tsx b/apps/www/app/pricing/page.tsx
new file mode 100644
index 00000000000..4c147170a10
--- /dev/null
+++ b/apps/www/app/pricing/page.tsx
@@ -0,0 +1,23 @@
+import type { Metadata } from 'next'
+import PricingContent from './PricingContent'
+
+export const metadata: Metadata = {
+ title: 'Pricing & Fees | Supabase',
+ description:
+ 'Explore Supabase fees and pricing information. Find our competitive pricing Plans, with no hidden pricing. We have a generous Free Plan for those getting started, and Pay As You Go for those scaling up.',
+ openGraph: {
+ title: 'Pricing & Fees | Supabase',
+ description:
+ 'Explore Supabase fees and pricing information. Find our competitive pricing Plans, with no hidden pricing. We have a generous Free Plan for those getting started, and Pay As You Go for those scaling up.',
+ url: 'https://supabase.com/pricing',
+ images: [
+ {
+ url: 'https://supabase.com/images/og/supabase-og.png',
+ },
+ ],
+ },
+}
+
+export default function PricingPage() {
+ return <PricingContent />
+}
diff --git a/apps/www/components/CTABanner/index.tsx b/apps/www/components/CTABanner/index.tsx
index fe1ca3e4af0..e4394884c88 100644
--- a/apps/www/components/CTABanner/index.tsx
+++ b/apps/www/components/CTABanner/index.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import Link from 'next/link'
import { Button, cn } from 'ui'
import { useSendTelemetryEvent } from '~/lib/telemetry'
diff --git a/apps/www/components/Pricing/ComputePricingCalculator.tsx b/apps/www/components/Pricing/ComputePricingCalculator.tsx
index a74ac6aeb79..d6759d610c5 100644
--- a/apps/www/components/Pricing/ComputePricingCalculator.tsx
+++ b/apps/www/components/Pricing/ComputePricingCalculator.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { InformationCircleIcon } from '@heroicons/react/outline'
import { ChevronDown, Plus, Trash2 } from 'lucide-react'
import { useEffect, useState } from 'react'
diff --git a/apps/www/components/Pricing/CostControlAnimation.tsx b/apps/www/components/Pricing/CostControlAnimation.tsx
index bdbb8d41df4..4ba7ce83233 100644
--- a/apps/www/components/Pricing/CostControlAnimation.tsx
+++ b/apps/www/components/Pricing/CostControlAnimation.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import React, { FC, useRef, useState } from 'react'
import { AnimatePresence, motion, useInView } from 'framer-motion'
import { Switch, cn } from 'ui'
diff --git a/apps/www/components/Pricing/PricingAddOnTable.tsx b/apps/www/components/Pricing/PricingAddOnTable.tsx
index df99dcd555d..c71f402f454 100644
--- a/apps/www/components/Pricing/PricingAddOnTable.tsx
+++ b/apps/www/components/Pricing/PricingAddOnTable.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import classNames from 'classnames'
import { Fragment, useMemo, useState } from 'react'
import { Collapsible } from 'ui'
diff --git a/apps/www/components/Pricing/PricingAddons.tsx b/apps/www/components/Pricing/PricingAddons.tsx
index b297f5add6d..126502e28b4 100644
--- a/apps/www/components/Pricing/PricingAddons.tsx
+++ b/apps/www/components/Pricing/PricingAddons.tsx
@@ -1,8 +1,9 @@
+'use client'
+
import { ArrowUpRight } from 'lucide-react'
import { useTheme } from 'next-themes'
import Image from 'next/image'
import Link from 'next/link'
-import { useRouter } from 'next/router'
import { FC } from 'react'
import { Button, cn } from 'ui'
import CostControlAnimation from './CostControlAnimation'
@@ -63,8 +64,8 @@ const PricingAddons: FC = () => {
}
const AddonCard = ({ addon }: any) => {
- const { basePath } = useRouter()
const { resolvedTheme } = useTheme()
+ const basePath = '' // basePath is empty string in next.config.mjs
const isHighlightCard = addon.id === 'addon-cost-control'
diff --git a/apps/www/components/Pricing/PricingComparisonTable.tsx b/apps/www/components/Pricing/PricingComparisonTable.tsx
index d7f0349c955..7927185388e 100644
--- a/apps/www/components/Pricing/PricingComparisonTable.tsx
+++ b/apps/www/components/Pricing/PricingComparisonTable.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import Link from 'next/link'
import { useState } from 'react'
diff --git a/apps/www/components/Pricing/PricingComputeAnimation.tsx b/apps/www/components/Pricing/PricingComputeAnimation.tsx
index aee319c2ecb..fc4b1099295 100644
--- a/apps/www/components/Pricing/PricingComputeAnimation.tsx
+++ b/apps/www/components/Pricing/PricingComputeAnimation.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useBreakpoint } from 'common'
import { useTheme } from 'next-themes'
import Image from 'next/image'
diff --git a/apps/www/components/Pricing/PricingComputeSection.tsx b/apps/www/components/Pricing/PricingComputeSection.tsx
index 5b4ed2e3126..3b36361e95c 100644
--- a/apps/www/components/Pricing/PricingComputeSection.tsx
+++ b/apps/www/components/Pricing/PricingComputeSection.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import React, { useEffect, useRef, useState } from 'react'
import Link from 'next/link'
import { ChevronDownIcon } from '@heroicons/react/outline'
diff --git a/apps/www/components/Pricing/PricingPlans.tsx b/apps/www/components/Pricing/PricingPlans.tsx
index fc5c42fb5a2..d1367158c90 100644
--- a/apps/www/components/Pricing/PricingPlans.tsx
+++ b/apps/www/components/Pricing/PricingPlans.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import Link from 'next/link'
import { Check } from 'lucide-react'
diff --git a/apps/www/components/Pricing/UpgradePlan.tsx b/apps/www/components/Pricing/UpgradePlan.tsx
index d2603f81013..56dfb70a48e 100644
--- a/apps/www/components/Pricing/UpgradePlan.tsx
+++ b/apps/www/components/Pricing/UpgradePlan.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { Check, ChevronsUpDown, Plus } from 'lucide-react'
import Link from 'next/link'
import { useState } from 'react'