import React, { useState } from 'react'; import { Modal, Transfer, Input, Space, Checkbox, Avatar, Highlight, } from '@douyinfe/semi-ui'; import { IconClose } from '@douyinfe/semi-icons'; const CHANNEL_STATUS_CONFIG = { 1: { color: 'green', text: '启用' }, 2: { color: 'red', text: '禁用' }, 3: { color: 'amber', text: '自禁' }, default: { color: 'grey', text: '未知' } }; const getChannelStatusConfig = (status) => { return CHANNEL_STATUS_CONFIG[status] || CHANNEL_STATUS_CONFIG.default; }; export default function ChannelSelectorModal({ t, visible, onCancel, onOk, allChannels = [], selectedChannelIds = [], setSelectedChannelIds, channelEndpoints, updateChannelEndpoint, }) { const [searchText, setSearchText] = useState(''); const ChannelInfo = ({ item, showEndpoint = false, isSelected = false }) => { const channelId = item.key || item.value; const currentEndpoint = channelEndpoints[channelId]; const baseUrl = item._originalData?.base_url || ''; const status = item._originalData?.status || 0; const statusConfig = getChannelStatusConfig(status); return ( <> {statusConfig.text}
{isSelected ? ( item.label ) : ( )}
{isSelected ? ( baseUrl ) : ( )} {showEndpoint && ( updateChannelEndpoint(channelId, value)} placeholder="/api/ratio_config" className="flex-1 text-xs" style={{ fontSize: '12px' }} /> )} {isSelected && !showEndpoint && ( {currentEndpoint} )}
); }; const renderSourceItem = (item) => { return (
); }; const renderSelectedItem = (item) => { return (
); }; const channelFilter = (input, item) => { const searchLower = input.toLowerCase(); return item.label.toLowerCase().includes(searchLower) || (item._originalData?.base_url || '').toLowerCase().includes(searchLower); }; return ( {t('选择同步渠道')}} width={1000} > ); }