import React from 'react'; import { Modal, Transfer, Input, Card, Space, Button, Checkbox, } from '@douyinfe/semi-ui'; import { IconPlus, IconClose } from '@douyinfe/semi-icons'; /** * ChannelSelectorModal * 负责选择同步渠道、测试与批量测试等 UI,纯展示组件。 * 业务状态与动作通过 props 注入,保持可复用与可测试。 */ export default function ChannelSelectorModal({ t, visible, onCancel, onOk, // 渠道与选择 allChannels = [], selectedChannelIds = [], setSelectedChannelIds, // 自定义渠道 customUrl, setCustomUrl, customEndpoint, setCustomEndpoint, customChannelTesting, addCustomChannel, // 渠道端点 channelEndpoints, updateChannelEndpoint, // 测试相关 }) { // Transfer 自定义渲染 const renderSourceItem = (item) => { const channelId = item.key || item.value; const currentEndpoint = channelEndpoints[channelId]; const baseUrl = item._originalData?.base_url || ''; return (
{item.label}
{baseUrl} updateChannelEndpoint(channelId, value)} placeholder="/api/ratio_config" className="flex-1 text-xs" style={{ fontSize: '12px' }} />
); }; const renderSelectedItem = (item) => { const channelId = item.key || item.value; const currentEndpoint = channelEndpoints[channelId]; const baseUrl = item._originalData?.base_url || ''; return (
{item.label}
{baseUrl} {currentEndpoint}
); }; const channelFilter = (input, item) => item.label.toLowerCase().includes(input.toLowerCase()); return ( {t('选择同步渠道')}} width={1000} > ); }