import React from 'react'; import { Button } from 'antd'; import { CopyOutlined, ReloadOutlined } from '@ant-design/icons'; import type { AIMCPClientInstallStatus } from '../../types'; import { buildRemoteMCPClientQuickStart, isRemoteMCPClientStatus, } from '../../utils/mcpClientInstallStatus'; import { useOptionalI18n } from '../../i18n/provider'; import type { OverlayWorkbenchTheme } from '../../utils/overlayWorkbenchTheme'; import AIMCPRemoteQuickStartPanel from './AIMCPRemoteQuickStartPanel'; import { getMCPClientStatusSummary, getMCPClientStatusTone, getSelectedMCPClientStateLine, resolveMCPClientCommandName, translateMCPClientInstallCopy, } from './mcpClientInstallPanelState'; interface AIMCPClientStatusPanelProps { selectedStatus?: AIMCPClientInstallStatus; selectedCommandText: string; darkMode: boolean; overlayTheme: OverlayWorkbenchTheme; cardBorder: string; statusLoading: boolean; onRefreshStatus: () => void; onCopyConfigPath: () => void; onCopyLaunchCommand: () => void; } const AIMCPClientStatusPanel: React.FC = ({ selectedStatus, selectedCommandText, darkMode, overlayTheme, cardBorder, statusLoading, onRefreshStatus, onCopyConfigPath, onCopyLaunchCommand, }) => { const i18n = useOptionalI18n(); const t = i18n?.t; const copy = ( key: string, fallback: string, params?: Record, ) => translateMCPClientInstallCopy(t, key, fallback, params); const selectedIsRemoteClient = isRemoteMCPClientStatus(selectedStatus); const remoteQuickStart = selectedIsRemoteClient ? buildRemoteMCPClientQuickStart(selectedStatus, t) : null; return (
{copy('ai_chat.mcp_client.install.status.title', 'Selected client status')}
{copy( selectedStatus?.displayName ? 'ai_chat.mcp_client.install.status.current_target' : 'ai_chat.mcp_client.install.status.no_client', selectedStatus?.displayName ? 'Current target client: {{label}}' : 'No client selected', { label: selectedStatus?.displayName || '' }, )}
{getMCPClientStatusSummary(selectedStatus, t)}
{selectedStatus && ( (() => { const tone = getMCPClientStatusTone(selectedStatus, darkMode, t); return (
{tone.label}
); })() )}
{copy('ai_chat.mcp_client.install.status.current_state', 'Current status: {{status}}', { status: getSelectedMCPClientStateLine(selectedStatus, t), })}
{selectedIsRemoteClient && (
{copy( 'ai_chat.mcp_client.install.status.remote_boundary', 'Remote connection boundary: database connection info and passwords stay in Windows GoNavi. Cloud Agents read connection summaries, object lists, tables, views, and DDL through schema-only MCP tools by default, and execute_sql is not registered. For cross-machine access, use GoNavi Streamable HTTP mode with a token, tunnel, or reverse proxy.', )}
)} {remoteQuickStart && ( )}
{copy('ai_chat.mcp_client.install.status.cli_prefix', 'CLI detection: {{status}}', { status: selectedIsRemoteClient ? copy('ai_chat.mcp_client.install.status.cli.remote', 'Remote Agent does not need local {{command}} command detection', { command: resolveMCPClientCommandName(selectedStatus) }) : selectedStatus?.clientDetected ? copy('ai_chat.mcp_client.install.status.cli.detected', 'Detected {{command}}', { command: resolveMCPClientCommandName(selectedStatus) }) : copy('ai_chat.mcp_client.install.status.cli.not_detected', '{{command}} was not detected; config can still be written first', { command: resolveMCPClientCommandName(selectedStatus) }), })}
{selectedStatus?.clientPath && (
{copy('ai_chat.mcp_client.install.status.command_path', 'Command path: {{path}}', { path: selectedStatus.clientPath })}
)}
{copy('ai_chat.mcp_client.install.status.detection_result', 'Detection result: {{message}}', { message: selectedStatus?.message || copy('ai_chat.mcp_client.install.status.detection_missing', 'No connection status detected'), })}
{selectedStatus?.configPath && (
{copy('ai_chat.mcp_client.install.status.config_file', 'Config file: {{path}}', { path: selectedStatus.configPath })}
)} {selectedCommandText && (
{copy('ai_chat.mcp_client.install.status.launch_command', 'Launch command: {{command}}', { command: selectedCommandText })}
)}
); }; export default AIMCPClientStatusPanel;