ProjectAPIDocs.Commands.tsx 1.1 KB

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