ProjectAPIDocs.Commands.tsx41 lines · main
1import { useParams } from 'common'
2import type { CommandOptions } from 'ui-patterns/CommandMenu'
3import { useRegisterCommands } from 'ui-patterns/CommandMenu'
4
5import { COMMAND_MENU_SECTIONS } from '../App/CommandMenu/CommandMenu.utils'
6
7export function useApiDocsGotoCommands(options?: CommandOptions) {
8 let { ref } = useParams()
9 ref ||= '_'
10
11 useRegisterCommands(
12 COMMAND_MENU_SECTIONS.NAVIGATE,
13 [
14 {
15 id: 'nav-api',
16 name: 'Project API Docs',
17 route: `/project/${ref}/integrations/data_api/docs`,
18 defaultHidden: true,
19 },
20 {
21 id: 'nav-api-auth',
22 name: 'Auth Docs',
23 route: `/project/${ref}/integrations/data_api/docs?page=auth`,
24 defaultHidden: true,
25 },
26 {
27 id: 'nav-api-user-management',
28 name: 'User Management Docs',
29 route: `/project/${ref}/integrations/data_api/docs?page=users-management`,
30 defaultHidden: true,
31 },
32 {
33 id: 'nav-api-graphql',
34 name: 'GraphQL Docs',
35 route: `/project/${ref}/integrations/graphiql`,
36 defaultHidden: true,
37 },
38 ],
39 { ...options, deps: [ref] }
40 )
41}