diff --git a/src/App.jsx b/src/App.jsx index 603d822..fc22381 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -522,6 +522,10 @@ export default function App() { } })); + // Auto-select the incoming chat to show it immediately + setSelectedChat(peerUsername); + toast.success(`${peerUsername} connected to you!`); + // Send acknowledgment dc.send(JSON.stringify({ type: 'identify_ack', @@ -680,6 +684,9 @@ export default function App() { console.log('Client connection state:', pc.connectionState); if (pc.connectionState === 'connected') { toast.success(`Connected to ${contact}`, { id: 'connecting' }); + // Stop ICE polling once connected + clearInterval(icePolling); + console.log('[Answerer] Stopped ICE polling - connection established'); } else if (pc.connectionState === 'failed' || pc.connectionState === 'disconnected') { toast.error(`Disconnected from ${contact}`); clearInterval(icePolling); @@ -970,6 +977,42 @@ export default function App() { + {/* Incoming Chats (not in contacts) */} + {Object.keys(activeChats).filter(username => !contacts.includes(username) && activeChats[username].status === 'connected').length > 0 && ( +