@@ -327,8 +327,9 @@ export const COMPONENTS = {
327327 ] as AgentState [ ] ;
328328
329329 const { microphoneTrack, localParticipant } = useLocalParticipant ( ) ;
330- const [ barCount , setBarCount ] = useState < string > ( barCounts [ 0 ] ) ;
330+ const [ barCount , setBarCount ] = useState ( barCounts [ 0 ] ) ;
331331 const [ state , setState ] = useState < AgentState > ( states [ 0 ] ) ;
332+ const [ demoIndex , setDemoIndex ] = useState ( 0 ) ;
332333
333334 const micTrackRef = useMemo < TrackReferenceOrPlaceholder | undefined > ( ( ) => {
334335 return state === 'speaking'
@@ -380,19 +381,42 @@ export const COMPONENTS = {
380381 </ SelectContent >
381382 </ Select >
382383 </ div >
384+
385+ < div className = "flex-1" >
386+ < label className = "font-mono text-xs uppercase" htmlFor = "demoIndex" >
387+ Demo
388+ </ label >
389+ < Select
390+ value = { demoIndex . toString ( ) }
391+ onValueChange = { ( value ) => setDemoIndex ( parseInt ( value ) ) }
392+ >
393+ < SelectTrigger id = "demoIndex" className = "w-full" >
394+ < SelectValue placeholder = "Select a demo" />
395+ </ SelectTrigger >
396+ < SelectContent >
397+ { gridVariants . map ( ( _ , idx ) => (
398+ < SelectItem key = { idx } value = { idx . toString ( ) } >
399+ Demo { String ( idx + 1 ) }
400+ </ SelectItem >
401+ ) ) }
402+ </ SelectContent >
403+ </ Select >
404+ </ div >
383405 </ div >
384406
385- < div className = "relative flex flex-col justify-center gap-4" >
386- { gridVariants . map ( ( variant : GridOptions , idx ) => (
387- < div key = { idx } className = "border-border grid place-items-center rounded-xl border p-8" >
388- < AudioGridVisualizer
389- state = { state }
390- audioTrack = { micTrackRef ! }
391- columnCount = { parseInt ( barCount ) || 5 }
392- options = { variant }
393- />
394- </ div >
395- ) ) }
407+ < div className = "grid h-48 place-items-center" >
408+ < AudioGridVisualizer
409+ key = { demoIndex }
410+ state = { state }
411+ audioTrack = { micTrackRef ! }
412+ columnCount = { parseInt ( barCount ) || 5 }
413+ options = { gridVariants [ demoIndex ] as GridOptions }
414+ />
415+ </ div >
416+ < div className = "border-border bg-muted rounded-xl border p-8" >
417+ < pre className = "text-muted-foreground text-sm" >
418+ < code > { JSON . stringify ( gridVariants [ demoIndex ] , null , 2 ) } </ code >
419+ </ pre >
396420 </ div >
397421 </ Container >
398422 ) ;
0 commit comments