import React from 'react' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@/components/ui/alert-dialog' import { Plus, Trash2 } from 'lucide-react' import type { BotConfig } from '../types' interface BotInfoSectionProps { config: BotConfig onChange: (config: BotConfig) => void } export const BotInfoSection = React.memo(function BotInfoSection({ config, onChange }: BotInfoSectionProps) { // 确保 platforms 和 alias_names 始终是数组 const platforms = config.platforms || [] const aliasNames = config.alias_names || [] const addPlatform = () => { onChange({ ...config, platforms: [...platforms, ''] }) } const removePlatform = (index: number) => { onChange({ ...config, platforms: platforms.filter((_, i) => i !== index), }) } const updatePlatform = (index: number, value: string) => { const newPlatforms = [...platforms] newPlatforms[index] = value onChange({ ...config, platforms: newPlatforms }) } const addAlias = () => { onChange({ ...config, alias_names: [...aliasNames, ''] }) } const removeAlias = (index: number) => { onChange({ ...config, alias_names: aliasNames.filter((_, i) => i !== index), }) } const updateAlias = (index: number, value: string) => { const newAliases = [...aliasNames] newAliases[index] = value onChange({ ...config, alias_names: newAliases }) } return (
暂无别名
)}暂无其他平台账号
)}