import { useMemo, useState } from 'react'; import { Check, Sparkles, Users } from 'lucide-react'; import type { ThemeTokens } from '../../context/ThemeContext'; import type { I18n } from '../../i18n/locales'; import { customTeam, presetTeams, qualityExperts } from '../../lib/teams'; import type { ExpertTeam, TeamTone } from '../../lib/teams'; /** * 专家团召集面板:从对话区头部弹出,选一个预设质量专家团或自己勾几位质量专家发起会诊。 * 只做"选人 + 开会"这一件事,会诊内容与播放时序都在 lib/teams.ts 与 AgentDock 里。 */ interface Props { tk: ThemeTokens; t: I18n; onConvene: (team: ExpertTeam) => void; onClose: () => void; } const toneColor = (tone: TeamTone, tk: ThemeTokens) => tone === 'danger' ? tk.danger : tone === 'warning' ? tk.warning : tone === 'success' ? tk.success : tone === 'info' ? tk.info : tk.accent; export default function TeamPicker({ tk, t, onConvene, onClose }: Props) { const presets = useMemo(() => presetTeams(), []); const experts = useMemo(() => qualityExperts(), []); const [sel, setSel] = useState([]); const toggle = (code: string) => setSel(prev => (prev.includes(code) ? prev.filter(c => c !== code) : [...prev, code])); const custom = sel.length >= 2 ? customTeam(sel) : null; const nameOf = (code: string) => experts.find(e => e.code === code)?.name ?? code; return (
{t.team.panel}
{t.team.presetHint}
{/* 预设团:一键就位 */}
{presets.map(p => { const c = toneColor(p.tone, tk); return ( ); })}
{/* 自建团:勾选专家,首位为牵头 */}
{t.team.customTitle}
{t.team.customHint}
{experts.map(e => { const on = sel.includes(e.code); const lead = sel[0] === e.code && sel.length >= 2; return ( ); })}
= 2 ? tk.textSub : tk.textMuted }}> {sel.length >= 2 ? `${t.team.selected}:${sel.map(nameOf).join('、')}` : t.team.needTwo}
); }