Skip to content

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

moved state

Jonathan Summers-Muira0afbdab3b8f
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
index b4eef05e87b..d72d2a61158 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
@@ -73,6 +73,8 @@ const SideNav = () => {
const level = useMenuLevelId()
+ console.log()
+
let version = ''
if (router.asPath.includes('v1')) {
@@ -264,30 +266,6 @@ const SideNav = () => {
href: '/reference/cli/introduction',
level: 'reference_javascript',
},
- // {
- // label: 'Self-Hosting Reference',
- // },
- // {
- // label: 'Self-Hosting Auth',
- // icon: '/img/icons/menu/reference-auth',
- // hasLightIcon: true,
- // href: '/reference/self-hosting-auth/introduction',
- // level: 'reference_self_hosting_auth',
- // },
- // {
- // label: 'Self-Hosting Storage',
- // hasLightIcon: true,
- // icon: '/img/icons/menu/reference-storage',
- // href: '/reference/self-hosting-storage/introduction',
- // level: 'reference_self_hosting_auth',
- // },
- // {
- // label: 'Self-Hosting Realtime',
- // hasLightIcon: true,
- // icon: '/img/icons/menu/reference-realtime',
- // href: '/reference/self-hosting-realtime/introduction',
- // level: 'reference_self_hosting_auth',
- // },
],
]
@@ -362,25 +340,20 @@ const SideNav = () => {
</ul>
</div>
- <NavigationMenuGuideList id={'gettingstarted'} currentLevel={level} />
- <NavigationMenuGuideList id={'database'} currentLevel={level} />
- <NavigationMenuGuideList id={'auth'} currentLevel={level} />
- <NavigationMenuGuideList id={'functions'} currentLevel={level} />
- <NavigationMenuGuideList id={'realtime'} currentLevel={level} />
- <NavigationMenuGuideList id={'storage'} currentLevel={level} />
- <NavigationMenuGuideList id={'platform'} currentLevel={level} />
- <NavigationMenuGuideList
- id={'resources'}
- currentLevel={level}
- setMenuLevelId={menuState.setMenuLevelId}
- />
- <NavigationMenuGuideList id={'integrations'} currentLevel={level} />
- <NavigationMenuGuideList id={'reference'} currentLevel={level} />
+ <NavigationMenuGuideList id={'gettingstarted'} />
+ <NavigationMenuGuideList id={'database'} />
+ <NavigationMenuGuideList id={'auth'} />
+ <NavigationMenuGuideList id={'functions'} />
+ <NavigationMenuGuideList id={'realtime'} />
+ <NavigationMenuGuideList id={'storage'} />
+ <NavigationMenuGuideList id={'platform'} />
+ <NavigationMenuGuideList id={'resources'} setMenuLevelId={menuState.setMenuLevelId} />
+ <NavigationMenuGuideList id={'integrations'} />
+ <NavigationMenuGuideList id={'reference'} />
{/* // Client Libs */}
<NavigationMenuRefList
key={'reference-js-menu'}
id={'reference_javascript_v1'}
- currentLevel={level}
commonSections={libCommonSections}
lib="javascript"
allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_js_v1)}
@@ -388,7 +361,6 @@ const SideNav = () => {
<NavigationMenuRefList
key={'reference-js-menu'}
id={'reference_javascript_v2'}
- currentLevel={level}
commonSections={libCommonSections}
lib="javascript"
allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_js_v2)}
@@ -396,7 +368,6 @@ const SideNav = () => {
<NavigationMenuRefList
key={'reference-dart-menu'}
id={'reference_dart_v0'}
- currentLevel={level}
commonSections={libCommonSections}
lib="dart"
allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_dart_v0)}
@@ -404,7 +375,6 @@ const SideNav = () => {
<NavigationMenuRefList
key={'reference-dart-menu'}
id={'reference_dart_v1'}
- currentLevel={level}
commonSections={libCommonSections}
lib="dart"
allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_dart_v1)}
@@ -413,14 +383,12 @@ const SideNav = () => {
<NavigationMenuRefList
key={'reference-cli-menu'}
id={'reference_cli'}
- currentLevel={level}
commonSections={cliCommonSections}
lib="cli"
/>
<NavigationMenuRefList
key={'reference-api-menu'}
id={'reference_api'}
- currentLevel={level}
commonSections={apiCommonSections}
lib="api"
/>
@@ -428,21 +396,18 @@ const SideNav = () => {
<NavigationMenuRefList
key={'reference-self-hosting-auth-menu'}
id={'reference_self_hosting_auth'}
- currentLevel={level}
commonSections={authServerCommonSections}
lib="self-hosting-auth"
/>
<NavigationMenuRefList
key={'reference-self-hosting-storage-menu'}
id={'reference_self_hosting_storage'}
- currentLevel={level}
commonSections={storageServerCommonSections}
lib="self-hosting-storage"
/>
<NavigationMenuRefList
key={'reference-self-hosting-realtime-menu'}
id={'reference_self_hosting_realtime'}
- currentLevel={level}
commonSections={realtimeServerCommonSections}
lib="self-hosting-auth"
/>
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
index 5493e13a68a..80c5fe9f422 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
@@ -5,14 +5,14 @@ import Link from 'next/link'
import { useRouter } from 'next/router'
import React from 'react'
import { IconChevronLeft } from '~/../../packages/ui'
+import { useMenuLevelId } from '~/hooks/useMenuState'
import * as NavItems from './NavigationMenu.constants'
interface Props {
- currentLevel: string
id: string
setMenuLevelId?: any
}
-const NavigationMenuGuideList: React.FC<Props> = ({ currentLevel, id, setMenuLevelId }) => {
+const NavigationMenuGuideList: React.FC<Props> = ({ id, setMenuLevelId }) => {
const router = useRouter()
const { isDarkMode } = useTheme()
@@ -36,12 +36,12 @@ const NavigationMenuGuideList: React.FC<Props> = ({ currentLevel, id, setMenuLev
className={[
'transition-all ml-8 duration-150 ease-out',
// enabled
- currentLevel === id && 'opacity-100 ml-0 delay-150',
- currentLevel === 'home' && 'ml-12',
+ level === id && 'opacity-100 ml-0 delay-150',
+ level === 'home' && 'ml-12',
// disabled
- currentLevel !== 'home' && currentLevel !== id ? '-ml-8' : '',
- currentLevel !== id ? 'opacity-0 invisible absolute' : '',
+ level !== 'home' && level !== id ? '-ml-8' : '',
+ level !== id ? 'opacity-0 invisible absolute' : '',
].join(' ')}
>
<ul className={['relative w-full flex flex-col gap-0'].join(' ')}>
@@ -83,7 +83,7 @@ const NavigationMenuGuideList: React.FC<Props> = ({ currentLevel, id, setMenuLev
: 'hover:text-brand-900 text-scale-1200',
].join(' ')}
>
- {menu.title ?? currentLevel}
+ {menu.title ?? level}
</span>
</div>
</a>
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
index b9cc5359eac..a40dd2688bd 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
@@ -11,7 +11,7 @@ import { useTheme } from 'common/Providers'
// import apiCommonSections from '~/../../spec/common-client-libs-sections.json'
import RevVersionDropdown from '~/components/RefVersionDropdown'
-import { useMenuActiveRefId } from '~/hooks/useMenuState'
+import { useMenuActiveRefId, useMenuLevelId } from '~/hooks/useMenuState'
import { RefIdOptions, RefKeyOptions } from './NavigationMenu'
const FunctionLink = ({
@@ -63,8 +63,6 @@ const Divider = () => {
}
interface INavigationMenuRefList {
- currentLevel: string
-
id: RefIdOptions
lib: RefKeyOptions
commonSections: any[] // to do type up
@@ -75,7 +73,6 @@ interface INavigationMenuRefList {
}
const NavigationMenuRefList: React.FC<INavigationMenuRefList> = ({
- currentLevel,
id,
lib,
commonSections,
@@ -136,17 +133,19 @@ const NavigationMenuRefList: React.FC<INavigationMenuRefList> = ({
// console.log(filterIds)
// console.log(modifierIds)
+ const level = useMenuLevelId()
+
return (
<div
className={[
'transition-all ml-8 duration-150 ease-out',
// enabled
- currentLevel === id && 'opacity-100 ml-0 delay-150 h-auto',
+ level === id && 'opacity-100 ml-0 delay-150 h-auto',
// move menu back to margin-left
- currentLevel === 'home' && 'ml-12',
+ level === 'home' && 'ml-12',
// disabled
- currentLevel !== 'home' && currentLevel !== id ? '-ml-8' : '',
- currentLevel !== id ? 'opacity-0 invisible absolute h-0 overflow-hidden' : '',
+ level !== 'home' && level !== id ? '-ml-8' : '',
+ level !== id ? 'opacity-0 invisible absolute h-0 overflow-hidden' : '',
].join(' ')}
>
<div className={'w-full flex flex-col gap-0 sticky top-8'}>