Skip to content

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

added sidemenu for CLI

Jonathan Summers-Muirf62c0858f464
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
index b798ce5c99f..a879fdb4a1f 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
@@ -470,7 +470,7 @@ export const reference = {
name: 'Supabase CLI',
url: '/new/reference/cli/start',
items: [],
- icon: '/img/icons/javascript.svg',
+ icon: '/img/icons/cli.svg',
},
{
name: 'Management API',
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
index 638cd23189d..ba32b83378f 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
@@ -5,17 +5,14 @@ import { IconChevronLeft } from '~/../../packages/ui'
import * as NavItems from './NavigationMenu.constants'
import NavigationMenuGuideList from './NavigationMenuGuideList'
import NavigationMenuRefList from './NavigationMenuRefList'
+import NavigationMenuCliList from './NavigationMenuCliList'
const SideNav = () => {
- console.log('sidebar rerendered')
const router = useRouter()
const [level, setLevel] = useState('home')
function handleRouteChange(url: string) {
- // console.log('path changed')
- // console.log(url)
- // console.log('LISTEN')
switch (url) {
case `/docs`:
setLevel('home')
@@ -63,7 +60,6 @@ const SideNav = () => {
}
useEffect(() => {
- console.log(router)
handleRouteChange(router.basePath + router.asPath)
// Listen for page changes after a navigation or when the query changes
router.events.on('routeChangeComplete', handleRouteChange)
@@ -72,8 +68,6 @@ const SideNav = () => {
}
}, [router.events])
- // handleRouteChange(router.asPath)
-
const home = [
[
{
@@ -149,51 +143,6 @@ const SideNav = () => {
],
]
- const auth = [
- {
- label: 'back',
- icon: 'home.svg',
- href: '',
- level: 'home',
- },
- ]
-
- const ref = [
- {
- label: 'back',
- icon: 'home.svg',
- href: '',
- level: 'home',
- },
- {
- label: 'supabase-js v2',
- icon: 'home.svg',
- href: '/reference/javascript/start',
- level: 'ref_js',
- },
- {
- label: 'supabase-js v1',
- icon: 'home.svg',
- href: '/reference/javascript/v1/start',
- level: 'ref_js',
- },
- {
- label: 'supabase-dart v1',
- icon: 'home.svg',
- href: '/reference/dart/start',
- level: 'ref_dart',
- },
- ]
-
- const ref_js = [
- {
- label: 'back to ref',
- icon: 'home.svg',
- href: '/reference',
- level: 'ref',
- },
- ]
-
return (
<div className="flex relative">
{/* // main menu */}
@@ -255,7 +204,7 @@ const SideNav = () => {
{/* reference level */}
<NavigationMenuRefList id={'reference_javascript'} currentLevel={level} setLevel={setLevel} />
- <NavigationMenuRefList id={'reference_cli'} currentLevel={level} setLevel={setLevel} />
+ <NavigationMenuCliList id={'reference_cli'} currentLevel={level} setLevel={setLevel} />
{/* // ref menu */}
{/* <div
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx
new file mode 100644
index 00000000000..0a2e1fdaebd
--- /dev/null
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx
@@ -0,0 +1,191 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+import { IconChevronLeft } from 'ui'
+import * as NavItems from './NavigationMenu.constants'
+// @ts-expect-error
+import jsSpec from '~/../../spec/supabase_js_v2_temp_new_shape.yml' assert { type: 'yml' }
+// @ts-expect-error
+import clientLibsCommon from '~/../../spec/common-cli.yml' assert { type: 'yml' }
+
+const NavigationMenuCliList = ({ currentLevel, setLevel, id }) => {
+ const router = useRouter()
+
+ const menu = NavItems[id]
+ let functions = jsSpec.functions
+
+ functions = functions.map((func) => {
+ let data = {
+ ...func,
+ }
+ data = {
+ ...data,
+ ...clientLibsCommon.commands.filter((x) => {
+ return x.id === func.id
+ })[0],
+ }
+ return data
+ })
+
+ const FunctionLink = ({
+ title,
+ id,
+ icon,
+ }: {
+ title: string
+ name: string
+ id: string
+ icon?: string
+ }) => {
+ return (
+ <li key={id}>
+ <Link href={`#${id}`} passHref>
+ <a className="cursor-pointer transition text-scale-1000 text-sm hover:text-brand-900 flex gap-3">
+ {icon && <img className="w-3" src={`${router.basePath}${icon}`} />}
+ {title}
+ </a>
+ </Link>
+ </li>
+ )
+ }
+
+ const SideMenuTitle = ({ title }: { title: string }) => {
+ return (
+ <span
+ className="
+ font-mono text-xs uppercase
+ text-scale-1200 font-medium
+ tracking-wider
+ mb-3
+ "
+ >
+ {title}
+ </span>
+ )
+ }
+
+ const Divider = () => {
+ return <div className="h-px w-full bg-green-500 my-3"></div>
+ }
+
+ const MenuSections = [
+ {
+ key: 'general',
+ label: 'General',
+ },
+ {
+ key: 'secrets',
+ label: 'Secrets',
+ },
+ {
+ key: 'projects',
+ label: 'Projects',
+ },
+ {
+ key: 'organizations',
+ label: 'Organizations',
+ },
+ {
+ key: 'migration',
+ label: 'Migration',
+ },
+ {
+ key: 'database',
+ label: 'Database',
+ },
+ {
+ key: 'completion',
+ label: 'Completion',
+ },
+ ]
+
+ return (
+ <div
+ className={[
+ 'transition-all ml-8 duration-150 ease-out',
+
+ // enabled
+ currentLevel === id && 'opacity-100 ml-0 delay-150',
+ currentLevel === 'home' && 'ml-12',
+
+ // disabled
+ currentLevel !== 'home' && currentLevel !== id ? '-ml-8' : '',
+ currentLevel !== id ? 'opacity-0 invisible absolute' : '',
+ ].join(' ')}
+ >
+ <div className={'w-full flex flex-col gap-0 sticky top-8'}>
+ <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>
+ <span>Main Menu</span>
+ </a>
+ </Link>
+ <div className="flex items-center gap-3 my-3">
+ <img
+ src={`${router.basePath}` + menu.icon ?? `/img/icons/menu/${id}.svg`}
+ className="w-5 rounded"
+ />
+
+ <h2 className={['text-scale-1200 ', !menu.title && 'capitalize'].join(' ')}>
+ {menu.title ?? currentLevel}
+ </h2>
+ </div>
+ <ul>
+ {MenuSections.map((section) => {
+ return (
+ <>
+ <Divider />
+ <SideMenuTitle title={section.label} />
+
+ {clientLibsCommon.commands
+ .filter((x) => x.product === section.key)
+ .map((x, index) => {
+ console.log(functions)
+ return (
+ <>
+ <FunctionLink {...x} />
+ </>
+ )
+ })}
+ </>
+ )
+ })}
+
+ <Divider />
+ </ul>
+ {menu.extras && (
+ <>
+ <Divider />{' '}
+ <span className="font-mono text-xs uppercase text-scale-1200 font-medium tracking-wider mb-2">
+ Resources
+ </span>
+ </>
+ )}
+ {menu.extras?.map((x) => {
+ return (
+ <div key={x.name}>
+ <li>
+ <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}
+ </a>
+ </Link>
+ </li>
+ </div>
+ )
+ })}
+ </div>
+ </div>
+ )
+}
+
+export default NavigationMenuCliList
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
index 0f641561157..33900c54f0d 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
@@ -5,7 +5,7 @@ import * as NavItems from './NavigationMenu.constants'
// @ts-expect-error
import jsSpec from '~/../../spec/supabase_js_v2_temp_new_shape.yml' assert { type: 'yml' }
// @ts-expect-error
-import clientLibsCommon from '~/../../spec/client-libs-common.yml' assert { type: 'yml' }
+import clientLibsCommon from '~/../../spec/common-client-libs.yml' assert { type: 'yml' }
const NavigationMenuRefList = ({ currentLevel, setLevel, id }) => {
const router = useRouter()
diff --git a/spec/common-cli.yml b/spec/common-cli.yml
index a09e3fa411c..bcbfd839848 100644
--- a/spec/common-cli.yml
+++ b/spec/common-cli.yml
@@ -2,141 +2,188 @@ clisCommon: '001'
commands:
- id: supabase-test
title: supabase test
+ product: 'general'
+
+ - id: supabase-login
+ title: supabase login
+ product: 'general'
+
+ - id: supabase-link
+ title: supabase link
+ product: 'general'
+
+ - id: supabase-init
+ title: supabase init
+ product: 'general'
- id: supabase-test-db
title: supabase test db
+ product: 'general'
- id: supabase-stop
title: supabase stop
+ product: 'general'
- id: supabase-status
title: supabase status
+ product: 'general'
- id: supabase-start
title: supabase start
+ product: 'general'
+
+ - id: supabase-gen
+ title: supabase gen
+ product: 'general'
+
+ - id: supabase-gen-types
+ title: supabase gen types
+ product: 'general'
+
+ - id: supabase-gen-types-typescript
+ title: supabase gen types typescript
+ product: 'general'
- id: supabase-secrets
title: supabase secrets
+ product: 'secrets'
- id: supabase-secrets-unset
title: supabase secrets unset
+ product: 'secrets'
- id: supabase-secrets-set
title: supabase secrets set
+ product: 'secrets'
- id: supabase-secrets-list
title: supabase secrets list
+ product: 'secrets'
- id: supabase-projects
title: supabase projects
+ product: 'projects'
- id: supabase-projects-list
title: supabase projects list
+ product: 'projects'
- id: supabase-projects-create
title: supabase projects create
+ product: 'projects'
- id: supabase-orgs
title: supabase orgs
+ product: 'organizations'
- id: supabase-orgs-list
title: supabase orgs list
+ product: 'organizations'
- id: supabase-migration
title: supabase migration
+ product: 'migration'
- id: supabase-migration-new
title: supabase migration new
+ product: 'migration'
- id: supabase-migration-list
title: supabase migration list
-
- - id: supabase-login
- title: supabase login
-
- - id: supabase-link
- title: supabase link
-
- - id: supabase-init
- title: supabase init
-
- - id: supabase-gen
- title: supabase gen
-
- - id: supabase-gen-types
- title: supabase gen types
-
- - id: supabase-gen-types-typescript
- title: supabase gen types typescript
+ product: 'migration'
- id: supabase-functions
title: supabase functions
+ product: 'functions'
- id: supabase-functions-serve
title: supabase functions serve
+ product: 'functions'
- id: supabase-functions-new
title: supabase functions new
+ product: 'functions'
- id: supabase-functions-deploy
title: supabase functions deploy
+ product: 'functions'
- id: supabase-functions-delete
title: supabase functions delete
+ product: 'functions'
- id: supabase-domains
title: supabase domains
+ product: 'domains'
- id: supabase-domains-reverify
title: supabase domains reverify
+ product: 'domains'
- id: supabase-domains-get
title: supabase domains get
+ product: 'domains'
- id: supabase-domains-delete
title: supabase domains delete
+ product: 'domains'
- id: supabase-domains-create
title: supabase domains create
+ product: 'domains'
- id: supabase-domains-activate
title: supabase domains activate
+ product: 'domains'
- id: supabase-db
title: supabase db
+ product: 'database'
- id: supabase-db-reset
title: supabase db reset
+ product: 'database'
- id: supabase-db-remote
title: supabase db remote
+ product: 'database'
- id: supabase-db-remote-commit
title: supabase db remote commit
+ product: 'database'
- id: supabase-db-remote-changes
title: supabase db remote changes
+ product: 'database'
- id: supabase-db-push
title: supabase db push
+ product: 'database'
- id: supabase-db-lint
title: supabase db lint
+ product: 'database'
- id: supabase-db-diff
title: supabase db diff
+ product: 'database'
- id: supabase-completion
title: supabase completion
+ product: 'completion'
- id: supabase-completion-zsh
title: supabase completion zsh
+ product: 'completion'
- id: supabase-completion-powershell
title: supabase completion powershell
+ product: 'completion'
- id: supabase-completion-fish
title: supabase completion fish
+ product: 'completion'
- id: supabase-completion-bash
title: supabase completion bash
+ product: 'completion'