IntegrationsMenu.utils.ts44 lines · main
| 1 | import type { ProductMenuGroup } from '@/components/ui/ProductMenu/ProductMenu.types' |
| 2 | |
| 3 | export function generateIntegrationsMenu({ |
| 4 | projectRef, |
| 5 | flags, |
| 6 | }: { |
| 7 | projectRef?: string |
| 8 | flags?: { showWrappers: boolean } |
| 9 | }): ProductMenuGroup[] { |
| 10 | const { showWrappers } = flags ?? {} |
| 11 | |
| 12 | return [ |
| 13 | { |
| 14 | title: 'Explore', |
| 15 | items: [ |
| 16 | { |
| 17 | name: 'All', |
| 18 | key: 'integrations', |
| 19 | url: `/project/${projectRef}/integrations`, |
| 20 | pages: ['integrations'], |
| 21 | items: [], |
| 22 | }, |
| 23 | ...(showWrappers |
| 24 | ? [ |
| 25 | { |
| 26 | name: 'Wrappers', |
| 27 | key: 'integrations-wrapper', |
| 28 | url: `/project/${projectRef}/integrations?category=wrapper`, |
| 29 | pages: ['integrations?category=wrapper'], |
| 30 | items: [], |
| 31 | }, |
| 32 | ] |
| 33 | : []), |
| 34 | { |
| 35 | name: 'Postgres Modules', |
| 36 | key: 'integrations-postgres_extension', |
| 37 | url: `/project/${projectRef}/integrations?category=postgres_extension`, |
| 38 | pages: ['integrations?category=postgres_extension'], |
| 39 | items: [], |
| 40 | }, |
| 41 | ], |
| 42 | }, |
| 43 | ] |
| 44 | } |