mirror of
https://github.com/supabase/supabase.git
synced 2026-07-01 02:24:32 +08:00
move spec generation stuff
This commit is contained in:
@@ -22,7 +22,7 @@ import { flattenSections } from '~/lib/helpers'
|
||||
import NavigationMenuHome from './HomeMenu'
|
||||
|
||||
// Filter libCommonSections for just the relevant sections in the current library
|
||||
function generateAllowedClientLibKeys(sections, spec) {
|
||||
export function generateAllowedClientLibKeys(sections, spec) {
|
||||
// Filter parent sections first
|
||||
|
||||
const specIds = spec.functions.map((func) => {
|
||||
@@ -198,7 +198,7 @@ const SideNav = () => {
|
||||
active={isReference_Javascript_V1}
|
||||
commonSections={libCommonSections}
|
||||
lib="javascript"
|
||||
allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_js_v1)}
|
||||
spec={spec_js_v1}
|
||||
/> */}
|
||||
<NavigationMenuRefList
|
||||
key={'reference-js-menu'}
|
||||
@@ -206,7 +206,7 @@ const SideNav = () => {
|
||||
active={isReference_Javascript_V2}
|
||||
commonSections={libCommonSections}
|
||||
lib="javascript"
|
||||
allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_js_v2)}
|
||||
spec={spec_js_v2}
|
||||
/>
|
||||
{/* <NavigationMenuRefList
|
||||
key={'reference-dart-menu'}
|
||||
@@ -214,15 +214,15 @@ const SideNav = () => {
|
||||
active={isReference_Dart_V0}
|
||||
commonSections={libCommonSections}
|
||||
lib="dart"
|
||||
allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_dart_v0)}
|
||||
/> */}
|
||||
{/* <NavigationMenuRefList
|
||||
spec={spec_dart_v0}
|
||||
/>
|
||||
<NavigationMenuRefList
|
||||
key={'reference-dart-menu'}
|
||||
id={'reference_dart_v1'}
|
||||
active={isReference_Dart_V1}
|
||||
commonSections={libCommonSections}
|
||||
lib="dart"
|
||||
allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_dart_v1)}
|
||||
spec={spec_dart_v1}
|
||||
/> */}
|
||||
{/* // Tools */}
|
||||
{/* <NavigationMenuRefList
|
||||
@@ -231,8 +231,8 @@ const SideNav = () => {
|
||||
active={isReference_Cli}
|
||||
commonSections={cliCommonSections}
|
||||
lib="cli"
|
||||
/> */}
|
||||
{/* <NavigationMenuRefList
|
||||
/>
|
||||
<NavigationMenuRefList
|
||||
key={'reference-api-menu'}
|
||||
id={'reference_api'}
|
||||
active={isReference_Api}
|
||||
@@ -246,15 +246,15 @@ const SideNav = () => {
|
||||
active={isReference_Self_Hosting_Auth}
|
||||
commonSections={authServerCommonSections}
|
||||
lib="self-hosting-auth"
|
||||
/> */}
|
||||
{/* <NavigationMenuRefList
|
||||
/>
|
||||
<NavigationMenuRefList
|
||||
key={'reference-self-hosting-storage-menu'}
|
||||
id={'reference_self_hosting_storage'}
|
||||
active={isReference_Self_Hosting_Storage}
|
||||
commonSections={storageServerCommonSections}
|
||||
lib="self-hosting-storage"
|
||||
/> */}
|
||||
{/* <NavigationMenuRefList
|
||||
/>
|
||||
<NavigationMenuRefList
|
||||
key={'reference-self-hosting-realtime-menu'}
|
||||
id={'reference_self_hosting_realtime'}
|
||||
active={isReference_Self_Hosting_Realtime}
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
import * as Accordion from '@radix-ui/react-accordion'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { IconChevronLeft } from 'ui'
|
||||
import * as NavItems from './NavigationMenu.constants'
|
||||
|
||||
import { find } from 'lodash'
|
||||
import Image from 'next/image'
|
||||
import { useTheme } from 'common/Providers'
|
||||
|
||||
// import apiCommonSections from '~/../../spec/common-client-libs-sections.json'
|
||||
|
||||
import RevVersionDropdown from '~/components/RefVersionDropdown'
|
||||
import { useMenuActiveRefId, useMenuLevelId } from '~/hooks/useMenuState'
|
||||
import { RefIdOptions, RefKeyOptions } from './NavigationMenu'
|
||||
import NavigationMenuRefListItems from './NavigationMenuRefListItems'
|
||||
|
||||
@@ -26,14 +14,16 @@ interface INavigationMenuRefList {
|
||||
// if undefined, we show all the menu items
|
||||
allowedClientKeys?: string[]
|
||||
active: boolean
|
||||
spec?: any
|
||||
}
|
||||
|
||||
const NavigationMenuRefList: React.FC<INavigationMenuRefList> = ({
|
||||
id,
|
||||
lib,
|
||||
commonSections,
|
||||
allowedClientKeys,
|
||||
|
||||
active,
|
||||
spec,
|
||||
}) => {
|
||||
// console.log(filterIds)
|
||||
// console.log(modifierIds)
|
||||
@@ -53,12 +43,7 @@ const NavigationMenuRefList: React.FC<INavigationMenuRefList> = ({
|
||||
!active ? 'opacity-0 invisible absolute h-0 overflow-hidden' : '',
|
||||
].join(' ')}
|
||||
>
|
||||
<NavigationMenuRefListItems
|
||||
id={id}
|
||||
lib={lib}
|
||||
commonSections={commonSections}
|
||||
allowedClientKeys={allowedClientKeys}
|
||||
/>
|
||||
<NavigationMenuRefListItems id={id} lib={lib} commonSections={commonSections} spec={spec} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import RevVersionDropdown from '~/components/RefVersionDropdown'
|
||||
import { RefIdOptions, RefKeyOptions } from './NavigationMenu'
|
||||
|
||||
import React from 'react'
|
||||
import { generateAllowedClientLibKeys } from '~/lib/refGenerator/helpers'
|
||||
|
||||
const FunctionLink = ({
|
||||
title,
|
||||
@@ -80,17 +81,15 @@ interface INavigationMenuRefList {
|
||||
// the keys of menu items that are allowed to be shown on the side menu
|
||||
// if undefined, we show all the menu items
|
||||
allowedClientKeys?: string[]
|
||||
spec?: any
|
||||
}
|
||||
|
||||
const Content: React.FC<INavigationMenuRefList> = ({
|
||||
id,
|
||||
lib,
|
||||
commonSections,
|
||||
allowedClientKeys,
|
||||
}) => {
|
||||
const Content: React.FC<INavigationMenuRefList> = ({ id, lib, commonSections, spec }) => {
|
||||
const router = useRouter()
|
||||
const { isDarkMode } = useTheme()
|
||||
|
||||
const allowedClientKeys = spec ? generateAllowedClientLibKeys(commonSections, spec) : undefined
|
||||
|
||||
console.log(
|
||||
id && 'id changed',
|
||||
lib && 'lib changed',
|
||||
|
||||
Reference in New Issue
Block a user