'use client'
import type { ReactNode } from 'react'
import type { IntegrationSection } from './routes'
import { ApiBasedExtensionPage } from '@/app/components/header/account-setting/api-based-extension-page'
import DataSourcePage from '@/app/components/header/account-setting/data-source-page-new'
import ModelProviderPage from '@/app/components/header/account-setting/model-provider-page'
import { PluginCategoryEnum } from '@/app/components/plugins/types'
import { toolsContentFrameClassNames, toolsContentInsetClassNames } from '@/app/components/tools/content-inset'
import { IntegrationPageHeader } from './page-header'
import PluginCategoryPage from './plugin-category-page'
import { IntegrationSectionLayout } from './section-layout'
import ToolProviderList from './tool-provider-list'
type IntegrationSectionRendererProps = {
canInstallPlugin?: boolean
description?: ReactNode
onProviderSearchTextChange: (value: string) => void
onSwitchToMarketplace?: () => void
pluginCategoryToolbarAction?: ReactNode
providerSearchText: string
scrollAreaLabel?: string
section: IntegrationSection
title?: ReactNode
}
const IntegrationSectionRenderer = ({
canInstallPlugin = true,
description,
onProviderSearchTextChange,
onSwitchToMarketplace,
pluginCategoryToolbarAction,
providerSearchText,
scrollAreaLabel,
section,
title,
}: IntegrationSectionRendererProps) => {
const compactFrameClassName = `${toolsContentFrameClassNames.compact} ${toolsContentInsetClassNames.compact}`
const renderHeader = (toolbar?: ReactNode) => (
)
const renderScrollBody = (body: ReactNode) => (
{body}
)
const renderScrollableLayout = ({ body, toolbar }: { body: ReactNode, toolbar: ReactNode }) => (
<>
{renderHeader(toolbar)}
{renderScrollBody(body)}
>
)
const renderDirectLayout = ({ body, toolbar }: { body: ReactNode, toolbar: ReactNode }) => (
<>
{renderHeader(toolbar)}
{body}
>
)
switch (section) {
case 'provider':
return (
)
case 'builtin':
return
case 'mcp':
return
case 'custom-tool':
return
case 'workflow-tool':
return
case 'data-source':
return (
)
case 'custom-endpoint':
return
case 'trigger':
return
case 'agent-strategy':
return
case 'extension':
return
default:
return null
}
}
export default IntegrationSectionRenderer