Advisors.Commands.tsx29 lines · main
| 1 | import { useParams } from 'common' |
| 2 | import type { CommandOptions } from 'ui-patterns/CommandMenu' |
| 3 | import { useRegisterCommands } from 'ui-patterns/CommandMenu' |
| 4 | |
| 5 | import { COMMAND_MENU_SECTIONS } from '@/components/interfaces/App/CommandMenu/CommandMenu.utils' |
| 6 | |
| 7 | export function useAdvisorsGoToCommands(options?: CommandOptions) { |
| 8 | let { ref } = useParams() |
| 9 | ref ||= '_' |
| 10 | |
| 11 | useRegisterCommands( |
| 12 | COMMAND_MENU_SECTIONS.NAVIGATE, |
| 13 | [ |
| 14 | { |
| 15 | id: 'nav-advisors-security', |
| 16 | name: 'Security Advisor', |
| 17 | route: `/project/${ref}/advisors/security`, |
| 18 | defaultHidden: true, |
| 19 | }, |
| 20 | { |
| 21 | id: 'nav-advisors-performance', |
| 22 | name: 'Performance Advisor', |
| 23 | route: `/project/${ref}/advisors/performance`, |
| 24 | defaultHidden: true, |
| 25 | }, |
| 26 | ], |
| 27 | { ...options, deps: [ref] } |
| 28 | ) |
| 29 | } |