|
1 | 1 | 'use client' |
2 | 2 |
|
| 3 | +import dynamic from 'next/dynamic' |
3 | 4 | import { useSearchParams } from 'next/navigation' |
4 | | -import { |
5 | | - ApiKeys, |
6 | | - BYOK, |
7 | | - Copilot, |
8 | | - CredentialSets, |
9 | | - Credentials, |
10 | | - CustomTools, |
11 | | - Debug, |
12 | | - General, |
13 | | - MCP, |
14 | | - Skills, |
15 | | - Subscription, |
16 | | - TeamManagement, |
17 | | - TemplateProfile, |
18 | | - WorkflowMcpServers, |
19 | | -} from '@/app/workspace/[workspaceId]/settings/components' |
| 5 | +import { Skeleton } from '@/components/emcn' |
| 6 | +import { ApiKeysSkeleton } from '@/app/workspace/[workspaceId]/settings/components/api-keys/api-key-skeleton' |
| 7 | +import { BYOKSkeleton } from '@/app/workspace/[workspaceId]/settings/components/byok/byok-skeleton' |
| 8 | +import { CopilotSkeleton } from '@/app/workspace/[workspaceId]/settings/components/copilot/copilot-skeleton' |
| 9 | +import { CredentialSetsSkeleton } from '@/app/workspace/[workspaceId]/settings/components/credential-sets/credential-sets-skeleton' |
| 10 | +import { CredentialsSkeleton } from '@/app/workspace/[workspaceId]/settings/components/credentials/credential-skeleton' |
| 11 | +import { CustomToolsSkeleton } from '@/app/workspace/[workspaceId]/settings/components/custom-tools/custom-tool-skeleton' |
| 12 | +import { DebugSkeleton } from '@/app/workspace/[workspaceId]/settings/components/debug/debug-skeleton' |
| 13 | +import { GeneralSkeleton } from '@/app/workspace/[workspaceId]/settings/components/general/general-skeleton' |
| 14 | +import { McpSkeleton } from '@/app/workspace/[workspaceId]/settings/components/mcp/mcp-skeleton' |
| 15 | +import { SkillsSkeleton } from '@/app/workspace/[workspaceId]/settings/components/skills/skill-skeleton' |
| 16 | +import { WorkflowMcpServersSkeleton } from '@/app/workspace/[workspaceId]/settings/components/workflow-mcp-servers/workflow-mcp-servers-skeleton' |
20 | 17 | import type { SettingsSection } from '@/app/workspace/[workspaceId]/settings/navigation' |
21 | 18 | import { |
22 | 19 | allNavigationItems, |
23 | 20 | isBillingEnabled, |
24 | 21 | } from '@/app/workspace/[workspaceId]/settings/navigation' |
25 | | -import { AccessControl } from '@/ee/access-control/components/access-control' |
26 | | -import { SSO } from '@/ee/sso/components/sso-settings' |
| 22 | + |
| 23 | +/** |
| 24 | + * Generic skeleton fallback for sections without a dedicated skeleton. |
| 25 | + */ |
| 26 | +function SettingsSectionSkeleton() { |
| 27 | + return ( |
| 28 | + <div className='flex flex-col gap-[16px]'> |
| 29 | + <Skeleton className='h-[20px] w-[200px] rounded-[4px]' /> |
| 30 | + <Skeleton className='h-[40px] w-full rounded-[8px]' /> |
| 31 | + <Skeleton className='h-[40px] w-full rounded-[8px]' /> |
| 32 | + <Skeleton className='h-[40px] w-full rounded-[8px]' /> |
| 33 | + </div> |
| 34 | + ) |
| 35 | +} |
| 36 | + |
| 37 | +const General = dynamic( |
| 38 | + () => |
| 39 | + import('@/app/workspace/[workspaceId]/settings/components/general/general').then( |
| 40 | + (m) => m.General |
| 41 | + ), |
| 42 | + { loading: () => <GeneralSkeleton /> } |
| 43 | +) |
| 44 | +const Credentials = dynamic( |
| 45 | + () => |
| 46 | + import('@/app/workspace/[workspaceId]/settings/components/credentials/credentials').then( |
| 47 | + (m) => m.Credentials |
| 48 | + ), |
| 49 | + { loading: () => <CredentialsSkeleton /> } |
| 50 | +) |
| 51 | +const TemplateProfile = dynamic( |
| 52 | + () => |
| 53 | + import( |
| 54 | + '@/app/workspace/[workspaceId]/settings/components/template-profile/template-profile' |
| 55 | + ).then((m) => m.TemplateProfile), |
| 56 | + { loading: () => <SettingsSectionSkeleton /> } |
| 57 | +) |
| 58 | +const CredentialSets = dynamic( |
| 59 | + () => |
| 60 | + import( |
| 61 | + '@/app/workspace/[workspaceId]/settings/components/credential-sets/credential-sets' |
| 62 | + ).then((m) => m.CredentialSets), |
| 63 | + { loading: () => <CredentialSetsSkeleton /> } |
| 64 | +) |
| 65 | +const ApiKeys = dynamic( |
| 66 | + () => |
| 67 | + import('@/app/workspace/[workspaceId]/settings/components/api-keys/api-keys').then( |
| 68 | + (m) => m.ApiKeys |
| 69 | + ), |
| 70 | + { loading: () => <ApiKeysSkeleton /> } |
| 71 | +) |
| 72 | +const Subscription = dynamic( |
| 73 | + () => |
| 74 | + import('@/app/workspace/[workspaceId]/settings/components/subscription/subscription').then( |
| 75 | + (m) => m.Subscription |
| 76 | + ), |
| 77 | + { loading: () => <SettingsSectionSkeleton /> } |
| 78 | +) |
| 79 | +const TeamManagement = dynamic( |
| 80 | + () => |
| 81 | + import( |
| 82 | + '@/app/workspace/[workspaceId]/settings/components/team-management/team-management' |
| 83 | + ).then((m) => m.TeamManagement), |
| 84 | + { loading: () => <SettingsSectionSkeleton /> } |
| 85 | +) |
| 86 | +const BYOK = dynamic( |
| 87 | + () => import('@/app/workspace/[workspaceId]/settings/components/byok/byok').then((m) => m.BYOK), |
| 88 | + { loading: () => <BYOKSkeleton /> } |
| 89 | +) |
| 90 | +const Copilot = dynamic( |
| 91 | + () => |
| 92 | + import('@/app/workspace/[workspaceId]/settings/components/copilot/copilot').then( |
| 93 | + (m) => m.Copilot |
| 94 | + ), |
| 95 | + { loading: () => <CopilotSkeleton /> } |
| 96 | +) |
| 97 | +const MCP = dynamic( |
| 98 | + () => import('@/app/workspace/[workspaceId]/settings/components/mcp/mcp').then((m) => m.MCP), |
| 99 | + { loading: () => <McpSkeleton /> } |
| 100 | +) |
| 101 | +const CustomTools = dynamic( |
| 102 | + () => |
| 103 | + import('@/app/workspace/[workspaceId]/settings/components/custom-tools/custom-tools').then( |
| 104 | + (m) => m.CustomTools |
| 105 | + ), |
| 106 | + { loading: () => <CustomToolsSkeleton /> } |
| 107 | +) |
| 108 | +const Skills = dynamic( |
| 109 | + () => |
| 110 | + import('@/app/workspace/[workspaceId]/settings/components/skills/skills').then((m) => m.Skills), |
| 111 | + { loading: () => <SkillsSkeleton /> } |
| 112 | +) |
| 113 | +const WorkflowMcpServers = dynamic( |
| 114 | + () => |
| 115 | + import( |
| 116 | + '@/app/workspace/[workspaceId]/settings/components/workflow-mcp-servers/workflow-mcp-servers' |
| 117 | + ).then((m) => m.WorkflowMcpServers), |
| 118 | + { loading: () => <WorkflowMcpServersSkeleton /> } |
| 119 | +) |
| 120 | +const Debug = dynamic( |
| 121 | + () => |
| 122 | + import('@/app/workspace/[workspaceId]/settings/components/debug/debug').then((m) => m.Debug), |
| 123 | + { loading: () => <DebugSkeleton /> } |
| 124 | +) |
| 125 | +const AccessControl = dynamic( |
| 126 | + () => import('@/ee/access-control/components/access-control').then((m) => m.AccessControl), |
| 127 | + { loading: () => <SettingsSectionSkeleton /> } |
| 128 | +) |
| 129 | +const SSO = dynamic(() => import('@/ee/sso/components/sso-settings').then((m) => m.SSO), { |
| 130 | + loading: () => <SettingsSectionSkeleton />, |
| 131 | +}) |
27 | 132 |
|
28 | 133 | interface SettingsPageProps { |
29 | 134 | section: SettingsSection |
|
0 commit comments