import { Suspense, lazy } from 'react'; import apiClient from '../../api/client'; import RadarDataPanel from '../../panels/RadarDataPanel'; import { ADMIN_ONLY_TABS, LEFT_GROUP_LABELS, LEFT_GROUP_SECTIONS, LEFT_GROUP_TABS, LEFT_TAB_GROUP, LEFT_TAB_SECTION, PRODUCTION_WORKSPACE_ROUTE_TABS, } from '../../config/appConstants'; import { getLeftTabLabel } from '../../utils/appUiHelpers'; import { PanelLoadingBody, PanelLoadingPanel } from './AppLoadingFallbacks'; const LazyDataMonitorPanel = lazy(() => import('../../DataMonitorPanel')); const LazyAssetInventoryPanel = lazy(() => import('../../AssetInventoryPanel')); const LazyDataCopierPanel = lazy(() => import('../../DataCopierPanel')); const LazyIDLAutomationPanel = lazy(() => import('../../IDLAutomationPanel')); const LazyHazardPointPanel = lazy(() => import('../../HazardPointPanel')); const LazyHealthCheckPanel = lazy(() => import('../../HealthCheckPanel')); const LazyFloodAnalysisWorkspace = lazy(() => import('../../FloodAnalysisWorkspace')); const LazyUserAdminPanel = lazy(() => import('../../UserAdminPanel')); const LazyAuditLogPanel = lazy(() => import('../../AuditLogPanel')); const LazyAiQualityPanel = lazy(() => import('../../panels/AiQualityPanel')); const LazyAiAnalysisPanel = lazy(() => import('../../AiAnalysisPanel')); const LazyPairingPanel = lazy(() => import('../../panels/PairPlanningPanel')); const LazyDinsarResultPanel = lazy(() => import('../../panels/DinsarResultPanel')); const LazyBatchPanel = lazy(() => import('../../panels/BatchPanel')); const LazyPairsListPanel = lazy(() => import('../../panels/PairsListPanel')); const LazyPsResultsPanel = lazy(() => import('../../panels/PsResultsPanel')); const LazyPsinsarCatalogPanel = lazy(() => import('../PsinsarCatalogPanel')); const LazyProductionWorkspace = lazy(() => import('../../ProductionWorkspace')); export default function AppSidePanel({ leftPanelWidth, leftPanelTab, setLeftPanelTab, isStandalone, isAdmin, isReadOnlyUser, currentUser, language, apiEndpoint, licenseOk, foundPairs, psResults, dinsarTotal, selectedPairsCount, hasEnoughRadarScenesForPlanning, isLoading, hasRadarSearched, showHazardPoints, hazardPoints, aiStatus, radarPanel, pairingPanel, taskPanel, hazardPanel, floodPanel, dinsarPanel, aiPanel, pairsPanel, psPanel, }) { const isProductionWorkspace = PRODUCTION_WORKSPACE_ROUTE_TABS.has(leftPanelTab); const activeLeftGroup = LEFT_TAB_GROUP[leftPanelTab] || 'data'; const leftTabLabelContext = { pairCount: foundPairs.length, psResultCount: psResults ? Object.keys(psResults).length : 0, dinsarTotal, }; const getVisibleTabs = (tabs = []) => tabs.filter((tab) => isAdmin || !ADMIN_ONLY_TABS.has(tab)); const getVisibleSections = (groupKey) => ( (LEFT_GROUP_SECTIONS[groupKey] || []) .map((section) => ({ ...section, tabs: getVisibleTabs(section.tabs || []), })) .filter((section) => section.tabs.length > 0) ); const getDefaultGroupTab = (groupKey) => { const visibleSections = getVisibleSections(groupKey); if (visibleSections.length > 0) { return visibleSections[0]?.tabs?.[0] || ''; } return getVisibleTabs(LEFT_GROUP_TABS[groupKey] || [])[0] || ''; }; const mainWorkspaceTab = getDefaultGroupTab('data') || 'data'; const activeGroupSections = getVisibleSections(activeLeftGroup); const hasSectionNav = activeGroupSections.length > 0; const preferredActiveSection = LEFT_TAB_SECTION[leftPanelTab]; const activeLeftSection = hasSectionNav && activeGroupSections.some((section) => section.key === preferredActiveSection) ? preferredActiveSection : (activeGroupSections[0]?.key || null); const activeLeafTabs = hasSectionNav ? (activeGroupSections.find((section) => section.key === activeLeftSection)?.tabs || []) : getVisibleTabs(LEFT_GROUP_TABS[activeLeftGroup] || []); const standaloneSectionTabs = isProductionWorkspace ? [] : ( hasSectionNav ? (activeGroupSections.find((section) => section.key === activeLeftSection)?.tabs || activeLeafTabs) : activeLeafTabs ); const standaloneEyebrow = [LEFT_GROUP_LABELS[activeLeftGroup], activeGroupSections.find((section) => section.key === activeLeftSection)?.label] .filter(Boolean) .join(' / '); const standaloneTitle = isProductionWorkspace ? '生产管理' : getLeftTabLabel(leftPanelTab, leftTabLabelContext); const standaloneDescription = isProductionWorkspace ? '这里统一承载 D-InSAR 与时序InSAR的运行和产物页面,当前时序流程默认接入 SBAS,后续可继续扩展 PS-InSAR / SBAS-InSAR。' : '当前模块已切换为独立工作区模式。'; return ( ); }