| gio | cc5ce58 | 2025-06-25 07:45:21 +0400 | [diff] [blame] | 1 | import React from "react"; |
| 2 | import { ChatBubble } from "./ChatBubble"; |
| 3 | import { useAgents } from "@/lib/state"; |
| 4 | |
| 5 | // Approximate height of a collapsed bubble + gap for cascading |
| 6 | const BUBBLE_CASCADE_OFFSET = 70; // e.g., 50px height + 10px padding + 10px gap |
| 7 | const INITIAL_BOTTOM_OFFSET = 20; |
| 8 | const INITIAL_RIGHT_OFFSET = 20; |
| 9 | |
| 10 | export function ChatManager(): React.ReactNode { |
| 11 | // TODO(gio): reconsider |
| 12 | return null; |
| 13 | const agents = useAgents(); |
| 14 | if (agents.length === 0) { |
| 15 | return null; |
| 16 | } |
| 17 | return ( |
| 18 | <> |
| 19 | {agents.map((agent, index) => { |
| 20 | const initialPosition = { |
| 21 | bottom: INITIAL_BOTTOM_OFFSET + index * BUBBLE_CASCADE_OFFSET, |
| 22 | right: INITIAL_RIGHT_OFFSET, |
| 23 | top: undefined, // Ensure top/left are not set if bottom/right are |
| 24 | left: undefined, |
| 25 | }; |
| 26 | return ( |
| 27 | <ChatBubble |
| 28 | key={agent.name} |
| gio | 74c6f75 | 2025-07-05 04:10:58 +0000 | [diff] [blame^] | 29 | agentName={agent.agentName} |
| gio | cc5ce58 | 2025-06-25 07:45:21 +0400 | [diff] [blame] | 30 | agentUrl={agent.address} |
| 31 | initialPosition={initialPosition} |
| 32 | /> |
| 33 | ); |
| 34 | })} |
| 35 | </> |
| 36 | ); |
| 37 | } |