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