import { Check, Users } from "lucide-react"; import type * as React from "react"; import type { AgentPersona, AgentTeam } from "@/shared/api/types"; import { cn } from "@/shared/lib/cn"; import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar"; import { resolveTeamPersonas } from "@/features/agents/lib/teamPersonas"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/shared/ui/tooltip"; type SelectionChipButtonProps = { disabled: boolean; label: string; onClick: () => void; selected: boolean; children: React.ReactNode; }; function SelectionChipButton({ disabled, label: _label, onClick, selected, children, }: SelectionChipButtonProps) { return ( ); } type AddChannelBotTeamsSectionProps = { canToggleSelections: boolean; inChannelPersonaIds?: ReadonlySet; isLoading: boolean; onToggleTeam: (personaIds: string[]) => void; personas: AgentPersona[]; selectedPersonaIds: readonly string[]; teams: AgentTeam[]; }; export function AddChannelBotTeamsSection({ canToggleSelections, inChannelPersonaIds, isLoading, onToggleTeam, personas, selectedPersonaIds, teams, }: AddChannelBotTeamsSectionProps) { if (isLoading || teams.length === 0) { return null; } return (
Teams

Select a team to toggle all its agents at once.

{teams.map((team) => { const resolution = resolveTeamPersonas(team, personas); const validIds = resolution.resolvedPersonaIds; const allSelected = validIds.length > 0 && validIds.every((id) => selectedPersonaIds.includes(id)); const inChannelCount = inChannelPersonaIds ? validIds.filter((id) => inChannelPersonaIds.has(id)).length : 0; const allInChannel = inChannelCount > 0 && inChannelCount === validIds.length; return (
onToggleTeam(validIds)} selected={allSelected} > {team.name} ({validIds.length}) {inChannelCount > 0 ? ( {allInChannel ? "All in channel" : `${inChannelCount} in channel`} ) : null}

{team.name}

{team.description ? (

{team.description}

) : null}
{resolution.resolvedPersonas.map((persona) => { const personaInChannel = inChannelPersonaIds?.has(persona.id) ?? false; return (
{persona.displayName} {personaInChannel ? ( ) : null}
); })}
); })}
); }