Skip to content

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

Merge branch 'master' into fix/docs-site-performance

Greg Richardson85879a65b1f6
diff --cc apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx
index 968d4318a2c,6c18375038b..f936d122966
--- a/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx
@@@ -4,150 -4,20 +4,18 @@@ import Link from 'next/link
import { useRouter } from 'next/router'
import { Fragment } from 'react'
import { Badge } from '~/../../packages/ui'
-
- const home = [
- [
- {
- label: 'Home',
- icon: '/img/icons/menu/home',
- href: '/',
- level: 'home',
- },
- {
- label: 'Getting Started',
- icon: '/img/icons/menu/getting-started',
- href: '/guides/getting-started',
- level: 'gettingstarted',
- },
- ],
- [
- {
- label: 'Database',
- icon: '/img/icons/menu/database',
- href: '/guides/database',
- level: 'database',
- },
- {
- label: 'Serverless APIs',
- icon: '/img/icons/menu/reference',
- href: '/guides/api',
- level: 'api',
- },
- {
- label: 'Auth',
- icon: '/img/icons/menu/auth',
- href: '/guides/auth',
- level: 'auth',
- },
- {
- label: 'Edge Functions',
- icon: '/img/icons/menu/functions',
- href: '/guides/functions',
- level: 'functions',
- },
- {
- label: 'Realtime',
- icon: '/img/icons/menu/realtime',
- href: '/guides/realtime',
- level: 'realtime',
- },
- {
- label: 'Storage',
- icon: '/img/icons/menu/storage',
- href: '/guides/storage',
- level: 'storage',
- },
- ],
- [
- {
- label: 'Platform',
- icon: '/img/icons/menu/platform',
- href: '/guides/platform',
- level: 'platform',
- },
- {
- label: 'Resources',
- icon: '/img/icons/menu/platform',
- href: '/guides/resources',
- level: 'resources',
- },
- {
- label: 'Self-Hosting',
- icon: '/img/icons/menu/platform',
- href: '/guides/self-hosting',
- level: 'self_hosting',
- },
- {
- label: 'Integrations',
- icon: '/img/icons/menu/integrations',
- hasLightIcon: true,
- href: '/guides/integrations',
- level: 'integrations',
- },
- ],
- [
- {
- label: 'Client Library Reference',
- },
- {
- label: 'JavaScript',
- icon: '/img/icons/menu/reference-javascript',
- href: '/reference/javascript/introduction',
- level: 'reference_javascript',
- },
- {
- label: 'Flutter',
- icon: '/img/icons/menu/reference-dart',
- href: '/reference/dart/introduction',
- level: 'reference_dart',
- },
- {
- label: 'Python',
- icon: '/img/icons/menu/reference-python',
- href: '/reference/python/introduction',
- level: 'reference_python',
- community: true,
- },
- {
- label: 'C#',
- icon: '/img/icons/menu/reference-csharp',
- href: '/reference/csharp/introduction',
- level: 'reference_csharp',
- community: true,
- },
- {
- label: 'Swift',
- icon: '/img/icons/menu/reference-swift',
- href: '/reference/swift/introduction',
- level: 'reference_swift',
- community: true,
- },
- {
- label: 'Tools',
- },
- {
- label: 'Management API',
- icon: '/img/icons/menu/reference-api',
- href: '/reference/api/introduction',
- level: 'reference_javascript',
- },
- {
- label: 'Supabase CLI',
- icon: '/img/icons/menu/reference-cli',
- href: '/guides/cli',
- level: 'reference_javascript',
- },
- ],
- ]
+ import { cn } from 'ui/src/utils/cn'
+ import { HOMEPAGE_MENU_ITEMS } from './NavigationMenu.constants'
+ import HomeMenuIconPicker from './HomeMenuIconPicker'
-const NavigationMenuHome = ({ active }) => {
+const NavigationMenuHome = () => {
+ const router = useRouter()
+ const { isDarkMode } = useTheme()
+
return (
- <div
- className={[
- 'transition-all duration-150 ease-out',
- active ? 'opacity-100 ml-0 delay-150' : 'opacity-0 -ml-8 invisible absolute',
- ].join(' ')}
- >
- <ul className="relative w-full flex flex-col gap-6">
+ <div className="transition-all duration-150 ease-out opacity-100 ml-0 delay-150">
+ <ul className="relative w-full flex flex-col gap-4">
- {home.map((section, sectionIndex) => {
+ {HOMEPAGE_MENU_ITEMS.map((section, sectionIndex) => {
return (
<Fragment key={`section-container-${sectionIndex}-border`}>
{sectionIndex !== 0 && (
diff --cc apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
index 6e8abf6a477,17c8c9d91e8..60ea755c949
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
@@@ -120,8 -118,8 +118,8 @@@ const ContentLink = React.memo(functio
const router = useRouter()
return (
- <li>
+ <li className="mb-1.5">
- <Link href={`${props.url}`} passHref>
+ <Link href={props.url} passHref>
<a
className={[
'cursor-pointer transition text-sm',
@@@ -179,15 -177,17 +177,15 @@@ const Content = (props) =>
return (
<div key={x.name}>
{x.items && x.items.length > 0 ? (
- <div className="flex flex-col gap-1">
+ <div className="flex flex-col gap-2.5">
{x.items.map((subItem, subItemIndex) => {
return (
- <>
- <ContentAccordionLink
- key={subItem.name}
- subItem={subItem}
- subItemIndex={subItemIndex}
- parent={x}
- />
- </>
+ <ContentAccordionLink
+ key={subItem.name}
+ subItem={subItem}
+ subItemIndex={subItemIndex}
+ parent={x}
+ />
)
})}
</div>
diff --cc apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx
index eb352b1d7e5,1c8a5415074..f05ebca6776
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx
@@@ -1,36 -1,24 +1,22 @@@
import * as Accordion from '@radix-ui/react-accordion'
import Link from 'next/link'
import { useRouter } from 'next/router'
- import { IconChevronLeft } from 'ui'
+ import { IconChevronLeft, IconChevronUp } from 'ui'
import * as NavItems from './NavigationMenu.constants'
-import { find } from 'lodash'
-import Image from 'next/image'
import { useTheme } from 'common/Providers'
+import Image from 'next/image'
import RevVersionDropdown from '~/components/RefVersionDropdown'
import { useMenuActiveRefId } from '~/hooks/useMenuState'
-import { RefIdOptions, RefKeyOptions } from './NavigationMenu'
import React, { Fragment } from 'react'
-import { generateAllowedClientLibKeys } from '~/lib/refGenerator/helpers'
-import { isFuncNotInLibraryOrVersion } from './NavigationMenu.utils'
+import { ICommonItem, ICommonSection } from '~/components/reference/Reference.types'
+import { deepFilterSections } from './NavigationMenu.utils'
-
- const HeaderImage = React.memo(function HeaderImage(props: any) {
- const router = useRouter()
- const { isDarkMode } = useTheme()
-
- return (
- <Image
- alt={props.icon}
- width={15}
- height={15}
- src={`${router.basePath}` + `/img/icons/menu/${props.icon}${isDarkMode ? '' : '-light'}.svg`}
- />
- )
- })
+ import { cn } from 'ui/src/utils/cn'
+ import HomeMenuIconPicker from './HomeMenuIconPicker'
const HeaderLink = React.memo(function HeaderLink(props: any) {
- const router = useRouter()
-
return (
<span className={['text-base text-brand-1200 ', !props.title && 'capitalize'].join(' ')}>
{props.title ?? props.id}
@@@ -38,49 -26,65 +24,66 @@@
)
})
+interface FunctionLinkProps {
+ title: string
+ name?: string
+ id: string
+ icon?: string
+ basePath: string
+ slug: string
++ isParent?: boolean
++ isSubItem?: boolean
+}
+
const FunctionLink = React.memo(function FunctionLink({
title,
id,
icon,
- library,
+ basePath,
slug,
+ isParent = false,
+ isSubItem = false,
-}: {
- title: string
- name?: string
- id: string
- icon?: string
- product?: string
- library: string
- slug: string
- isParent: boolean
- isSubItem: boolean
-}) {
+}: FunctionLinkProps) {
const router = useRouter()
- const activeAccordianItem = useMenuActiveRefId()
-
- // check if we're on a versioned page
- let version = ''
- if (router.asPath.includes('v1')) {
- version = 'v1'
- }
+ const activeAccordionItem = useMenuActiveRefId()
- if (router.asPath.includes('v0')) {
- version = 'v0'
- }
+ const url = `${router.basePath}${basePath}/${slug}`
+ const active = activeAccordionItem === id
- const active = activeAccordianItem === id
return (
- <li key={id} className="function-link-item leading-5">
- <Link href={`/reference/${library}/${version ? version + '/' : ''}${slug}`} passHref>
- <a
- className={cn(
- 'cursor-pointer transition text-sm hover:text-scale-1200 gap-3 relative',
- isParent ? 'flex justify-between' : 'leading-3',
- active ? 'text-brand-900' : 'text-scale-1000'
- )}
- >
- {icon && <Image width={16} height={16} alt={icon} src={`${router.basePath}${icon}`} />}
- {title}
- {active && !isSubItem && (
- <div
- aria-hidden="true"
- className="absolute -left-[13px] top-0 bottom-0 w-[1px] bg-brand-1000"
- ></div>
- )}
- {isParent && (
- <IconChevronUp
- width={16}
- className="data-open-parent:rotate-0 data-closed-parent:rotate-90 transition"
- />
- )}
- </a>
- </Link>
+ <li className="function-link-item">
+ <a
+ href={url}
+ /**
+ * We don't actually want to navigate or re-render anything
+ * since ref links are all sub-sections on the same page
+ */
+ onClick={(e) => {
+ e.preventDefault()
+ history.pushState({}, '', url)
+ document.getElementById(slug)?.scrollIntoView()
+ }}
+ className={[
+ 'cursor-pointer transition text-sm hover:text-brand-900 flex gap-3',
++ isParent ? 'flex justify-between' : 'leading-3',
+ active ? 'text-brand-900' : 'text-scale-1000',
+ ].join(' ')}
+ >
+ {icon && <Image width={16} height={16} alt={icon} src={`${router.basePath}${icon}`} />}
+ {title}
++ {active && !isSubItem && (
++ <div
++ aria-hidden="true"
++ className="absolute -left-[13px] top-0 bottom-0 w-[1px] bg-brand-1000"
++ ></div>
++ )}
++ {isParent && (
++ <IconChevronUp
++ width={16}
++ className="data-open-parent:rotate-0 data-closed-parent:rotate-90 transition"
++ />
++ )}
+ </a>
</li>
)
})
@@@ -176,8 -251,9 +179,8 @@@ const NavigationMenuRefListItems = (
<span>Back to Main Menu</span>
</a>
</Link>
-
<div className="flex items-center gap-3 my-3">
- <HeaderImage icon={menu.icon} />
+ <HomeMenuIconPicker icon={menu.icon} width={21} height={21} />
<HeaderLink title={menu.title} url={menu.url} id={id} />
<RevVersionDropdown />
</div>
diff --cc apps/docs/pages/_app.tsx
index 23cd007b9fb,f2f415a6963..abde5d72106
--- a/apps/docs/pages/_app.tsx
+++ b/apps/docs/pages/_app.tsx
@@@ -1,13 -1,16 +1,13 @@@
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { SessionContextProvider } from '@supabase/auth-helpers-react'
- import { AuthProvider, ThemeProvider } from 'common'
+ import { AuthProvider, ThemeProvider, useTelemetryProps } from 'common'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
-import ReactMarkdown from 'react-markdown'
-import remarkGfm from 'remark-gfm'
import { AppPropsWithLayout } from 'types'
import { CommandMenuProvider } from 'ui'
-import components from '~/components'
import Favicons from '~/components/Favicons'
import SiteLayout from '~/layouts/SiteLayout'
- import { IS_PLATFORM, LOCAL_SUPABASE } from '~/lib/constants'
+ import { API_URL, IS_PLATFORM, LOCAL_SUPABASE } from '~/lib/constants'
import { post } from '~/lib/fetchWrappers'
import '../styles/ch.scss'
import '../styles/main.scss?v=1.0.0'