mobileProductMenuRegistry.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import React, { type ComponentType } from 'react'
  2. /**
  3. * Lazy-loaded product menu components to avoid circular dependencies
  4. * (registry -> Layout -> ProjectLayout -> MobileMenuContent -> registry).
  5. * Sections without a dedicated product menu map to null.
  6. */
  7. export const MOBILE_PRODUCT_MENU_REGISTRY: Record<string, ComponentType | null> = {
  8. HOME: null,
  9. editor: React.lazy(() =>
  10. import('@/components/layouts/TableEditorLayout/TableEditorMenu').then((m) => ({
  11. default: m.TableEditorMenu,
  12. }))
  13. ),
  14. sql: React.lazy(() =>
  15. import('@/components/layouts/SQLEditorLayout/SQLEditorMenu').then((m) => ({
  16. default: m.SQLEditorMenu,
  17. }))
  18. ),
  19. database: React.lazy(() =>
  20. import('@/components/layouts/DatabaseLayout/DatabaseLayout').then((m) => ({
  21. default: m.DatabaseProductMenu,
  22. }))
  23. ),
  24. auth: React.lazy(() =>
  25. import('@/components/layouts/AuthLayout/AuthLayout').then((m) => ({
  26. default: m.AuthProductMenu,
  27. }))
  28. ),
  29. storage: React.lazy(() =>
  30. import('@/components/interfaces/Storage/StorageMenuV2').then((m) => ({
  31. default: m.StorageMenuV2,
  32. }))
  33. ),
  34. functions: React.lazy(() =>
  35. import('@/components/layouts/EdgeFunctionsLayout/EdgeFunctionsLayout').then((m) => ({
  36. default: m.EdgeFunctionsProductMenu,
  37. }))
  38. ),
  39. realtime: React.lazy(() =>
  40. import('@/components/layouts/RealtimeLayout/RealtimeLayout').then((m) => ({
  41. default: m.RealtimeProductMenu,
  42. }))
  43. ),
  44. advisors: React.lazy(() =>
  45. import('@/components/layouts/AdvisorsLayout/AdvisorsSidebarMenu').then((m) => ({
  46. default: m.AdvisorsSidebarMenu,
  47. }))
  48. ),
  49. observability: React.lazy(() =>
  50. import('@/components/layouts/ObservabilityLayout/ObservabilityMenu').then((m) => ({
  51. default: m.default,
  52. }))
  53. ),
  54. logs: React.lazy(() =>
  55. import('@/components/layouts/LogsLayout/LogsSidebarMenuV2').then((m) => ({
  56. default: m.LogsSidebarMenuV2,
  57. }))
  58. ),
  59. api: null,
  60. integrations: React.lazy(() =>
  61. import('@/components/layouts/Integrations/IntegrationsProductMenu').then((m) => ({
  62. default: m.IntegrationsProductMenu,
  63. }))
  64. ),
  65. settings: React.lazy(() =>
  66. import('@/components/layouts/ProjectSettingsLayout/SettingsLayout').then((m) => ({
  67. default: m.SettingsProductMenu,
  68. }))
  69. ),
  70. }
  71. export function getProductMenuComponent(sectionKey: string): ComponentType | null {
  72. return MOBILE_PRODUCT_MENU_REGISTRY[sectionKey] ?? null
  73. }