Skip to content

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

try more

Jonathan Summers-Muir2232dd133122
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
index d72d2a61158..6addb68bfd6 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
@@ -71,8 +71,6 @@ const SideNav = () => {
const router = useRouter()
const { isDarkMode } = useTheme()
- const level = useMenuLevelId()
-
console.log()
let version = ''
@@ -85,84 +83,84 @@ const SideNav = () => {
version = '_v0'
}
- function handleRouteChange(url: string) {
- switch (url) {
- case `/docs`:
- menuState.setMenuLevelId('home')
- break
- case url.includes(`/docs/guides/getting-started`) && url:
- menuState.setMenuLevelId('gettingstarted')
- break
- case url.includes(`/docs/guides/database`) && url:
- menuState.setMenuLevelId('database')
- break
- case url.includes(`/docs/guides/auth`) && url:
- menuState.setMenuLevelId('auth')
- break
- case url.includes(`/docs/guides/functions`) && url:
- menuState.setMenuLevelId('functions')
- break
- case url.includes(`/docs/guides/realtime`) && url:
- menuState.setMenuLevelId('realtime')
- break
- case url.includes(`/docs/guides/storage`) && url:
- menuState.setMenuLevelId('storage')
- break
- case url.includes(`/docs/guides/platform`) ||
- (url.includes(`/docs/guides/hosting/platform`) && url):
- menuState.setMenuLevelId('platform')
- break
- case url.includes(`/docs/guides/resources`) && url:
- menuState.setMenuLevelId('resources')
- break
- case url.includes(`/docs/guides/integrations`) && url:
- menuState.setMenuLevelId('integrations')
- break
- // JS v1
- case url.includes(`/docs/reference/javascript/v1`) && url:
- menuState.setMenuLevelId('reference_javascript_v1')
- break
- // JS v2 (latest)
- case url.includes(`/docs/reference/javascript`) && url:
- menuState.setMenuLevelId('reference_javascript_v2')
- break
- // dart v0
- case url.includes(`/docs/reference/dart/v0`) && url:
- menuState.setMenuLevelId('reference_dart_v0')
- break
- // dart v1 (latest)
- case url.includes(`/docs/reference/dart`) && url:
- menuState.setMenuLevelId('reference_dart_v1')
- break
- case url.includes(`/docs/reference/cli`) && url:
- menuState.setMenuLevelId('reference_cli')
- break
- case url.includes(`/docs/reference/api`) && url:
- menuState.setMenuLevelId('reference_api')
- break
- case url.includes(`/docs/reference/self-hosting-auth`) && url:
- menuState.setMenuLevelId('reference_self_hosting_auth')
- break
- case url.includes(`/docs/reference/self-hosting-storage`) && url:
- menuState.setMenuLevelId('reference_self_hosting_storage')
- break
- case url.includes(`/docs/reference/self-hosting-realtime`) && url:
- menuState.setMenuLevelId('reference_self_hosting_realtime')
- break
+ // function handleRouteChange(url: string) {
+ // switch (url) {
+ // case `/docs`:
+ // menuState.setMenuLevelId('home')
+ // break
+ // case url.includes(`/docs/guides/getting-started`) && url:
+ // menuState.setMenuLevelId('gettingstarted')
+ // break
+ // case url.includes(`/docs/guides/database`) && url:
+ // menuState.setMenuLevelId('database')
+ // break
+ // case url.includes(`/docs/guides/auth`) && url:
+ // menuState.setMenuLevelId('auth')
+ // break
+ // case url.includes(`/docs/guides/functions`) && url:
+ // menuState.setMenuLevelId('functions')
+ // break
+ // case url.includes(`/docs/guides/realtime`) && url:
+ // menuState.setMenuLevelId('realtime')
+ // break
+ // case url.includes(`/docs/guides/storage`) && url:
+ // menuState.setMenuLevelId('storage')
+ // break
+ // case url.includes(`/docs/guides/platform`) ||
+ // (url.includes(`/docs/guides/hosting/platform`) && url):
+ // menuState.setMenuLevelId('platform')
+ // break
+ // case url.includes(`/docs/guides/resources`) && url:
+ // menuState.setMenuLevelId('resources')
+ // break
+ // case url.includes(`/docs/guides/integrations`) && url:
+ // menuState.setMenuLevelId('integrations')
+ // break
+ // // JS v1
+ // case url.includes(`/docs/reference/javascript/v1`) && url:
+ // menuState.setMenuLevelId('reference_javascript_v1')
+ // break
+ // // JS v2 (latest)
+ // case url.includes(`/docs/reference/javascript`) && url:
+ // menuState.setMenuLevelId('reference_javascript_v2')
+ // break
+ // // dart v0
+ // case url.includes(`/docs/reference/dart/v0`) && url:
+ // menuState.setMenuLevelId('reference_dart_v0')
+ // break
+ // // dart v1 (latest)
+ // case url.includes(`/docs/reference/dart`) && url:
+ // menuState.setMenuLevelId('reference_dart_v1')
+ // break
+ // case url.includes(`/docs/reference/cli`) && url:
+ // menuState.setMenuLevelId('reference_cli')
+ // break
+ // case url.includes(`/docs/reference/api`) && url:
+ // menuState.setMenuLevelId('reference_api')
+ // break
+ // case url.includes(`/docs/reference/self-hosting-auth`) && url:
+ // menuState.setMenuLevelId('reference_self_hosting_auth')
+ // break
+ // case url.includes(`/docs/reference/self-hosting-storage`) && url:
+ // menuState.setMenuLevelId('reference_self_hosting_storage')
+ // break
+ // case url.includes(`/docs/reference/self-hosting-realtime`) && url:
+ // menuState.setMenuLevelId('reference_self_hosting_realtime')
+ // break
- default:
- break
- }
- }
+ // default:
+ // break
+ // }
+ // }
- useEffect(() => {
- handleRouteChange(router.basePath + router.asPath)
- // Listen for page changes after a navigation or when the query changes
- router.events.on('routeChangeComplete', handleRouteChange)
- return () => {
- router.events.off('routeChangeComplete', handleRouteChange)
- }
- }, [router.events])
+ // useEffect(() => {
+ // handleRouteChange(router.basePath + router.asPath)
+ // // Listen for page changes after a navigation or when the query changes
+ // router.events.on('routeChangeComplete', handleRouteChange)
+ // return () => {
+ // router.events.off('routeChangeComplete', handleRouteChange)
+ // }
+ // }, [router.events])
const home = [
[
@@ -275,9 +273,10 @@ const SideNav = () => {
<div
className={[
'transition-all duration-150 ease-out',
- level === 'home' || !level
- ? 'opacity-100 ml-0 delay-150'
- : 'opacity-0 -ml-8 invisible absolute',
+ // level === 'home' || !level
+ // ?
+ 'opacity-100 ml-0 delay-150',
+ // : 'opacity-0 -ml-8 invisible absolute',
].join(' ')}
>
<ul className="relative w-full flex flex-col gap-4">
@@ -304,7 +303,7 @@ const SideNav = () => {
)
} else {
return (
- <Link href={link.href} passHref key={link.label} shallow={true}>
+ <Link href={link.href} passHref key={link.label}>
<a>
<li
className={[
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
index 80c5fe9f422..96254f14cee 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
@@ -45,7 +45,7 @@ const NavigationMenuGuideList: React.FC<Props> = ({ id, setMenuLevelId }) => {
].join(' ')}
>
<ul className={['relative w-full flex flex-col gap-0'].join(' ')}>
- <Link href={`${menu.parent ?? '/'}`} passHref shallow={true}>
+ <Link href={`${menu.parent ?? '/'}`} passHref>
<a
className={[
'flex items-center gap-1 text-xs group mb-3',
@@ -61,7 +61,7 @@ const NavigationMenuGuideList: React.FC<Props> = ({ id, setMenuLevelId }) => {
</a>
</Link>
- <Link href={menu.url ?? ''} passHref shallow={true}>
+ <Link href={menu.url ?? ''} passHref>
<a>
<div className="flex items-center gap-3 my-3">
<Image
@@ -108,7 +108,7 @@ const NavigationMenuGuideList: React.FC<Props> = ({ id, setMenuLevelId }) => {
const LinkContainer = (props) => {
return (
- <Link href={props.url} passHref shallow={true}>
+ <Link href={props.url} passHref>
<a className={props.className}>{props.children}</a>
</Link>
)
@@ -147,7 +147,7 @@ const NavigationMenuGuideList: React.FC<Props> = ({ id, setMenuLevelId }) => {
{subItem.items.map((subSubItem, subSubItemIndex) => {
return (
<li key={subItem.name}>
- <Link href={`${subSubItem.url}`} passHref shallow={true}>
+ <Link href={`${subSubItem.url}`} passHref>
<a
className={[
'cursor-pointer transition text-sm',
@@ -172,7 +172,7 @@ const NavigationMenuGuideList: React.FC<Props> = ({ id, setMenuLevelId }) => {
) : (
<>
<li>
- <Link href={`${x.url}`} passHref shallow={true}>
+ <Link href={`${x.url}`} passHref>
<a
className={[
'cursor-pointer transition text-sm',
@@ -203,7 +203,7 @@ const NavigationMenuGuideList: React.FC<Props> = ({ id, setMenuLevelId }) => {
return (
<div key={x.name}>
<li>
- <Link href={`${x.href}`} passHref shallow={true}>
+ <Link href={`${x.href}`} passHref>
<a className="cursor-pointer transition text-scale-1100 text-sm hover:text-brand-900 flex gap-3 my-1">
{x.icon && <img className="w-4" src={`${router.basePath}${x.icon}`} />}
{x.name}
diff --git a/apps/docs/layouts/SiteRefLayout.tsx b/apps/docs/layouts/SiteRefLayout.tsx
index 783865fcf1b..2fc18390eb6 100644
--- a/apps/docs/layouts/SiteRefLayout.tsx
+++ b/apps/docs/layouts/SiteRefLayout.tsx
@@ -6,7 +6,6 @@ import NavigationMenu from '~/components/Navigation/NavigationMenu/NavigationMen
import TopNavBarRef from '~/components/Navigation/NavigationMenu/TopNavBarRef'
import FooterHelpCallout from '~/components/FooterHelpCallout'
-import { NavigationMenuContextProvider } from '~/components/Navigation/NavigationMenu/NavigationMenu.Context'
import { menuState } from '~/hooks/useMenuState'
@@ -97,218 +96,214 @@ const SiteRefLayout = ({ children }) => {
}
return (
- <NavigationMenuContextProvider activeRefItem={''} setActiveRefItem={() => {}}>
- <main>
- {/* <img
+ <main>
+ {/* <img
src={`${router.basePath}/img/gradient-bg.png`}
className="absolute left-0 w-[520px] top-0 -z-1 pointer-events-none"
/> */}
- <div className="flex flex-row h-screen">
+ <div className="flex flex-row h-screen">
+ <div
+ className={[
+ 'hidden', // experiment hidden
+ 'transition-all',
+ 'top-0',
+ 'relative',
+ 'h-screen w-[420px]',
+ 'z-10',
+ 'lg:flex flex-col ml-0',
+ ].join(' ')}
+ >
<div
className={[
- 'hidden', // experiment hidden
- 'transition-all',
'top-0',
'relative',
- 'h-screen w-[420px]',
+ 'w-auto',
'z-10',
- 'lg:flex flex-col ml-0',
+
+ 'border-r overflow-auto h-screen',
+ 'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
+ 'flex flex-col',
].join(' ')}
>
+ <div className="top-0 sticky z-10">
+ <div>
+ <div>
+ <div
+ className={[
+ 'hidden md:flex md:height-auto',
+ 'pt-8 bg-scale-200 flex-col gap-8',
+ ].join(' ')}
+ >
+ <Link href="/">
+ <a className="px-10 flex items-center gap-2">
+ <Image
+ className="cursor-pointer"
+ src={isDarkMode ? '/docs/supabase-dark.svg' : '/docs/supabase-light.svg'}
+ width={96}
+ height={24}
+ alt="Supabase Logo"
+ />
+ <span className="font-mono text-sm font-medium text-brand-900">DOCS</span>
+ </a>
+ </Link>
+ {/* {router.asPath.includes('/reference/') && <RefSwitcher />} */}
+ </div>
+ <div className="h-4 bg-scale-200 w-full"></div>
+ <div className="bg-gradient-to-b from-scale-200 to-transparent h-4 w-full"></div>
+ </div>
+ </div>
+ </div>
+ <div className={['pb-10 px-5 md:px-10 md:flex'].join(' ')}>
+ <NavigationMenu />
+ </div>
+ </div>
+ </div>
+ <div
+ // #docs-content-container is used by layout to scroll to top
+ id="docs-content-container"
+ className={[
+ 'w-full h-screen transition-all ease-out',
+ mobileMenuOpen ? 'overflow-hidden' : 'overflow-auto',
+ ].join(' ')}
+ >
+ <div className="flex flex-col relative">
+ {/* <NavigationMenu /> */}
+ <div className={['lg:sticky top-0 z-10 overflow-hidden'].join(' ')}>
+ <TopNavBarRef />
+ </div>
<div
className={[
- 'top-0',
- 'relative',
- 'w-auto',
+ 'sticky transition-all top-0',
'z-10',
-
- 'border-r overflow-auto h-screen',
'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
- 'flex flex-col',
].join(' ')}
>
- <div className="top-0 sticky z-10">
- <div>
- <div>
+ <div className={['lg:hidden', 'px-5 ', 'border-b z-10'].join(' ')}>
+ <div
+ className={[
+ 'transition-all ease-out z-10',
+ 'top-0',
+ mobileMenuOpen && 'absolute',
+ 'flex items-center h-[40px]',
+ mobileMenuOpen ? 'gap-0' : 'gap-3',
+ ].join(' ')}
+ >
+ <button
+ className={['mr-2', mobileMenuOpen && 'mt-0.5'].join(' ')}
+ onClick={() => menuState.setMenuMobileOpen(!mobileMenuOpen)}
+ >
<div
className={[
- 'hidden md:flex md:height-auto',
- 'pt-8 bg-scale-200 flex-col gap-8',
+ 'space-y-1 group cursor-pointer relative',
+ mobileMenuOpen ? 'w-4 h-4' : 'w-4 h-[8px]',
].join(' ')}
>
- <Link href="/">
- <a className="px-10 flex items-center gap-2">
- <Image
- className="cursor-pointer"
- src={
- isDarkMode ? '/docs/supabase-dark.svg' : '/docs/supabase-light.svg'
- }
- width={96}
- height={24}
- alt="Supabase Logo"
- />
- <span className="font-mono text-sm font-medium text-brand-900">DOCS</span>
- </a>
- </Link>
- {/* {router.asPath.includes('/reference/') && <RefSwitcher />} */}
- </div>
- <div className="h-4 bg-scale-200 w-full"></div>
- <div className="bg-gradient-to-b from-scale-200 to-transparent h-4 w-full"></div>
- </div>
- </div>
- </div>
- <div className={['pb-10 px-5 md:px-10 md:flex'].join(' ')}>
- <NavigationMenu />
- </div>
- </div>
- </div>
- <div
- // #docs-content-container is used by layout to scroll to top
- id="docs-content-container"
- className={[
- 'w-full h-screen transition-all ease-out',
- mobileMenuOpen ? 'overflow-hidden' : 'overflow-auto',
- ].join(' ')}
- >
- <div className="flex flex-col relative">
- {/* <NavigationMenu /> */}
- <div className={['lg:sticky top-0 z-10 overflow-hidden'].join(' ')}>
- <TopNavBarRef />
- </div>
- <div
- className={[
- 'sticky transition-all top-0',
- 'z-10',
- 'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
- ].join(' ')}
- >
- <div className={['lg:hidden', 'px-5 ', 'border-b z-10'].join(' ')}>
- <div
- className={[
- 'transition-all ease-out z-10',
- 'top-0',
- mobileMenuOpen && 'absolute',
- 'flex items-center h-[40px]',
- mobileMenuOpen ? 'gap-0' : 'gap-3',
- ].join(' ')}
- >
- <button
- className={['mr-2', mobileMenuOpen && 'mt-0.5'].join(' ')}
- onClick={() => menuState.setMenuMobileOpen(!mobileMenuOpen)}
- >
- <div
+ <span
className={[
- 'space-y-1 group cursor-pointer relative',
- mobileMenuOpen ? 'w-4 h-4' : 'w-4 h-[8px]',
+ 'transition-all ease-out block w-4 h-px bg-scale-900 group-hover:bg-scale-1200',
+ !mobileMenuOpen ? 'w-4' : 'absolute rotate-45 top-[6px]',
].join(' ')}
- >
- <span
- className={[
- 'transition-all ease-out block w-4 h-px bg-scale-900 group-hover:bg-scale-1200',
- !mobileMenuOpen ? 'w-4' : 'absolute rotate-45 top-[6px]',
- ].join(' ')}
- ></span>
- <span
- className={[
- 'transition-all ease-out block h-px bg-scale-900 group-hover:bg-scale-1200',
- !mobileMenuOpen
- ? 'w-3 group-hover:w-4'
- : 'absolute w-4 -rotate-45 top-[2px]',
- ].join(' ')}
- ></span>
- </div>
- </button>
- <div className={[].join(' ')}>
- <img
- src={
- menuLevel
- ? levelsData[menuLevel].icon + '.svg'
- : levelsData['home'].icon + '.svg'
- }
+ ></span>
+ <span
className={[
- 'transition-all duration-200',
- mobileMenuOpen ? 'invisible w-0 h-0' : 'w-4 h-4',
+ 'transition-all ease-out block h-px bg-scale-900 group-hover:bg-scale-1200',
+ !mobileMenuOpen
+ ? 'w-3 group-hover:w-4'
+ : 'absolute w-4 -rotate-45 top-[2px]',
].join(' ')}
- />
+ ></span>
</div>
- <span
+ </button>
+ <div className={[].join(' ')}>
+ <img
+ src={
+ menuLevel
+ ? levelsData[menuLevel].icon + '.svg'
+ : levelsData['home'].icon + '.svg'
+ }
className={[
'transition-all duration-200',
- 'text-scale-1200',
- mobileMenuOpen ? 'text-xs' : 'text-sm',
+ mobileMenuOpen ? 'invisible w-0 h-0' : 'w-4 h-4',
].join(' ')}
- >
- {mobileMenuOpen
- ? 'Close'
- : menuLevel
- ? levelsData[menuLevel].name
- : levelsData['home'].name}
- </span>
+ />
</div>
- <div
+ <span
className={[
- 'transition-all ease-out duration-200',
- 'absolute left-0 right-0 h-screen',
- 'px-5 pl-5 py-16',
- 'top-[0px]',
- 'bg-scale-200',
- mobileMenuOpen
- ? 'overflow-y-auto opacity-100 left-[0px] visible'
- : 'left-[-40px] h-0 opacity-0 invisible',
+ 'transition-all duration-200',
+ 'text-scale-1200',
+ mobileMenuOpen ? 'text-xs' : 'text-sm',
].join(' ')}
>
- <NavigationMenu />
- </div>
+ {mobileMenuOpen
+ ? 'Close'
+ : menuLevel
+ ? levelsData[menuLevel].name
+ : levelsData['home'].name}
+ </span>
</div>
- </div>
- <div className="grow px-5 max-w-7xl mx-auto py-16">
- {children}
-
- <div className="mt-32">
- <FooterHelpCallout />
+ <div
+ className={[
+ 'transition-all ease-out duration-200',
+ 'absolute left-0 right-0 h-screen',
+ 'px-5 pl-5 py-16',
+ 'top-[0px]',
+ 'bg-scale-200',
+ mobileMenuOpen
+ ? 'overflow-y-auto opacity-100 left-[0px] visible'
+ : 'left-[-40px] h-0 opacity-0 invisible',
+ ].join(' ')}
+ >
+ <NavigationMenu />
</div>
- <hr className="border-scale-400 mt-8"></hr>
- <div className="flex flex-col lg:flex-row gap-3 mt-6">
- <span className="text-xs text-scale-900">Supabase 2022</span>
- <span className="text-xs text-scale-900">—</span>
- <Link href="/handbook/contributing">
- <a className="text-xs text-scale-800 hover:underline">Contributing</a>
- </Link>
- <Link href="https://supabase.com/changelog">
- <a className="text-xs text-scale-800 hover:underline">Changelog</a>
- </Link>
+ </div>
+ </div>
+ <div className="grow px-5 max-w-7xl mx-auto py-16">
+ {children}
- <Link href="https://github.com/supabase/supabase/blob/master/DEVELOPERS.md">
- <a className="text-xs text-scale-800 hover:underline">Author Styleguide</a>
- </Link>
- <Link href="https://supabase.com/docs/oss">
- <a className="text-xs text-scale-800 hover:underline">Open Source</a>
- </Link>
- <Link href="https://supabase.com/docs/handbook/supasquad">
- <a className="text-xs text-scale-800 hover:underline">Supasquad</a>
- </Link>
- </div>
+ <div className="mt-32">
+ <FooterHelpCallout />
</div>
+ <hr className="border-scale-400 mt-8"></hr>
+ <div className="flex flex-col lg:flex-row gap-3 mt-6">
+ <span className="text-xs text-scale-900">Supabase 2022</span>
+ <span className="text-xs text-scale-900">—</span>
+ <Link href="/handbook/contributing">
+ <a className="text-xs text-scale-800 hover:underline">Contributing</a>
+ </Link>
+ <Link href="https://supabase.com/changelog">
+ <a className="text-xs text-scale-800 hover:underline">Changelog</a>
+ </Link>
- <div
- className={[
- // 'top-0 left-0',
- 'hidden', // experiment hidden
- 'h-full',
- 'left-0',
- 'right-0',
- 'z-10',
- 'backdrop-blur-sm backdrop-filter bg-white-1200 dark:bg-blackA-600',
- mobileMenuOpen ? 'absolute MOBILE-MENU-OPEN' : 'hidden h-0 MOBILE-MENU-CLOSED',
- ].join(' ')}
- onClick={() => menuState.setMenuMobileOpen(!mobileMenuOpen)}
- ></div>
+ <Link href="https://github.com/supabase/supabase/blob/master/DEVELOPERS.md">
+ <a className="text-xs text-scale-800 hover:underline">Author Styleguide</a>
+ </Link>
+ <Link href="https://supabase.com/docs/oss">
+ <a className="text-xs text-scale-800 hover:underline">Open Source</a>
+ </Link>
+ <Link href="https://supabase.com/docs/handbook/supasquad">
+ <a className="text-xs text-scale-800 hover:underline">Supasquad</a>
+ </Link>
+ </div>
</div>
+
+ <div
+ className={[
+ // 'top-0 left-0',
+ 'hidden', // experiment hidden
+ 'h-full',
+ 'left-0',
+ 'right-0',
+ 'z-10',
+ 'backdrop-blur-sm backdrop-filter bg-white-1200 dark:bg-blackA-600',
+ mobileMenuOpen ? 'absolute MOBILE-MENU-OPEN' : 'hidden h-0 MOBILE-MENU-CLOSED',
+ ].join(' ')}
+ onClick={() => menuState.setMenuMobileOpen(!mobileMenuOpen)}
+ ></div>
</div>
</div>
- </main>
- </NavigationMenuContextProvider>
+ </div>
+ </main>
)
}
diff --git a/apps/docs/layouts/guides/archived.tsx b/apps/docs/layouts/guides/archived.tsx
deleted file mode 100644
index 7ec09aaebfc..00000000000
--- a/apps/docs/layouts/guides/archived.tsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import { MDXProvider } from '@mdx-js/react'
-import { NextSeo } from 'next-seo'
-import { useRouter } from 'next/router'
-import { FC, useEffect, useRef, useState } from 'react'
-import components from '~/components'
-import Footer from '~/components/Footer'
-import GuidesTableOfContents from '~/components/GuidesTableOfContents'
-import NavBar from '~/components/Navigation/NavBar'
-import { menuItems } from '~/components/Navigation/Navigation.constants'
-import SideBar from '~/components/Navigation/SideBar'
-import { getPageType } from '~/lib/helpers'
-
-interface Props {
- meta: { title: string; description?: string; hide_table_of_contents?: boolean }
- children: any
- toc?: any
- currentPage?: string
-}
-
-const Layout: FC<Props> = ({ meta, children }) => {
- const { asPath } = useRouter()
- const page = getPageType(asPath)
-
- useEffect(() => {
- const key = localStorage.getItem('supabaseDarkMode')
- if (!key) {
- // Default to dark mode if no preference config
- document.documentElement.className = 'dark'
- } else {
- document.documentElement.className = key === 'true' ? 'dark' : ''
- }
- }, [])
-
- const articleRef = useRef()
- const [tocList, setTocList] = useState([])
-
- useEffect(() => {
- const articleEl = articleRef.current as HTMLElement
-
- if (!articleRef.current) return
- const headings = Array.from(articleEl.querySelectorAll('h2, h3'))
- const newHeadings = headings
- .filter((heading) => heading.id)
- .map((heading) => {
- const text = heading.textContent.replace('#', '')
- const link = heading.querySelector('a').getAttribute('href')
- const level = heading.tagName === 'H2' ? 2 : 3
- return { text, link, level }
- })
- setTocList(newHeadings)
- }, [])
-
- const hasTableOfContents = tocList.length > 0
-
- return (
- <>
- <NextSeo
- title={`${meta?.title} | Supabase`}
- description={meta?.description ? meta?.description : meta?.title}
- openGraph={{
- title: meta?.title,
- description: meta?.description,
- url: `https://supabase.com/docs${asPath}`,
- images: [
- {
- url: `https://supabase.com/docs/img/supabase-og-image.png`,
- },
- ],
- }}
- />
-
- <main>
- <NavBar
- // currentPage={page}
- />
- <div className="flex w-full flex-row">
- <SideBar menuItems={menuItems[page]} />
- <div className="main-content-pane docs-width grid md:grid-cols-12 gap-4 justify-between p-4 pb-8 w-full">
- <div
- className={`${
- meta?.hide_table_of_contents || !hasTableOfContents
- ? 'col-span-12 xl:col-start-2 xl:col-span-10 2xl:col-start-3 2xl:col-span-8'
- : 'col-span-12 lg:col-span-9'
- } py-2 lg:py-4 px-2 lg:px-8 mx-auto`}
- >
- <article
- ref={articleRef}
- className={`${
- meta?.hide_table_of_contents || !hasTableOfContents ? 'xl:min-w-[880px]' : ''
- } doc-content-container prose dark:prose-dark dark:bg-scale-200 width-full mt-8 2xl:max-w-[880px]`}
- >
- {meta?.title && <h1>{meta.title}</h1>}
- <MDXProvider components={components}>{children}</MDXProvider>
- </article>
- </div>
- {hasTableOfContents && !meta?.hide_table_of_contents && (
- <div
- className={[
- 'border-scale-400 dark:bg-scale-200 table-of-contents-height border-l',
- 'thin-scrollbar overflow-y-auto sticky hidden xl:block md:col-span-3 px-2',
- ].join(' ')}
- >
- <GuidesTableOfContents list={tocList} />
- </div>
- )}
- </div>
- </div>
- <Footer />
- </main>
- </>
- )
-}
-
-export default Layout
diff --git a/apps/docs/layouts/guides/current.tsx b/apps/docs/layouts/guides/current.tsx
deleted file mode 100644
index 3d583c453f9..00000000000
--- a/apps/docs/layouts/guides/current.tsx
+++ /dev/null
@@ -1,143 +0,0 @@
-import { MDXProvider } from '@mdx-js/react'
-import { NextSeo } from 'next-seo'
-import { useRouter } from 'next/router'
-import { FC, useEffect, useRef, useState } from 'react'
-import components from '~/components'
-import { highlightSelectedTocItem } from '~/components/CustomHTMLElements/CustomHTMLElements.utils'
-import GuidesTableOfContents from '~/components/GuidesTableOfContents'
-import useHash from '~/hooks/useHash'
-import { getPageType } from '~/lib/helpers'
-
-interface Props {
- meta: {
- title: string
- description?: string
- hide_table_of_contents?: boolean
- breadcrumb?: string
- subtitle?: string
- }
- children: any
- toc?: any
- currentPage?: string
- hideToc?: boolean
-}
-
-const Layout: FC<Props> = (props) => {
- const [hash] = useHash()
- const [active, setActive] = useState(false)
-
- const articleRef = useRef()
- const [tocList, setTocList] = useState([])
-
- const { asPath } = useRouter()
- const page = getPageType(asPath)
-
- useEffect(() => {
- const key = localStorage.getItem('supabaseDarkMode')
- if (!key) {
- // Default to dark mode if no preference config
- document.documentElement.className = 'dark'
- } else {
- document.documentElement.className = key === 'true' ? 'dark' : ''
- }
- }, [])
-
- useEffect(() => {
- if (hash && tocList.length > 0) {
- highlightSelectedTocItem(hash as string)
- }
- }, [hash, JSON.stringify(tocList)])
-
- useEffect(() => {
- const articleEl = articleRef.current as HTMLElement
-
- if (!articleRef.current) return
- const headings = Array.from(articleEl.querySelectorAll('h2, h3'))
- const newHeadings = headings
- .filter((heading) => heading.id)
- .map((heading) => {
- const text = heading.textContent.replace('#', '')
- const link = heading.querySelector('a').getAttribute('href')
- const level = heading.tagName === 'H2' ? 2 : 3
- return { text, link, level }
- })
- setTocList(newHeadings)
- }, [])
-
- useEffect(() => {
- setTimeout(function () {
- setActive(true)
- }, 150)
- }, [])
-
- const hasTableOfContents = tocList.length > 0
-
- return (
- <>
- <NextSeo
- title={`${props.meta?.title} | Supabase`}
- description={props.meta?.description ? props.meta?.description : props.meta?.title}
- openGraph={{
- title: props.meta?.title,
- description: props.meta?.description,
- url: `https://supabase.com/docs${asPath}`,
- images: [
- {
- url: `https://supabase.com/docs/img/supabase-og-image.png`,
- },
- ],
- }}
- />
-
- <div className={['grid grid-cols-12 relative'].join(' ')}>
- <div
- className={[
- 'relative',
- !props.hideToc ? 'col-span-12 md:col-span-9' : 'col-span-12',
- 'transition-all ease-out',
- 'duration-100',
- active ? 'opacity-100 left-0' : 'opacity-0 left-6',
- ].join(' ')}
- >
- {props.meta.breadcrumb && (
- <p className="text-brand-900 tracking-wider mb-3">{props.meta.breadcrumb}</p>
- )}
- <article
- ref={articleRef}
- className={`${
- props.meta?.hide_table_of_contents || !hasTableOfContents ? '' : ''
- } prose dark:prose-dark max-w-none`}
- >
- <h1 className="mb-0">{props.meta.title}</h1>
- {props.meta.subtitle && (
- <h2 className="mt-3 text-xl text-scale-1100">{props.meta.subtitle}</h2>
- )}
- <div className="max-w-xs w-32 h-[1px] bg-gradient-to-r from-brand-800 to-brand-900 my-8"></div>
- <MDXProvider components={components}>{props.children}</MDXProvider>
- </article>
- </div>
- {!props.hideToc && hasTableOfContents && !props.meta?.hide_table_of_contents && (
- <div
- className={[
- 'col-span-3',
- 'border-scale-400 dark:bg-scale-200 table-of-contents-height',
- 'thin-scrollbar overflow-y-auto sticky hidden md:block md:col-span-3 px-2',
- 'transition-all ease-out',
- 'duration-100',
- active ? 'opacity-100 left-0' : 'opacity-0 left-6',
- ].join(' ')}
- >
- <div className="border-l">
- <span className="block font-mono text-xs uppercase text-scale-1200 px-5 mb-6">
- On this page
- </span>
- <GuidesTableOfContents list={tocList} />
- </div>
- </div>
- )}
- </div>
- </>
- )
-}
-
-export default Layout
diff --git a/apps/docs/layouts/guides/index.tsx b/apps/docs/layouts/guides/index.tsx
index 59a33376068..99a70d0cd34 100644
--- a/apps/docs/layouts/guides/index.tsx
+++ b/apps/docs/layouts/guides/index.tsx
@@ -1,23 +1,143 @@
-import NewLayout from './current'
-import OldLayout from './archived'
-import { FC } from 'react'
+import { MDXProvider } from '@mdx-js/react'
+import { NextSeo } from 'next-seo'
+import { useRouter } from 'next/router'
+import { FC, useEffect, useRef, useState } from 'react'
+import components from '~/components'
+import { highlightSelectedTocItem } from '~/components/CustomHTMLElements/CustomHTMLElements.utils'
+import GuidesTableOfContents from '~/components/GuidesTableOfContents'
+import useHash from '~/hooks/useHash'
+import { getPageType } from '~/lib/helpers'
interface Props {
- meta: { title: string; description?: string; hide_table_of_contents?: boolean; video?: string }
+ meta: {
+ title: string
+ description?: string
+ hide_table_of_contents?: boolean
+ breadcrumb?: string
+ subtitle?: string
+ }
children: any
toc?: any
currentPage?: string
+ hideToc?: boolean
}
const Layout: FC<Props> = (props) => {
- switch (process.env.NEXT_PUBLIC_NEW_DOCS) {
- case 'true':
- return NewLayout(props)
- break
- default:
- return OldLayout(props)
- break
- }
+ const [hash] = useHash()
+ const [active, setActive] = useState(false)
+
+ const articleRef = useRef()
+ const [tocList, setTocList] = useState([])
+
+ const { asPath } = useRouter()
+ const page = getPageType(asPath)
+
+ useEffect(() => {
+ const key = localStorage.getItem('supabaseDarkMode')
+ if (!key) {
+ // Default to dark mode if no preference config
+ document.documentElement.className = 'dark'
+ } else {
+ document.documentElement.className = key === 'true' ? 'dark' : ''
+ }
+ }, [])
+
+ useEffect(() => {
+ if (hash && tocList.length > 0) {
+ highlightSelectedTocItem(hash as string)
+ }
+ }, [hash, JSON.stringify(tocList)])
+
+ useEffect(() => {
+ const articleEl = articleRef.current as HTMLElement
+
+ if (!articleRef.current) return
+ const headings = Array.from(articleEl.querySelectorAll('h2, h3'))
+ const newHeadings = headings
+ .filter((heading) => heading.id)
+ .map((heading) => {
+ const text = heading.textContent.replace('#', '')
+ const link = heading.querySelector('a').getAttribute('href')
+ const level = heading.tagName === 'H2' ? 2 : 3
+ return { text, link, level }
+ })
+ setTocList(newHeadings)
+ }, [])
+
+ useEffect(() => {
+ setTimeout(function () {
+ setActive(true)
+ }, 150)
+ }, [])
+
+ const hasTableOfContents = tocList.length > 0
+
+ return (
+ <>
+ <NextSeo
+ title={`${props.meta?.title} | Supabase`}
+ description={props.meta?.description ? props.meta?.description : props.meta?.title}
+ openGraph={{
+ title: props.meta?.title,
+ description: props.meta?.description,
+ url: `https://supabase.com/docs${asPath}`,
+ images: [
+ {
+ url: `https://supabase.com/docs/img/supabase-og-image.png`,
+ },
+ ],
+ }}
+ />
+
+ <div className={['grid grid-cols-12 relative'].join(' ')}>
+ <div
+ className={[
+ 'relative',
+ !props.hideToc ? 'col-span-12 md:col-span-9' : 'col-span-12',
+ 'transition ease-out',
+ 'duration-50',
+ active ? 'opacity-100 left-0' : 'opacity-0 left-6',
+ ].join(' ')}
+ >
+ {props.meta.breadcrumb && (
+ <p className="text-brand-900 tracking-wider mb-3">{props.meta.breadcrumb}</p>
+ )}
+ <article
+ ref={articleRef}
+ className={`${
+ props.meta?.hide_table_of_contents || !hasTableOfContents ? '' : ''
+ } prose dark:prose-dark max-w-none`}
+ >
+ <h1 className="mb-0">{props.meta.title}</h1>
+ {props.meta.subtitle && (
+ <h2 className="mt-3 text-xl text-scale-1100">{props.meta.subtitle}</h2>
+ )}
+ <div className="max-w-xs w-32 h-[1px] bg-gradient-to-r from-brand-800 to-brand-900 my-8"></div>
+ <MDXProvider components={components}>{props.children}</MDXProvider>
+ </article>
+ </div>
+ {!props.hideToc && hasTableOfContents && !props.meta?.hide_table_of_contents && (
+ <div
+ className={[
+ 'col-span-3',
+ 'border-scale-400 dark:bg-scale-200 table-of-contents-height',
+ 'thin-scrollbar overflow-y-auto sticky hidden md:block md:col-span-3 px-2',
+ 'transition-all ease-out',
+ 'duration-100',
+ active ? 'opacity-100 left-0' : 'opacity-0 left-6',
+ ].join(' ')}
+ >
+ <div className="border-l">
+ <span className="block font-mono text-xs uppercase text-scale-1200 px-5 mb-6">
+ On this page
+ </span>
+ <GuidesTableOfContents list={tocList} />
+ </div>
+ </div>
+ )}
+ </div>
+ </>
+ )
}
export default Layout