Skip to content

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

moved all guides to be on /docs. removing the temp path

Jonathan Summers-Muir4316e9629c73
diff --git a/apps/docs/components/GuidesTableOfContents.tsx b/apps/docs/components/GuidesTableOfContents.tsx
index eefa3b085b1..83872a1ff6b 100644
--- a/apps/docs/components/GuidesTableOfContents.tsx
+++ b/apps/docs/components/GuidesTableOfContents.tsx
@@ -41,7 +41,7 @@ interface Props {
const GuidesTableOfContents: FC<Props> = ({ list }) => {
return (
- <ul className="toc-menu list-none pl-4 text-[0.8rem] grid gap-2 mt-12">
+ <ul className="toc-menu list-none pl-5 text-[0.8rem] grid gap-2">
{list.map((item, i) => (
<li key={`${item.level}-${i}`} className={item.level === 3 ? 'ml-4' : ''}>
<a
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
index 5dbb79fa862..f7fb8c6ca6a 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
@@ -54,45 +54,50 @@ export const tutorials = {
{
name: 'Javascript',
items: [
- { name: 'React', url: '/guides/with-react', items: [], icon: '/img/icons/react-icon.svg' },
+ {
+ name: 'React',
+ url: '/guides/tutorials/with-react',
+ items: [],
+ icon: '/img/icons/react-icon.svg',
+ },
{
name: 'Next.js',
- url: '/guides/with-nextjs',
+ url: '/guides/tutorials/with-nextjs',
items: [],
},
{
name: 'Angular',
- url: '/guides/with-angular',
+ url: '/guides/tutorials/with-angular',
items: [],
},
{
name: 'Nuxt 3',
- url: '/guides/with-nuxt-3',
+ url: '/guides/tutorials/with-nuxt-3',
items: [],
},
{
name: 'RedwoodJS',
- url: '/guides/with-redwoodjs',
+ url: '/guides/tutorials/with-redwoodjs',
items: [],
},
{
name: 'SolidJS',
- url: '/guides/with-solidjs',
+ url: '/guides/tutorials/with-solidjs',
items: [],
},
{
name: 'Svelte',
- url: '/guides/with-svelte',
+ url: '/guides/tutorials/with-svelte',
items: [],
},
{
name: 'SvelteKit',
- url: '/guides/with-sveltekit',
+ url: '/guides/tutorials/with-sveltekit',
items: [],
},
{
name: 'Vue 3',
- url: '/guides/with-vue-3',
+ url: '/guides/tutorials/with-vue-3',
items: [],
},
],
@@ -102,12 +107,12 @@ export const tutorials = {
items: [
{
name: 'Flutter',
- url: '/guides/with-flutter',
+ url: '/guides/tutorials/with-flutter',
items: [],
},
{
name: 'Expo',
- url: '/guides/with-expo',
+ url: '/guides/tutorials/with-expo',
items: [],
},
],
@@ -117,17 +122,17 @@ export const tutorials = {
items: [
{
name: 'Ionic Angular',
- url: '/guides/with-ionic-angular',
+ url: '/guides/tutorials/with-ionic-angular',
items: [],
},
{
name: 'Ionic React',
- url: '/guides/with-ionic-react',
+ url: '/guides/tutorials/with-ionic-react',
items: [],
},
{
name: 'Ionic Vue',
- url: '/guides/with-ionic-vue',
+ url: '/guides/tutorials/with-ionic-vue',
items: [],
},
],
@@ -146,21 +151,11 @@ export const cli = {
export const auth = {
icon: '/img/icons/menu/auth.svg',
label: 'Auth',
- extras: [
+ items: [
{
- name: 'API Reference',
- level: 'integrations',
- items: [],
- icon: '/img/icons/menu/reference.svg',
+ name: 'Overview',
+ url: '/guides/auth/overview',
},
- {
- name: 'Integrations',
- level: 'reference',
- items: [],
- icon: '/img/icons/menu/integrations.svg',
- },
- ],
- items: [
{
name: 'Authentication',
url: undefined,
@@ -238,6 +233,20 @@ export const auth = {
],
},
],
+ extras: [
+ {
+ name: 'API Reference',
+ level: 'integrations',
+ items: [],
+ icon: '/img/icons/menu/reference.svg',
+ },
+ {
+ name: 'Integrations',
+ level: 'reference',
+ items: [],
+ icon: '/img/icons/menu/integrations.svg',
+ },
+ ],
}
export const database = {
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
index bc5b0d1b3fc..c9b12bfd94d 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
@@ -11,47 +11,45 @@ const SideNav = () => {
const [level, setLevel] = useState('home')
- const tempBasePath = '/new'
-
function handleRouteChange(url: string) {
console.log('path changed')
console.log(url)
console.log('LISTEN')
switch (url) {
- case `/docs${tempBasePath}`:
+ case `/docs`:
setLevel('home')
break
- case `/docs${tempBasePath}/getting-started`:
+ case url.includes(`/docs/getting-started`) && url:
setLevel('gettingstarted')
break
- case `/docs${tempBasePath}/tutorials`:
+ case url.includes(`/docs/guides/tutorials`) && url:
setLevel('tutorials')
break
- case `/docs${tempBasePath}/database`:
+ case url.includes(`/docs/guides/database`) && url:
setLevel('database')
break
- case url.includes(`/docs${tempBasePath}/auth`) && url:
+ case url.includes(`/docs/guides/auth`) && url:
setLevel('auth')
break
- case `/docs${tempBasePath}/storage`:
+ case url.includes(`/docs/guides/storage`) && url:
setLevel('storage')
break
- case `/docs${tempBasePath}/realtime`:
+ case url.includes(`/doc/guides/realtime`) && url:
setLevel('realtime')
break
- case `/docs${tempBasePath}/edge-functions`:
+ case url.includes(`/docs/edge-functions`) && url:
setLevel('functions')
break
- case `/docs${tempBasePath}/reference`:
+ case url.includes(`/docs/reference`) && url:
setLevel('reference')
break
- case `/docs${tempBasePath}/integrations`:
+ case url.includes(`/docs/integrations`) && url:
setLevel('integrations')
break
- case `/docs${tempBasePath}/platform`:
+ case url.includes(`/docs/platform`) && url:
setLevel('platform')
break
- case url.includes(`/docs${tempBasePath}/reference/javascript/`) && url:
+ case url.includes(`/docs/reference/javascript/`) && url:
setLevel('reference_javascript')
break
@@ -89,7 +87,7 @@ const SideNav = () => {
{
label: 'Tutorials',
icon: 'tutorials.svg',
- href: '/tutorials',
+ href: '/guides/tutorials',
level: 'tutorials',
},
],
@@ -97,31 +95,31 @@ const SideNav = () => {
{
label: 'Database',
icon: 'database.svg',
- href: '/database',
+ href: '/guides/database',
level: 'database',
},
{
label: 'Auth',
icon: 'auth.svg',
- href: '/auth',
+ href: '/guides/auth',
level: 'auth',
},
{
label: 'Storage',
icon: 'storage.svg',
- href: '/storage',
+ href: '/guides/storage',
level: 'storage',
},
{
label: 'Realtime',
icon: 'realtime.svg',
- href: '/realtime',
+ href: '/guides/realtime',
level: 'realtime',
},
{
label: 'Edge Functions',
icon: 'functions.svg',
- href: '/edge-functions',
+ href: '/guides/edge-functions',
level: 'functions',
},
],
@@ -135,13 +133,13 @@ const SideNav = () => {
{
label: 'Integrations',
icon: 'integrations.svg',
- href: '/integrations',
+ href: '/guides/integrations',
level: 'integrations',
},
{
label: 'Platform',
icon: 'platform.svg',
- href: '/platform',
+ href: '/guides/platform',
level: 'platform',
},
],
@@ -215,7 +213,7 @@ const SideNav = () => {
<div className="flex flex-col gap-3" key={`section-${sectionIndex}`}>
{section.map((link) => {
return (
- <Link href={tempBasePath + link.href} passHref>
+ <Link href={link.href} passHref>
<a key={link.label}>
<li
className={[
@@ -240,73 +238,22 @@ const SideNav = () => {
</ul>
</div>
- <NavigationMenuGuideList
- id={'gettingstarted'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'tutorials'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'database'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'auth'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'storage'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'realtime'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'functions'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'reference'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'integrations'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
- <NavigationMenuGuideList
- id={'platform'}
- currentLevel={level}
- setLevel={setLevel}
- tempBasePath={tempBasePath}
- />
+ <NavigationMenuGuideList id={'gettingstarted'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'tutorials'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'database'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'auth'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'storage'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'realtime'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'functions'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'reference'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'integrations'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuGuideList id={'platform'} currentLevel={level} setLevel={setLevel} />
{/* reference level */}
<NavigationMenuGuideList
id={'reference_javascript'}
currentLevel={level}
setLevel={setLevel}
- tempBasePath={tempBasePath}
/>
{/* // ref menu */}
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
index b25df26e0ab..3f35a53e2a2 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
@@ -4,11 +4,9 @@ import rehypeFilter from 'react-markdown/lib/rehype-filter'
import { IconChevronLeft } from '~/../../packages/ui'
import * as NavItems from './NavigationMenu.constants'
-const NavigationMenuGuideList = ({ currentLevel, setLevel, tempBasePath, id }) => {
+const NavigationMenuGuideList = ({ currentLevel, setLevel, id }) => {
const router = useRouter()
- tempBasePath = ''
-
const menu = NavItems[id]
return (
@@ -26,23 +24,21 @@ const NavigationMenuGuideList = ({ currentLevel, setLevel, tempBasePath, id }) =
].join(' ')}
>
<ul className={'relative w-full flex flex-col gap-0'}>
- <li
- onClick={() => {
- router.push(`${tempBasePath}${menu.parent ?? ''}`)
- // setLevel(menu.parent && 'home')
- }}
- className={[
- 'flex items-center gap-1 text-xs group mb-3',
- 'text-base transition-all duration-200 text-brand-900 hover:text-brand-1200 hover:cursor-pointer ',
- ].join(' ')}
- >
- <div className="relative w-2">
- <div className="transition-all ease-out ml-0 group-hover:-ml-1">
- <IconChevronLeft size={10} strokeWidth={3} />
+ <Link href={`${menu.parent ?? '/'}`} passHref>
+ <a
+ className={[
+ 'flex items-center gap-1 text-xs group mb-3',
+ 'text-base transition-all duration-200 text-brand-900 hover:text-brand-1200 hover:cursor-pointer ',
+ ].join(' ')}
+ >
+ <div className="relative w-2">
+ <div className="transition-all ease-out ml-0 group-hover:-ml-1">
+ <IconChevronLeft size={10} strokeWidth={3} />
+ </div>
</div>
- </div>
- <span>Main Menu</span>
- </li>
+ <span>Main Menu</span>
+ </a>
+ </Link>
<div className="flex items-center gap-3 my-3">
{/* <div className="w-10 h-10 bg-brand-500 rounded flex items-center justify-center"> */}
@@ -68,7 +64,7 @@ const NavigationMenuGuideList = ({ currentLevel, setLevel, tempBasePath, id }) =
{x.items.map((x) => {
return (
<li key={x.name}>
- <Link href={`/${tempBasePath}${x.url}`} passHref>
+ <Link href={`/${x.url}`} passHref>
<a className="cursor-pointer transition text-scale-1000 text-sm hover:text-brand-900">
{x.name}
</a>
@@ -79,7 +75,7 @@ const NavigationMenuGuideList = ({ currentLevel, setLevel, tempBasePath, id }) =
</>
) : (
<li>
- <Link href={`/${tempBasePath}${x.url}`} passHref>
+ <Link href={`/${x.url}`} passHref>
<a className="cursor-pointer transition text-scale-1000 text-sm hover:text-brand-900 flex gap-3">
{x.icon && <img className="w-3" src={`${router.basePath}${x.icon}`} />}
{x.name}
@@ -102,7 +98,7 @@ const NavigationMenuGuideList = ({ currentLevel, setLevel, tempBasePath, id }) =
return (
<div key={x.name}>
<li>
- <Link href={`/${tempBasePath}${x.href}`} passHref>
+ <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/DefaultGuideLayout.tsx b/apps/docs/layouts/DefaultGuideLayout.tsx
index 0429d214bae..8d63d041092 100644
--- a/apps/docs/layouts/DefaultGuideLayout.tsx
+++ b/apps/docs/layouts/DefaultGuideLayout.tsx
@@ -1,15 +1,5 @@
-import { MDXProvider } from '@mdx-js/react'
-import { useEffect, FC, useRef, useState } from 'react'
-import { NextSeo } from 'next-seo'
-import NavBar from '../components/Navigation/NavBar'
-import SideBar from '../components/Navigation/SideBar'
-import Footer from '../components/Footer'
-import GuidesTableOfContents from '~/components/GuidesTableOfContents'
-import { useRouter } from 'next/router'
-import { getPageType } from '../lib/helpers'
-import components from '~/components'
-import { menuItems } from '../components/Navigation/Navigation.constants'
-import TableOfContents from '~/components/TableOfContents'
+import { FC } from 'react'
+import GuideLayout from './guides'
interface Props {
meta: { title: string; description?: string; hide_table_of_contents?: boolean; video?: string }
@@ -19,203 +9,7 @@ interface Props {
}
const Layout: FC<Props> = (props) => {
- switch (process.env.NEXT_PUBLIC_NEW_DOCS) {
- case 'true':
- console.log('new layout')
- return newLayout(props)
- break
- default:
- console.log('old layout')
- return archivedLayout(props)
- break
- }
-}
-
-const newLayout: FC<Props> = (props) => {
- const { asPath } = useRouter()
- const page = getPageType(asPath)
-
- const [active, setActive] = useState(false)
-
- console.log('page', page)
-
- 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)
- }, [])
-
- 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={[
- 'relative transition-all ease-out',
- 'duration-150',
- active ? 'opacity-100 left-0' : 'opacity-0 left-10',
- ].join(' ')}
- >
- <div>
- <p className="text-brand-900 tracking-wider">Guides</p>
- <article className={['prose dark:prose-dark ', 'max-w-none'].join(' ')}>
- <h1>{props.meta.title}</h1>
- <div className="max-w-xs w-32 h-[1px] bg-gradient-to-r from-brand-800 to-brand-900 my-16"></div>
-
- <MDXProvider components={components} children={props.children} />
- </article>
- </div>
- {hasTableOfContents && !props.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 md:block md:col-span-3 px-2',
- ].join(' ')}
- >
- <TableOfContents toc={props.toc} video={props.meta.video} />
- </div>
- )}
- </div>
- </>
- )
-}
-
-const archivedLayout: FC<Props> = ({ meta, children }) => {
- const { asPath } = useRouter()
- const page = getPageType(asPath)
-
- console.log('page', page)
-
- 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>
- </>
- )
+ return GuideLayout(props)
}
export default Layout
diff --git a/apps/docs/layouts/guides/archived.tsx b/apps/docs/layouts/guides/archived.tsx
new file mode 100644
index 00000000000..3d8b900c887
--- /dev/null
+++ b/apps/docs/layouts/guides/archived.tsx
@@ -0,0 +1,114 @@
+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
new file mode 100644
index 00000000000..61ae52db8ec
--- /dev/null
+++ b/apps/docs/layouts/guides/current.tsx
@@ -0,0 +1,122 @@
+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 GuidesTableOfContents from '~/components/GuidesTableOfContents'
+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> = (props) => {
+ const [active, setActive] = useState(false)
+
+ 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)
+ }, [])
+
+ 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 gap-12 grid-cols-12 relative'].join(' ')}>
+ <div
+ className={[
+ 'relative',
+ 'col-span-9',
+ 'transition-all ease-out',
+ 'duration-100',
+ active ? 'opacity-100 left-0' : 'opacity-0 left-6',
+ ].join(' ')}
+ >
+ <p className="text-brand-900 tracking-wider">Guides</p>
+ <article
+ ref={articleRef}
+ className={`${
+ props.meta?.hide_table_of_contents || !hasTableOfContents ? '' : ''
+ } prose dark:prose-dark mt-8 `}
+ >
+ <h1>{props.meta.title}</h1>
+ <div className="max-w-xs w-32 h-[1px] bg-gradient-to-r from-brand-800 to-brand-900 my-16"></div>
+ <MDXProvider components={components}>{props.children}</MDXProvider>
+ </article>
+ </div>
+ {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
new file mode 100644
index 00000000000..9e551480ebc
--- /dev/null
+++ b/apps/docs/layouts/guides/index.tsx
@@ -0,0 +1,23 @@
+import NewLayout from './current'
+import OldLayout from './archived'
+import { FC } from 'react'
+
+interface Props {
+ meta: { title: string; description?: string; hide_table_of_contents?: boolean; video?: string }
+ children: any
+ toc?: any
+ currentPage: string
+}
+
+const Layout: FC<Props> = (props) => {
+ switch (process.env.NEXT_PUBLIC_NEW_DOCS) {
+ case 'true':
+ return NewLayout(props)
+ break
+ default:
+ return OldLayout(props)
+ break
+ }
+}
+
+export default Layout
diff --git a/apps/docs/pages/guides/auth.mdx b/apps/docs/pages/guides/auth.mdx
index 75e514e5b7e..9b2d55fcb77 100644
--- a/apps/docs/pages/guides/auth.mdx
+++ b/apps/docs/pages/guides/auth.mdx
@@ -1,4 +1,6 @@
import Layout from '~/layouts/DefaultGuideLayout'
+import NewContent from '~/pages/new/auth.mdx'
+import { useRouter } from 'next/router'
export const meta = {
id: 'auth',
@@ -160,6 +162,12 @@ When users sign up, Supabase assigns them a unique ID. You can reference this ID
<source src="/docs/videos/auth-zoom2.mp4" type="video/mp4" muted playsInline />
</video>
-export const Page = ({ children }) => <Layout meta={meta} children={children} />
+export const Page = ({ children }) => {
+ const router = useRouter()
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true' && !router.asPath.includes('overview')) {
+ return NewContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
export default Page
diff --git a/apps/docs/pages/guides/auth/overview.mdx b/apps/docs/pages/guides/auth/overview.mdx
new file mode 100644
index 00000000000..2f798039bb9
--- /dev/null
+++ b/apps/docs/pages/guides/auth/overview.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import OldContent from '~/pages/guides/auth.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return OldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-angular.mdx b/apps/docs/pages/guides/tutorials/with-angular.mdx
new file mode 100644
index 00000000000..b1479a50e9a
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-angular.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-angular.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-expo.mdx b/apps/docs/pages/guides/tutorials/with-expo.mdx
new file mode 100644
index 00000000000..657aba26325
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-expo.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-expo.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-flutter.mdx b/apps/docs/pages/guides/tutorials/with-flutter.mdx
new file mode 100644
index 00000000000..2039cb1d051
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-flutter.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-flutter.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-ionic-angular.mdx b/apps/docs/pages/guides/tutorials/with-ionic-angular.mdx
new file mode 100644
index 00000000000..4736d7e664a
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-ionic-angular.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-ionic-angular.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-ionic-react.mdx b/apps/docs/pages/guides/tutorials/with-ionic-react.mdx
new file mode 100644
index 00000000000..1e73208baf1
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-ionic-react.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-ionic-react.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-ionic-vue.mdx b/apps/docs/pages/guides/tutorials/with-ionic-vue.mdx
new file mode 100644
index 00000000000..3df41e07fca
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-ionic-vue.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-ionic-vue.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-nextjs.mdx b/apps/docs/pages/guides/tutorials/with-nextjs.mdx
new file mode 100644
index 00000000000..4f74ea1e24d
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-nextjs.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import OldContent from '~/pages/guides/with-nextjs.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return OldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-nuxt-3.mdx b/apps/docs/pages/guides/tutorials/with-nuxt-3.mdx
new file mode 100644
index 00000000000..fe91855561b
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-nuxt-3.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-nuxt-3.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-react.mdx b/apps/docs/pages/guides/tutorials/with-react.mdx
new file mode 100644
index 00000000000..29f8eaee132
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-react.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-react.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-redwoodjs.mdx b/apps/docs/pages/guides/tutorials/with-redwoodjs.mdx
new file mode 100644
index 00000000000..086c34786d7
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-redwoodjs.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-redwoodjs.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-solidjs.mdx b/apps/docs/pages/guides/tutorials/with-solidjs.mdx
new file mode 100644
index 00000000000..2a8518fc3dc
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-solidjs.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-solidjs.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-svelte.mdx b/apps/docs/pages/guides/tutorials/with-svelte.mdx
new file mode 100644
index 00000000000..a7d0c6e967f
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-svelte.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-svelte.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-sveltekit.mdx b/apps/docs/pages/guides/tutorials/with-sveltekit.mdx
new file mode 100644
index 00000000000..7bd8cf0761e
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-sveltekit.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-sveltekit.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/tutorials/with-vue-3.mdx b/apps/docs/pages/guides/tutorials/with-vue-3.mdx
new file mode 100644
index 00000000000..b41828aef0d
--- /dev/null
+++ b/apps/docs/pages/guides/tutorials/with-vue-3.mdx
@@ -0,0 +1,11 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+import oldContent from '~/pages/guides/with-vue-3.mdx'
+
+export const Page = ({ children }) => {
+ if (process.env.NEXT_PUBLIC_NEW_DOCS === 'true') {
+ return oldContent()
+ }
+ return <Layout meta={meta} children={children} />
+}
+
+export default Page
diff --git a/apps/docs/pages/guides/with-nextjs.mdx b/apps/docs/pages/guides/with-nextjs.mdx
index a27beb53574..87de66a4d49 100644
--- a/apps/docs/pages/guides/with-nextjs.mdx
+++ b/apps/docs/pages/guides/with-nextjs.mdx
@@ -1,12 +1,4 @@
-<<<<<<< Updated upstream:apps/docs/pages/guides/with-nextjs.mdx
import Layout from '~/layouts/DefaultGuideLayout'
-=======
----
-title: 'Build a user management app with Next.js'
-description: Learn how to use Supabase in your Next App.
-sidebar_label: 'Next.js'
----
->>>>>>> Stashed changes:apps/docs/docs/guides/with-nextjs.mdx
export const meta = {
id: 'with-nextjs',
@@ -442,7 +434,6 @@ TS guide content
## See also
-<<<<<<< Updated upstream:apps/docs/pages/guides/with-nextjs.mdx
- See the complete [example on GitHub](https://github.com/supabase/supabase/tree/master/examples/user-management/nextjs-ts-user-management) and deploy it to Vercel.
- Explore the [pre-built Auth UI for React](/docs/guides/auth/auth-helpers/auth-ui).
- Explore the [Auth Helpers for Next.js](/docs/guides/auth/auth-helpers/nextjs).
@@ -453,8 +444,4 @@ TS guide content
export const Page = ({ children }) => <Layout meta={meta} children={children} />
-export default Page
-=======
-- See the complete [example on GitHub](https://github.com/supabase/supabase/tree/master/examples/user-management/nextjs-ts-user-management) and deploy it to Vercel
-- Explore the [Supabase Cache Helpers](https://github.com/psteinroe/supabase-cache-helpers)
->>>>>>> Stashed changes:apps/docs/docs/guides/with-nextjs.mdx
+# export default Page