mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
Feature / Refactor ## What is the current behavior? Data API docs live at the `/api` route as a standalone page. Old links point to the previous location. ## What is the new behavior? Data API docs are moved to the integrations section with a dedicated docs tab and settings tab. Old links are cleaned up, a mobile menu is added for data API docs navigation, and minor code review fixes are applied. ## Additional context Resolves FE-2517 ## Summary by CodeRabbit * **New Features** * Revamped API docs UI with reusable section layout, language toggle (JS/Bash), API key selection, and improved code snippets * Added Data API docs tab, mobile navigation, and dedicated loading/error/disabled states * **Navigation Updates** * Moved API docs and related links into the Integrations/Data API area and added redirects to new routes * Updated various internal links to the new Data API settings and overview locations * **Tests** * Added comprehensive unit tests for Data API utilities
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { useParams } from 'common'
|
|
import type { CommandOptions } from 'ui-patterns/CommandMenu'
|
|
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
|
|
import { COMMAND_MENU_SECTIONS } from '../App/CommandMenu/CommandMenu.utils'
|
|
|
|
export function useApiDocsGotoCommands(options?: CommandOptions) {
|
|
let { ref } = useParams()
|
|
ref ||= '_'
|
|
|
|
useRegisterCommands(
|
|
COMMAND_MENU_SECTIONS.NAVIGATE,
|
|
[
|
|
{
|
|
id: 'nav-api',
|
|
name: 'Project API Docs',
|
|
route: `/project/${ref}/integrations/data_api/docs`,
|
|
defaultHidden: true,
|
|
},
|
|
{
|
|
id: 'nav-api-auth',
|
|
name: 'Auth Docs',
|
|
route: `/project/${ref}/integrations/data_api/docs?page=auth`,
|
|
defaultHidden: true,
|
|
},
|
|
{
|
|
id: 'nav-api-user-management',
|
|
name: 'User Management Docs',
|
|
route: `/project/${ref}/integrations/data_api/docs?page=users-management`,
|
|
defaultHidden: true,
|
|
},
|
|
{
|
|
id: 'nav-api-graphql',
|
|
name: 'GraphQL Docs',
|
|
route: `/project/${ref}/integrations/graphiql`,
|
|
defaultHidden: true,
|
|
},
|
|
],
|
|
{ ...options, deps: [ref] }
|
|
)
|
|
}
|