@@ -6,6 +6,7 @@ import { AnimatePresence, motion } from 'motion/react';
66import {
77 type AgentState ,
88 type TrackReference ,
9+ VideoTrack ,
910 useLocalParticipant ,
1011 useRoomContext ,
1112 useTracks ,
@@ -14,7 +15,6 @@ import {
1415import { ActionBar } from '@/components/embed-popup/action-bar' ;
1516import { AudioVisualizer } from '@/components/embed-popup/audio-visualizer' ;
1617import { Transcript } from '@/components/embed-popup/transcript' ;
17- import { AvatarTile } from '@/components/livekit/avatar-tile' ;
1818import useChatAndTranscription from '@/hooks/use-chat-and-transcription' ;
1919import { useDebugMode } from '@/hooks/useDebug' ;
2020import type { AppConfig , EmbedErrorDetails } from '@/lib/types' ;
@@ -109,8 +109,25 @@ export const PopupView = ({
109109
110110 return (
111111 < div ref = { ref } inert = { disabled } className = "flex h-full w-full flex-col overflow-hidden" >
112- < div className = "relative flex h-full shrink-1 grow-1 flex-col py-1" >
113- < div className = "absolute top-0 left-0 h-full w-1/2" />
112+ < div className = "relative flex h-full shrink-1 grow-1 flex-col" >
113+ { /* Transcript */ }
114+ < TranscriptMotion
115+ initial = { {
116+ y : 10 ,
117+ opacity : 0 ,
118+ } }
119+ animate = { {
120+ y : chatOpen ? 0 : 10 ,
121+ opacity : chatOpen ? 1 : 0 ,
122+ } }
123+ transition = { {
124+ type : 'spring' ,
125+ duration : 0.5 ,
126+ bounce : 0 ,
127+ } }
128+ messages = { messages }
129+ />
130+
114131 { /* Audio Visualizer */ }
115132 < AnimatePresence >
116133 { ! agentVideoTrack && (
@@ -133,7 +150,7 @@ export const PopupView = ({
133150 } }
134151 transition = { TILE_TRANSITION }
135152 className = { cn (
136- 'bg-bg1 dark:bg-bg2 pointer-events-none absolute z-10 flex aspect-square w-64 items-center justify-center rounded-2xl border border-transparent transition-colors' ,
153+ 'bg-bg1 dark:bg-bg2 pointer-events-none absolute flex aspect-square w-64 items-center justify-center rounded-2xl border border-transparent transition-colors' ,
137154 chatOpen && 'border-separator1 dark:border-separator2 drop-shadow-2xl'
138155 ) }
139156 >
@@ -172,9 +189,14 @@ export const PopupView = ({
172189 duration : 1 ,
173190 } ,
174191 } }
175- className = "pointer-events-none absolute inset-1 z-10 overflow-hidden rounded-[24px] "
192+ className = "border-separator1 dark:border-separator2 pointer-events-none absolute inset-1 drop-shadow-lg/20 "
176193 >
177- < AvatarTile videoTrack = { agentVideoTrack } className = "h-full bg-black object-cover" />
194+ < VideoTrack
195+ trackRef = { agentVideoTrack }
196+ width = { agentVideoTrack ?. publication . dimensions ?. width ?? 0 }
197+ height = { agentVideoTrack ?. publication . dimensions ?. height ?? 0 }
198+ className = "h-full rounded-[24px] bg-black object-cover"
199+ />
178200 </ motion . div >
179201 ) }
180202 </ AnimatePresence >
@@ -198,11 +220,13 @@ export const PopupView = ({
198220 left : isCameraEnabled || isScreenShareEnabled ? '37.5%' : '50%' ,
199221 } }
200222 transition = { TILE_TRANSITION }
201- className = "pointer-events-none absolute z-10 overflow-hidden rounded-md "
223+ className = "border-separator1 dark:border-separator2 pointer-events-none absolute drop-shadow-lg/20 "
202224 >
203- < AvatarTile
204- videoTrack = { agentVideoTrack }
205- className = "aspect-square w-[70px] bg-black object-cover"
225+ < VideoTrack
226+ trackRef = { agentVideoTrack }
227+ width = { agentVideoTrack ?. publication . dimensions ?. width ?? 0 }
228+ height = { agentVideoTrack ?. publication . dimensions ?. height ?? 0 }
229+ className = "aspect-square w-[70px] rounded-md bg-black object-cover"
206230 />
207231 </ motion . div >
208232 ) }
@@ -218,7 +242,6 @@ export const PopupView = ({
218242 opacity : 0 ,
219243 right : '12px' ,
220244 top : '346px' ,
221-
222245 transformOrigin : 'center bottom' ,
223246 } }
224247 animate = { {
@@ -233,41 +256,38 @@ export const PopupView = ({
233256 opacity : 0 ,
234257 } }
235258 transition = { TILE_TRANSITION }
236- className = "pointer-events-none absolute z-10 overflow-hidden rounded-md "
259+ className = "border-separator1 dark:border-separator2 pointer-events-none absolute drop-shadow-lg/20 "
237260 >
238- < AvatarTile
239- videoTrack = { cameraTrack || screenShareTrack }
240- className = "aspect-square w-[70px] bg-black object-cover"
261+ < VideoTrack
262+ trackRef = { cameraTrack || screenShareTrack }
263+ width = { ( cameraTrack || screenShareTrack ) ?. publication . dimensions ?. width ?? 0 }
264+ height = { ( cameraTrack || screenShareTrack ) ?. publication . dimensions ?. height ?? 0 }
265+ className = "aspect-square w-[70px] rounded-md bg-black object-cover"
241266 />
242267 </ motion . div >
243268 ) }
244269 </ AnimatePresence >
245270
246- { /* Transcript */ }
247- < TranscriptMotion
271+ { /* Action Bar */ }
272+ < motion . div
248273 initial = { {
249- y : 10 ,
250274 opacity : 0 ,
275+ translateY : 8 ,
251276 } }
252277 animate = { {
253- y : chatOpen ? 0 : 10 ,
254- opacity : chatOpen ? 1 : 0 ,
278+ opacity : sessionStarted ? 1 : 0 ,
279+ translateY : sessionStarted ? 0 : 8 ,
255280 } }
256281 transition = { {
257- type : 'spring' ,
258- duration : 0.5 ,
259- bounce : 0 ,
282+ delay : 0.5 ,
260283 } }
261- messages = { messages }
262- className = "relative z-30"
263- />
264-
265- { /* Action Bar */ }
266- < ActionBar
267- onSendMessage = { onSendMessage }
268- capabilities = { capabilities }
269- onChatOpenChange = { setChatOpen }
270- />
284+ >
285+ < ActionBar
286+ capabilities = { capabilities }
287+ onSendMessage = { onSendMessage }
288+ onChatOpenChange = { setChatOpen }
289+ />
290+ </ motion . div >
271291 </ div >
272292 </ div >
273293 ) ;
0 commit comments